8784: Fix test for latest firefox.
[arvados.git] / apps / workbench / app / views / application / _choose.js.erb
1 <%
2 =begin
3
4 Parameters received from the caller/requestor of the modal are
5 attached to the action button (.btn-primary) as follows:
6
7 action_class -- string -- added as a pseudoclass to the action button.
8
9 action_href -- string -- will be available at $(btn).attr('data-action-href')
10
11 action_data -- json-encoded object -- will be at $(btn).data('action-data')
12
13 action_data_form_params -- array -- for each X in this array, the
14 value of params[X] during this "show chooser" request will be in
15 $(btn).data('action-data-from-params')[X].
16
17 =end
18 %>
19
20 $('body > .modal-container').html("<%= escape_javascript(render partial: 'choose.html', locals: {multiple: multiple}) %>");
21 $('body > .modal-container .modal').modal('show');
22 $('body > .modal-container .modal .modal-footer .btn-primary').
23     addClass('<%= j params[:action_class] %>').
24     attr('data-action-href', '<%= j params[:action_href] %>').
25     attr('data-method', '<%= j params[:action_method] %>').
26     data('action-data', <%= raw params[:action_data] %>).
27     data('action-data-from-params', <%= raw params.select { |k,v| k.in?(params[:action_data_from_params] || []) }.to_json %>);