X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bf43b9c625657fa745bbb237248f7d33ccb4cd2b..7e3496abb1b8c70607df37b6f096c8acd42d714d:/apps/workbench/app/assets/javascripts/selection.js diff --git a/apps/workbench/app/assets/javascripts/selection.js b/apps/workbench/app/assets/javascripts/selection.js index a313c8b78e..bcc33c46bc 100644 --- a/apps/workbench/app/assets/javascripts/selection.js +++ b/apps/workbench/app/assets/javascripts/selection.js @@ -57,14 +57,6 @@ jQuery(function($){ $("#persistent-selection-count").text(lst.length); if (lst.length > 0) { html = '
  • Clear selections
  • '; - if (this_object_uuid.match('-j7d0g-')) { - html += '
  • '; - html += '
  • '; - } - html += '
  • ' - + '
  • '; $('#selection-form-content').html(html); for (var i = 0; i < lst.length; i++) { @@ -189,9 +181,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 @@ -202,7 +197,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,10 +208,21 @@ function enable_disable_selection_actions() { toggleClass('disabled', ($checked.filter('[value*=-d1hrv-]').length < 2) || ($checked.not('[value*=-d1hrv-]').length > 0)); + $('[data-selection-action=copy]'). + closest('li'). + toggleClass('disabled', + ($checked.filter('[value*=-j7d0g-]').length > 0) || + ($checked.length < 1)); + $('[data-selection-action=combine-project-contents]'). + closest('li'). + toggleClass('disabled', + ($checked.filter('[value*=-4zz18-]').length < 1) || + ($checked.length != $checked.filter('[value*=-4zz18-]').length)); } $(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); });