Merge branch 'master' into 3140-project-content-tabs
[arvados.git] / apps / workbench / app / views / application / _choose.js.erb
1 $('body > .modal-container').html("<%= escape_javascript(render partial: 'choose.html', locals: {multiple: multiple}) %>");
2 $('body > .modal-container .modal').modal('show');
3 $('body > .modal-container .modal .modal-footer .btn-primary').
4     addClass('<%= j params[:action_class] %>').
5     attr('data-action-href', '<%= j params[:action_href] %>').
6     attr('data-method', '<%= j params[:action_method] %>').
7     data('action-data', <%= raw params[:action_data] %>);
8 $(".chooser-show-project").on("click", function() {
9   $("#choose-scroll").html("<div class=\"spinner spinner-32px spinner-h-center\"></div>");
10   $(".modal-dialog-preview-pane").html('');
11   var t = $(this);
12   var d = {
13       partial: true,
14       multiple: <%= multiple || "false" %>
15     };
16   if (t.attr("data-project-uuid") != null) {
17     d.project_uuid = t.attr("data-project-uuid");
18   }
19   $.ajax('<%=j url_for %>', {
20     dataType: "json",
21     type: "GET",
22     data: d
23   }).done(function(data, status, jqxhr) {
24     $("#chooser-breadcrumb").text(t.text());
25     $("#choose-scroll").html(data.content);
26     $("#choose-scroll").prop("data-infinite-content-href", "next_page_href");
27   });
28 });