Merge branch 'master' into 3637-copy-selections
authorradhika <radhika@curoverse.com>
Tue, 2 Sep 2014 18:43:15 +0000 (14:43 -0400)
committerradhika <radhika@curoverse.com>
Tue, 2 Sep 2014 18:43:15 +0000 (14:43 -0400)
Conflicts:
apps/workbench/app/views/application/_choose.js.erb
apps/workbench/config/routes.rb

1  2 
apps/workbench/app/assets/javascripts/selection.js
apps/workbench/app/views/application/_choose.js.erb
apps/workbench/app/views/projects/_show_tab_contents.html.erb

index b91a6193204c26e0b903079fac8a9c39c614013d,d85e566f1452121e0cebdec58e3a4ec4631dc050..17223349521c055d80576ede6edac40a614f353b
@@@ -1,4 -1,20 +1,22 @@@
- <% 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').
index 40433ba61b3f3289811d5d2961f2754492d649a7,40433ba61b3f3289811d5d2961f2754492d649a7..ffa380c26d5e747acd00f6798bd4398f9c9d138d
@@@ -9,15 -9,15 +9,23 @@@
                    '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>