[ARVADOS] updated: 78ae065d149dff4cc1027f9c7941a9116f4ae51a

Git user git at public.curoverse.com
Mon Apr 10 12:01:04 EDT 2017


Summary of changes:
 .../app/assets/javascripts/edit_collection.js      | 51 +++++++++++++---------
 .../app/assets/javascripts/selection.js.erb        |  7 +++
 2 files changed, 38 insertions(+), 20 deletions(-)

       via  78ae065d149dff4cc1027f9c7941a9116f4ae51a (commit)
      from  63c37e7eb04c084650c0c6420a88967c0f39bc22 (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 78ae065d149dff4cc1027f9c7941a9116f4ae51a
Author: radhika <radhika at curoverse.com>
Date:   Mon Apr 10 12:00:27 2017 -0400

    11365: "remove selected files" dropdown selection + collection lock button

diff --git a/apps/workbench/app/assets/javascripts/edit_collection.js b/apps/workbench/app/assets/javascripts/edit_collection.js
index 86c41b1..bc87410 100644
--- a/apps/workbench/app/assets/javascripts/edit_collection.js
+++ b/apps/workbench/app/assets/javascripts/edit_collection.js
@@ -1,20 +1,31 @@
-$(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");
-  }
-});
+// On loading of a collection, enable the "lock" button and
+// disable all file modification controls (upload, rename, delete)
+$(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")){
+            // About to unlock; warn the user
+            if (confirm("Adding, renaming, and deleting files changes the portalble data hash. Are you sure you want to unlock the collection?")) {
+                $(".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 {
+                // User clicked "no" and so do not unlock
+            }
+        } else {
+            // Lock it back
+            $(".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/assets/javascripts/selection.js.erb b/apps/workbench/app/assets/javascripts/selection.js.erb
index 5c69c50..77c5a33 100644
--- a/apps/workbench/app/assets/javascripts/selection.js.erb
+++ b/apps/workbench/app/assets/javascripts/selection.js.erb
@@ -53,6 +53,8 @@ function dispatch_selection_action() {
 function enable_disable_selection_actions() {
     var $container = $(this);
     var $checked = $('.persistent-selection:checkbox:checked', $container);
+    var collection_lock_classes = $('.lock-collection-btn').attr('class')
+
     $('[data-selection-action]', $container).
         closest('div.btn-group-sm').
         find('ul li').
@@ -74,6 +76,11 @@ function enable_disable_selection_actions() {
         toggleClass('disabled',
                     ($checked.filter('[value*=-4zz18-]').length < 1) ||
                     ($checked.length != $checked.filter('[value*=-4zz18-]').length));
+    $('[data-selection-action=remove-selected-files]', $container).
+        closest('li').
+        toggleClass('disabled',
+                    ($checked.length < 0) ||
+                    !(collection_lock_classes && collection_lock_classes.includes("fa-unlock") && ($checked.length>0)));
 }
 
 $(document).

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list