2884: Can now choose a specific folder to browse in the file selector modal.
[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("<%=j image_tag 'ajax-loader.gif' %>");
10   var t = $(this);
11   var d = {
12       partial: true,
13       multiple: <%= multiple %>
14     };
15   if (t.attr("data-project-uuid") != null) {
16     d.project_uuid = t.attr("data-project-uuid");
17   }
18   $.ajax('<%=j url_for %>', {
19     dataType: "json",
20     type: "GET",
21     data: d
22   }).done(function(data, status, jqxhr) {
23     console.log(data);
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 });