- <% session[:selected_move_or_copy_items] = params['move_or_copy_items'] if params['move_or_copy_items'] %>
+ <%
+ =begin
+
+ Parameters received from the caller/requestor of the modal are
+ attached to the action button (.btn-primary) as follows:
+
+ action_class -- string -- added as a pseudoclass to the action button.
+
+ action_href -- string -- will be available at $(btn).attr('data-action-href')
+
+ action_data -- json-encoded object -- will be at $(btn).data('action-data')
+
+ action_data_form_params -- array -- for each X in this array, the
+ value of params[X] during this "show chooser" request will be in
+ $(btn).data('action-data-from-params')[X].
+
-=end %>
++=end
++%>
++
$('body > .modal-container').html("<%= escape_javascript(render partial: 'choose.html', locals: {multiple: multiple}) %>");
$('body > .modal-container .modal').modal('show');
$('body > .modal-container .modal .modal-footer .btn-primary').
'data-selection-param-name' => 'uuids[]',
'data-selection-action' => 'compare'
%></li>
-- <li><%= link_to "Remove selected", '#',
-- 'data-href' => url_for(action: :remove_items),
-- 'data-selection-param-name' => 'item_uuids[]',
-- 'data-selection-action' => 'remove',
++ <li><%= link_to "Copy selected", '#',
++ 'data-href' => choose_projects_path(
++ title: 'Copy selected items to...',
++ editable: true,
++ action_name: 'Copy',
++ action_href: actions_path,
++ action_method: 'post',
++ action_data_from_params: ['selection'],
++ action_data: {
++ move_selections_into_project: true,
++ selection_param: 'uuid',
++ success: 'page-refresh'}.to_json),
'data-remote' => true,
-- 'method' => 'delete',
-- 'data-toggle' => 'dropdown'
++ 'data-selection-param-name' => 'selection[]',
++ 'data-selection-action' => 'copy'
%></li>
-- <li><%= link_to "Move selected", '#',
++ <li><%= link_to "Move selected", '#',
'data-href' => choose_projects_path(
title: 'Move selected items to...',
editable: true,
'data-selection-param-name' => 'selection[]',
'data-selection-action' => 'move'
%></li>
++ <li><%= link_to "Remove selected", '#',
++ 'data-href' => url_for(action: :remove_items),
++ 'data-selection-param-name' => 'item_uuids[]',
++ 'data-selection-action' => 'remove',
++ 'data-remote' => true,
++ 'method' => 'delete',
++ 'data-toggle' => 'dropdown'
++ %></li>
</ul>
</div>
</div>