[ARVADOS] updated: f14965fac774465c0179f5e318c9df3df9b6a05d

Git user git at public.curoverse.com
Tue Mar 28 12:55:46 EDT 2017


Summary of changes:
 apps/workbench/app/helpers/application_helper.rb        |  2 +-
 .../app/views/collections/_show_files.html.erb          |  4 +++-
 apps/workbench/test/integration/collections_test.rb     | 17 +++++++++++++++++
 3 files changed, 21 insertions(+), 2 deletions(-)

       via  f14965fac774465c0179f5e318c9df3df9b6a05d (commit)
      from  2b2c23bf8e997735dbf6c493b168ee3a3ff52be5 (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 f14965fac774465c0179f5e318c9df3df9b6a05d
Author: radhika <radhika at curoverse.com>
Date:   Tue Mar 28 12:54:56 2017 -0400

    3821: The "Remove selected files" option should only be presented if the user can update the collection.

diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index 0dc16fb..056f12f 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -274,7 +274,7 @@ module ApplicationHelper
       "data-placement" => "bottom",
       "data-type" => input_type,
       "data-title" => "Edit #{attr.to_s.gsub '_', ' '}",
-      "data-name" => htmloptions['selection_path'] || attr,
+      "data-name" => htmloptions['selection_name'] || attr,
       "data-object-uuid" => object.uuid,
       "data-toggle" => "manual",
       "data-value" => htmloptions['data-value'] || attrvalue,
diff --git a/apps/workbench/app/views/collections/_show_files.html.erb b/apps/workbench/app/views/collections/_show_files.html.erb
index fc1ca58..37d9283 100644
--- a/apps/workbench/app/views/collections/_show_files.html.erb
+++ b/apps/workbench/app/views/collections/_show_files.html.erb
@@ -27,6 +27,7 @@
                     'data-selection-action' => 'combine-collections',
                     'data-toggle' => 'dropdown'
               %></li>
+            <% if @object.editable? %>
             <li><%= link_to "Remove selected files", '#',
                     method: :post,
                     'data-href' => url_for(action: :remove_selected_files),
@@ -34,6 +35,7 @@
                     'data-selection-action' => 'remove-selected-files',
                     'data-toggle' => 'dropdown'
               %></li>
+            <% end %>
           </ul>
         </div>
         <div class="btn-group btn-group-sm">
@@ -115,7 +117,7 @@
          </div>
         <% else %>
               <% if @object.editable? %>
-                <i class="fa fa-fw fa-file"></i><%= render_editable_attribute @object, 'filename', filename, {'data-value' => file_path, 'data-toggle' => 'manual', 'selection_path' => 'rename-file-path:'+file_path} %>
+                <i class="fa fa-fw fa-file"></i><%= render_editable_attribute @object, 'filename', filename, {'data-value' => file_path, 'data-toggle' => 'manual', 'selection_name' => 'rename-file-path:'+file_path} %>
               <% else %>
                 <i class="fa fa-fw fa-file" href="<%=object.uuid%>/<%=file_path%>" ></i> <%= filename %>
               <% end %>
diff --git a/apps/workbench/test/integration/collections_test.rb b/apps/workbench/test/integration/collections_test.rb
index 2685e52..eb9c2e8 100644
--- a/apps/workbench/test/integration/collections_test.rb
+++ b/apps/workbench/test/integration/collections_test.rb
@@ -340,4 +340,21 @@ class CollectionsTest < ActionDispatch::IntegrationTest
 
     assert(page.has_text?('file1renamed'), 'file not found - file1renamed')
   end
+
+  test "remove/rename file options not presented if user cannot update a collection" do
+    # visit a publicly accessible collection as 'spectator'
+    visit page_with_token('spectator', '/collections/zzzzz-4zz18-uukreo9rbgwsujr')
+
+    click_button 'Selection'
+    within('.selection-action-container') do
+      assert_selector 'li', text: 'Create new collection with selected files'
+      assert_no_selector 'li', text: 'Remove selected files'
+    end
+
+    within('.collection_files') do
+      assert(page.has_text?('GNU_General_Public_License'), 'file not found - GNU_General_Public_License')
+      assert_nil first('.fa-pencil')
+      assert_nil first('.fa-trash-o')
+    end
+  end
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list