From: radhika Date: Wed, 5 Nov 2014 18:57:14 +0000 (-0500) Subject: 3177: look for checked persistent selections on submit. X-Git-Tag: 1.1.0~1998^2~21 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/87567c9440a65a42fdde62e513b40dc5a8585fdf?hp=d5cf000ee76060ce5e96bb4032f54e7f6b19116e 3177: look for checked persistent selections on submit. --- diff --git a/apps/workbench/app/assets/javascripts/select_modal.js b/apps/workbench/app/assets/javascripts/select_modal.js index ba106d1110..596cb70229 100644 --- a/apps/workbench/app/assets/javascripts/select_modal.js +++ b/apps/workbench/app/assets/javascripts/select_modal.js @@ -40,10 +40,20 @@ $(document).on('click', '.selectable', function() { var action_data_from_params = $(this).data('action-data-from-params'); var selection_param = action_data.selection_param; $modal.find('.modal-error').removeClass('hide').hide(); - $modal.find('.selectable.active[data-object-uuid]').each(function() { + + $checked_selections = $modal.find('.persistent-selection:checked'); + if ($checked_selections) { + $checked_selections.each(function() { + data.push({name: selection_param, value: $(this).attr('value')}); + }); + } + + if (data.length == 0) { // no checked persistent selection + $modal.find('.selectable.active[data-object-uuid]').each(function() { var val = $(this).attr('data-object-uuid'); data.push({name: selection_param, value: val}); - }); + }); + } $.each($.extend({}, action_data, action_data_from_params), function(key, value) { if (value instanceof Array && key[-1] != ']') { diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb index cfe7f19187..165f0628a7 100644 --- a/apps/workbench/app/helpers/application_helper.rb +++ b/apps/workbench/app/helpers/application_helper.rb @@ -261,7 +261,7 @@ module ApplicationHelper dn += '[value]' end - if dataclass == Collection + if (dataclass == Collection) or (dataclass == File) selection_param = object.class.to_s.underscore + dn display_value = attrvalue if value_info.is_a?(Hash) @@ -274,9 +274,9 @@ module ApplicationHelper end end if (attr == :components) and (subattr.size > 2) - chooser_title = "Choose a dataset for #{object.component_input_title(subattr[0], subattr[2])}:" + chooser_title = "Choose a #{dataclass == Collection ? 'dataset' : 'file'} for #{object.component_input_title(subattr[0], subattr[2])}:" else - chooser_title = "Choose a dataset:" + chooser_title = "Choose a #{dataclass == Collection ? 'dataset' : 'file'}:" end modal_path = choose_collections_path \ ({ title: chooser_title, diff --git a/apps/workbench/app/views/collections/_show_files.html.erb b/apps/workbench/app/views/collections/_show_files.html.erb index 9cd77b02e1..adbf48071a 100644 --- a/apps/workbench/app/views/collections/_show_files.html.erb +++ b/apps/workbench/app/views/collections/_show_files.html.erb @@ -86,7 +86,7 @@
- <% if !defined? no_checkboxes or !no_checkboxes %> + <%# if !defined? no_checkboxes or !no_checkboxes %> <%= check_box_tag 'uuids[]', "#{@object.uuid}/#{file_path}", false, { :class => 'persistent-selection', :friendly_type => "File", @@ -96,7 +96,7 @@ :title => "Include #{file_path} in your selections", } %>   - <% end %> + <%# end %> <% if CollectionsHelper::is_image(filename) %> <%= filename %>