3354: Merge branch 'master' into 3354-render-textile
authorTom Clegg <tom@curoverse.com>
Wed, 27 Aug 2014 00:13:41 +0000 (20:13 -0400)
committerTom Clegg <tom@curoverse.com>
Wed, 27 Aug 2014 00:13:41 +0000 (20:13 -0400)
Conflicts:
apps/workbench/app/assets/stylesheets/application.css.scss
apps/workbench/app/helpers/application_helper.rb
apps/workbench/app/models/group.rb

1  2 
apps/workbench/app/assets/stylesheets/application.css.scss
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/helpers/application_helper.rb
apps/workbench/app/models/arvados_base.rb
apps/workbench/app/models/group.rb
apps/workbench/app/views/application/show.html.erb
apps/workbench/test/integration/projects_test.rb

index 7d87dc3ac51fc55afaddc16b6069dcc9bb585a79,5d6acf3110270e19432849628bd0bd9832407eb1..bfb57e9d0862432ecabb57e966641f5716e578d6
@@@ -244,7 -244,9 +244,11 @@@ div.pane-content iframe 
    width: 100%;
    border: none;
  }
--
 +span.editable-textile {
 +  display: inline-block;
 +}
+ .text-overflow-ellipsis {
+   white-space: nowrap;
+   overflow: hidden;
+   text-overflow: ellipsis;
+ }
index de7fd17c09c6b0100dec2ce26589c74b0fa2d190,1f0e5e2b1ae978aa7761fe99be63739a928e24b4..edcb7fbe85b026257f8ec1688df1b770598decef
@@@ -180,11 -186,11 +190,11 @@@ module ApplicationHelpe
      @unique_id ||= (Time.now.to_f*1000000).to_i
      span_id = object.uuid.to_s + '-' + attr.to_s + '-' + (@unique_id += 1).to_s
  
 -    span_tag = content_tag 'span', attrvalue.to_s, {
 -      "data-emptytext" => ('(none)'),
 +    span_tag = content_tag 'span', rendervalue, {
-       "data-emptytext" => (object.andand.default_name || 'none'),
++      "data-emptytext" => '(none)',
        "data-placement" => "bottom",
        "data-type" => input_type,
-       "data-title" => "Edit #{attr.gsub '_', ' '}",
+       "data-title" => "Edit #{attr.to_s.gsub '_', ' '}",
        "data-name" => attr,
        "data-object-uuid" => object.uuid,
        "data-toggle" => "manual",
index a91b729c86d1ba12220a5813da75ba2b7a44172f,b7ffd638bbc0ae4c7310782d0851704e54b93f6c..d47819893a84296685ef1fd9a9d9fc81ae8d98ea
@@@ -24,14 -24,4 +24,8 @@@ class Group < ArvadosBas
    def class_for_display
      group_class == 'project' ? 'Project' : super
    end
-   def editable?
-     respond_to?(:writable_by) and
-       writable_by and
-       writable_by.index(current_user.uuid)
-   end
 +
 +  def textile_attributes
 +    [ 'description' ]
 +  end
  end
index b4202605783e5af89fa23278f01f2166784a3009,8a80bc2eb4e04e107334595a1b848d1dbb6a2f38..07a7b10a49bdd7d262bb4acc86e0597e00f31807
@@@ -25,80 -25,9 +25,80 @@@ class ProjectsTest < ActionDispatch::In
             "Description update did not survive page refresh")
    end
  
 +  test 'Find a project and edit description to textile description' do
 +    visit page_with_token 'active', '/'
 +    find('.arv-project-list a,button', text: 'A Project').
 +      click
 +    within('.container-fluid', text: api_fixture('groups')['aproject']['name']) do
 +      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-submit').click
 +      end
 +      wait_for_ajax
 +    end
 +    visit current_path
 +    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(page.has_link?("take me home"), "link not found in description")
 +    click_link 'take me home'
 +    assert page.has_text?('My projects')
 +    assert page.has_text?('Projects shared with me')
 +  end
 +
 +  test 'Find a project and edit description to html description' do
 +    visit page_with_token 'active', '/'
 +    find('.arv-project-list a,button', text: 'A Project').
 +      click
 +    within('.container-fluid', text: api_fixture('groups')['aproject']['name']) do
 +      find('span', text: api_fixture('groups')['aproject']['name']).click
 +      within('.arv-description-as-subtitle') do
 +        find('.fa-pencil').click
 +        find('.editable-input textarea').set('<br>Textile description for A project</br> - <a href="/">take me home</a>')
 +        find('.editable-submit').click
 +      end
 +      wait_for_ajax
 +    end
 +    visit current_path
 +    assert(find?('.container-fluid', text: 'Textile description for A project'),
 +           "Description update did not survive page refresh")
 +    assert(!find?('.container-fluid', text: '<br>Textile description for A project</br>'),
 +           "Textile description is displayed with uninterpreted formatting characters")
 +    assert(page.has_link?("take me home"),"link not found in description")
 +    click_link 'take me home'
 +    assert page.has_text?('My projects')
 +    assert page.has_text?('Projects shared with me')
 +  end
 +
 +  test 'Find a project and edit description to textile description with link to object' do
 +    visit page_with_token 'active', '/'
 +    find('.arv-project-list a,button', text: 'A Project').
 +      click
 +    within('.container-fluid', text: api_fixture('groups')['aproject']['name']) do
 +      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* - "go to sub-project":' + api_fixture('groups')['asubproject']['uuid'] + "'")
 +        find('.editable-submit').click
 +      end
 +      wait_for_ajax
 +    end
 +    visit current_path
 +    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(page.has_link?("go to sub-project"), "link not found in description")
 +    click_link 'go to sub-project'
 +    assert(page.has_text?(api_fixture('groups')['asubproject']['name']), 'sub-project name not found after clicking link')
 +  end
 +
    test 'Add a new name, then edit it, without creating a duplicate' do
      project_uuid = api_fixture('groups')['aproject']['uuid']
-     specimen_uuid = api_fixture('specimens')['owned_by_aproject_with_no_name_link']['uuid']
+     specimen_uuid = api_fixture('traits')['owned_by_aproject_with_no_name']['uuid']
      visit page_with_token 'active', '/projects/' + project_uuid
      click_link 'Other objects'
      within '.selection-action-container' do