3637: remove unwanted tab chars
[arvados.git] / apps / workbench / app / assets / javascripts / selection.js
index 4ab0295c043b00ad4c30cd627d58f3774ecf06f9..c82b6ef2718a5f149ab9d5d6f92039d067cdfc63 100644 (file)
@@ -185,9 +185,12 @@ function dispatch_selection_action() {
     if ($(this).closest('.disabled').length > 0) {
        return false;
     }
-    $('.persistent-selection:checkbox:checked').each(function() {
-        data.push({name: param_name, value: $(this).val()});
-    });
+    $(this).
+        closest('.selection-action-container').
+        find(':checkbox:checked').
+        each(function() {
+            data.push({name: param_name, value: $(this).val()});
+        });
     if (href.indexOf('?') >= 0)
         href += '&';
     else
@@ -198,7 +201,8 @@ function dispatch_selection_action() {
 }
 
 function enable_disable_selection_actions() {
-    var $checked = $('.persistent-selection:checkbox:checked');
+    var $container = $(this).closest('.selection-action-container');
+    var $checked = $('.persistent-selection:checkbox:checked', $container);
     $('[data-selection-action]').
         closest('div.btn-group-sm').
         find('ul li').
@@ -212,11 +216,12 @@ function enable_disable_selection_actions() {
         closest('li').
         toggleClass('disabled',
                     ($checked.filter('[value*=-j7d0g-]').length > 0) ||
-                    (($checked.not('[value*=-d1hrv-]').length > 0) && ($checked.filter('[value*=-]').length < 0)));
+                    ($checked.length < 1));
 }
 
 $(document).
     on('selections-updated ready ajax:complete', function() {
-        $('[data-selection-action]').click(dispatch_selection_action);
-        enable_disable_selection_actions();
+        var $btn = $('[data-selection-action]');
+        $btn.click(dispatch_selection_action);
+        enable_disable_selection_actions.call($btn);
     });