[ARVADOS] updated: 2b43d13d95893044467a96e3a0032aef36d65f03
git at public.curoverse.com
git at public.curoverse.com
Thu Aug 28 09:02:00 EDT 2014
Summary of changes:
apps/workbench/app/helpers/application_helper.rb | 29 +++++++++-------------
.../app/views/projects/_index_projects.html.erb | 2 +-
apps/workbench/test/integration/projects_test.rb | 14 ++++++++---
3 files changed, 23 insertions(+), 22 deletions(-)
via 2b43d13d95893044467a96e3a0032aef36d65f03 (commit)
from 0fe8a55af3116f6097fcbb8c18775ac35c32274b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 2b43d13d95893044467a96e3a0032aef36d65f03
Author: radhika <radhika at curoverse.com>
Date: Thu Aug 28 08:05:49 2014 -0400
3339: some refactoring of the render textile impl. improve the test that verifies project description.
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index 605b0d3..b82ae89 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -154,7 +154,7 @@ module ApplicationHelper
(!object.editable? and
!object.owner_uuid.in?(my_projects.collect(&:uuid)))
if attrvalue && attrvalue.length > 0
- return render_textile_if_textile( object, attr, attrvalue )
+ return render_attribute_as_textile( object, attr, attrvalue, false )
else
return (attr == 'name' and object.andand.default_name) ||
'(none)'
@@ -172,7 +172,7 @@ module ApplicationHelper
end
attrvalue = attrvalue.to_json if attrvalue.is_a? Hash or attrvalue.is_a? Array
- rendervalue = render_textile_if_textile( object, attr, attrvalue )
+ rendervalue = render_attribute_as_textile( object, attr, attrvalue, false )
ajax_options = {
"data-pk" => {
@@ -210,17 +210,6 @@ module ApplicationHelper
end
end
- def render_textile_attribute(object, attr, truncate)
- attrvalue = object.send(attr)
- if attrvalue && attrvalue.length > 0
- markup = render_textile_if_textile( object, attr, attrvalue )
- markup = markup[0,markup.index('</p>')+4] if (truncate && markup.index('</p>'))
- return markup
- else
- return (attr == 'name' and object.andand.default_name) || ''
- end
- end
-
def render_pipeline_component_attribute(object, attr, subattr, value_info, htmloptions={})
datatype = nil
required = true
@@ -471,12 +460,18 @@ module ApplicationHelper
end
end
+ def render_attribute_as_textile( object, attr, attrvalue, truncate )
+ if attrvalue && (is_textile? object, attr)
+ markup = render_markup attrvalue
+ markup = markup[0,markup.index('</p>')+4] if (truncate && markup.index('</p>'))
+ return markup
+ else
+ return attrvalue
+ end
+ end
+
private
def is_textile?( object, attr )
is_textile = object.textile_attributes.andand.include?(attr)
end
-
- def render_textile_if_textile( object, attr, attrvalue )
- is_textile?( object, attr ) ? render_markup(attrvalue) : attrvalue
- end
end
diff --git a/apps/workbench/app/views/projects/_index_projects.html.erb b/apps/workbench/app/views/projects/_index_projects.html.erb
index fa779d2..bf92f34 100644
--- a/apps/workbench/app/views/projects/_index_projects.html.erb
+++ b/apps/workbench/app/views/projects/_index_projects.html.erb
@@ -25,7 +25,7 @@
<% end %>
</div>
<% if projectnode[:object].respond_to?(:description) and not projectnode[:object].description.blank? %>
- <div class="col-md-8 small"><%= render_textile_attribute projectnode[:object], "description", true %></div>
+ <div class="col-md-8 small"><%= render_attribute_as_textile(projectnode[:object], "description", projectnode[:object].description, true) %></div>
<% end %>
</div>
<% end %>
diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb
index 1f7fb36..2fe5169 100644
--- a/apps/workbench/test/integration/projects_test.rb
+++ b/apps/workbench/test/integration/projects_test.rb
@@ -33,24 +33,30 @@ class ProjectsTest < ActionDispatch::IntegrationTest
find('span', text: api_fixture('groups')['aproject']['name']).click
within('.arv-description-as-subtitle') do
find('.fa-pencil').click
- find('.editable-input textarea').set('*Textile description for A project* - "take me home":/')
+ find('.editable-input textarea').set('<p>*Textile description for A project* - "take me home":/ </p><p>And a new paragraph in description.<p/>')
find('.editable-submit').click
end
wait_for_ajax
end
+
+ # visit project page
visit current_path
assert(has_no_text?('.container-fluid', text: '*Textile description for A project*'),
"Description is not rendered properly")
assert(find?('.container-fluid', text: 'Textile description for A project'),
"Description update did not survive page refresh")
- assert(!find?('.container-fluid', text: '*Textile description for A project*'),
- "Textile description is displayed with uninterpreted formatting characters")
+ assert(find?('.container-fluid', text: 'And a new paragraph in description'),
+ "Description did not contain the expected new paragraph")
assert(page.has_link?("take me home"), "link not found in description")
+
click_link 'take me home'
+
+ # now in dashboard
assert(page.has_text?('My projects'), 'My projects - not found on dashboard')
assert(page.has_text?('Projects shared with me'), 'Projects shared with me - not found on dashboard')
assert(page.has_text?('Textile description for A project'), "Project description not found")
- assert(page.has_no_text?('*Textile description for A project*'), "Project description is not rendered properly")
+ assert(page.has_no_text?('*Textile description for A project*'), "Project description is not rendered properly in dashboard")
+ assert(page.has_no_text?('And a new paragraph in description'), "Project description is not truncated after first paragraph")
end
test 'Find a project and edit description to html description' do
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list