[ARVADOS] created: 63c37e7eb04c084650c0c6420a88967c0f39bc22

Git user git at public.curoverse.com
Fri Apr 7 17:09:50 EDT 2017


        at  63c37e7eb04c084650c0c6420a88967c0f39bc22 (commit)


commit 63c37e7eb04c084650c0c6420a88967c0f39bc22
Author: radhika <radhika at curoverse.com>
Date:   Fri Apr 7 17:08:14 2017 -0400

    11365: "lock" collection to prevent user from deleting / renaming files until user explicitly unlocks by clicking the button.

diff --git a/apps/workbench/app/assets/javascripts/edit_collection.js b/apps/workbench/app/assets/javascripts/edit_collection.js
new file mode 100644
index 0000000..86c41b1
--- /dev/null
+++ b/apps/workbench/app/assets/javascripts/edit_collection.js
@@ -0,0 +1,20 @@
+$(document).ready(function(event) {
+  $(".btn-collection-file-control").addClass("disabled");
+  $(".tab-pane-Upload").addClass("disabled");
+  $("#Upload-tab").attr("data-toggle", "disabled");
+}).on('click', '.lock-collection-btn', function(event) {
+  classes = $(event.target).attr('class')
+  if(classes.includes("fa-lock")){
+    $(".lock-collection-btn").removeClass("fa-lock");
+    $(".lock-collection-btn").addClass("fa-unlock");
+    $(".btn-collection-file-control").removeClass("disabled");
+    $(".tab-pane-Upload").removeClass("disabled");
+    $("#Upload-tab").attr("data-toggle", "tab");
+  } else {
+    $(".lock-collection-btn").removeClass("fa-unlock");
+    $(".lock-collection-btn").addClass("fa-lock");
+    $(".btn-collection-file-control").addClass("disabled");
+    $(".tab-pane-Upload").addClass("disabled");
+    $("#Upload-tab").attr("data-toggle", "disabled");
+  }
+});
diff --git a/apps/workbench/app/views/application/_content.html.erb b/apps/workbench/app/views/application/_content.html.erb
index 9441a46..a22608d 100644
--- a/apps/workbench/app/views/application/_content.html.erb
+++ b/apps/workbench/app/views/application/_content.html.erb
@@ -29,7 +29,7 @@
         end
       %>
 
-      <li class="<%= 'active' if i==0 %> <%= link_disabled %>" data-toggle="tooltip" data-placement="top" title="<%=tab_tooltip%>">
+      <li class="<%= 'active' if i==0 %> <%= link_disabled %> tab-pane-<%=pane_name%>" data-toggle="tooltip" data-placement="top" title="<%=tab_tooltip%>">
         <a href="#<%= pane_name %>"
            id="<%= pane_name %>-tab"
            data-toggle="<%= data_toggle %>"
diff --git a/apps/workbench/app/views/collections/_extra_tab_line_buttons.html.erb b/apps/workbench/app/views/collections/_extra_tab_line_buttons.html.erb
new file mode 100644
index 0000000..dd48209
--- /dev/null
+++ b/apps/workbench/app/views/collections/_extra_tab_line_buttons.html.erb
@@ -0,0 +1,3 @@
+<% if @object.editable? %>
+  <i class="fa fa-fw fa-lock lock-collection-btn"></i>
+<% end %>
diff --git a/apps/workbench/app/views/collections/_show_files.html.erb b/apps/workbench/app/views/collections/_show_files.html.erb
index d39c81b..58695ec 100644
--- a/apps/workbench/app/views/collections/_show_files.html.erb
+++ b/apps/workbench/app/views/collections/_show_files.html.erb
@@ -97,14 +97,14 @@
             <% end %>
 
             <% if object.editable? %>
-                <%= link_to({controller: 'collections', action: 'remove_selected_files', id: object.uuid, selection: [object.portable_data_hash+'/'+file_path]}, method: :post, remote: true, data: {confirm: "Remove #{file_path}?", toggle: 'tooltip', placement: 'top'}, class: 'btn btn-sm btn-default btn-nodecorate', title: "Remove #{file_path}") do %>
+                <%= link_to({controller: 'collections', action: 'remove_selected_files', id: object.uuid, selection: [object.portable_data_hash+'/'+file_path]}, method: :post, remote: true, data: {confirm: "Remove #{file_path}?", toggle: 'tooltip', placement: 'top'}, class: 'btn btn-sm btn-default btn-nodecorate btn-collection-file-control', title: "Remove #{file_path}") do %>
                   <i class="fa fa-fw fa-trash-o"></i>
                 <% end %>
             <% end %>
         <% if CollectionsHelper::is_image(filename) %>
             <i class="fa fa-fw fa-bar-chart-o"></i>
               <% if object.editable? %>
-                <%= render_editable_attribute object, 'filename', filename, {'data-value' => file_path, 'data-toggle' => 'manual', 'selection_path' => 'rename-file-path:'+file_path}, {tiptitle: 'Edit path of this file (name or directory or both). If you use the same path as another file, it may be removed.'} %>
+                <%= render_editable_attribute object, 'filename', filename, {'data-value' => file_path, 'data-toggle' => 'manual', 'selection_path' => 'rename-file-path:'+file_path}, {tiptitle: 'Edit name or directory or both for this file'} %>
               <% else %>
                 <%= filename %>
               <% end %>
@@ -117,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_name' => 'rename-file-path:'+file_path}, {tiptitle: 'Edit path of this file (name or directory or both). If you use the same path as another file, it may be removed.'}  %>
+                <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}, {tiptitle: 'Edit name or directory or both for this file', btnclass: 'collection-file-control'}  %>
               <% else %>
                 <i class="fa fa-fw fa-file" href="<%=object.uuid%>/<%=file_path%>" ></i> <%= filename %>
               <% end %>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list