2884: Can now choose a specific folder to browse in the file selector modal.
[arvados.git] / apps / workbench / app / views / application / _choose.js.erb
index 3bb369451add5674495a5747540aa72ef7f53f12..14de170ff315b5970b1c2388c4b240aab177033d 100644 (file)
@@ -5,4 +5,24 @@ $('body > .modal-container .modal .modal-footer .btn-primary').
     attr('data-action-href', '<%= j params[:action_href] %>').
     attr('data-method', '<%= j params[:action_method] %>').
     data('action-data', <%= raw params[:action_data] %>);
-$(document).trigger('ajax:complete');
+$(".chooser-show-project").on("click", function() {
+  $("#choose-scroll").html("<%=j image_tag 'ajax-loader.gif' %>");
+  var t = $(this);
+  var d = {
+      partial: true,
+      multiple: <%= multiple %>
+    };
+  if (t.attr("data-project-uuid") != null) {
+    d.project_uuid = t.attr("data-project-uuid");
+  }
+  $.ajax('<%=j url_for %>', {
+    dataType: "json",
+    type: "GET",
+    data: d
+  }).done(function(data, status, jqxhr) {
+    console.log(data);
+    $("#chooser-breadcrumb").text(t.text());
+    $("#choose-scroll").html(data.content);
+    $("#choose-scroll").prop("data-infinite-content-href", "next_page_href");
+  });
+});