X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a2107d5fc7982769c2d667e51656a6e2529d9bc9..a959f21c8147f26362df392bc3fd3290db69de85:/apps/workbench/app/views/application/_content.html.erb diff --git a/apps/workbench/app/views/application/_content.html.erb b/apps/workbench/app/views/application/_content.html.erb index 53444a5c9c..b7f27df3d7 100644 --- a/apps/workbench/app/views/application/_content.html.erb +++ b/apps/workbench/app/views/application/_content.html.erb @@ -1,30 +1,98 @@ +<% content_for :content_top do %> + <% if @object and not @object.is_a?(Group) and @object.class.goes_in_projects? and @object.owner_uuid == current_user.uuid %> +
+
+ + Hey. This <%= @object.class_for_display.downcase %> belongs to your account, but it's not in any of your projects. If you want it to be easy to find in the future, you should move it to a project.
+ <%= button_to(choose_projects_path( + title: 'Move to...', + editable: true, + action_name: 'Move', + action_href: url_for(action: :update), + action_method: 'patch', + action_data: {selection_param: @object.resource_param_name+'[owner_uuid]', success: 'page-refresh'}.to_json), + { class: "btn btn-primary btn-sm", remote: true, method: 'get' }) do %> + Choose a project... + <% end %> +
+
+ <% end %> +<% end %> + +<% content_for :js do %> + tab_pane_valid_state = {}; + + function ajaxRefreshTabPane(pane) { + if (!tab_pane_valid_state[pane]) { + tab_pane_valid_state[pane] = true; + $(document).trigger('ajax:send'); + $.ajax('<%=j url_for @object %>?tab_pane='+pane, {dataType: 'html', type: 'GET'}). + done(function(data, status, jqxhr) { + $('#' + pane + ' > div > div').html(data); + $(document).trigger('ajax:complete'); + ajaxRefreshTabPane(pane); + }); + } + } + + $(window).on('load', smart_scroll_fixup); + $(document).on('shown.bs.tab', 'ul.nav-tabs > li > a', smart_scroll_fixup); + + $(document).on('shown.bs.tab', function(e) { + ajaxRefreshTabPane(e.target.id.slice(0, -4)); + }); + + $(document).on('arv-log-event', function() { + <% pane_list.each do |pane| %> + tab_pane_valid_state['<%=j pane %>'] = false; + <% end %> + ajaxRefreshTabPane($('.tab-pane.active')[0].id); + }); +<% end %> + <% content_for :tab_panes do %> <% comparable = controller.respond_to? :compare %> -<% pane_list ||= %w(recent) %> -<% panes = Hash[pane_list.map { |pane| - [pane, render(partial: 'show_' + pane.downcase, - locals: { comparable: comparable })] - }.compact] %>
-<% panes.each_with_index do |(pane, content), i| %> -
-
- <%= content %> +<% pane_list.each_with_index do |pane, i| %> +
+ data-object-kind="arvados#<%= ArvadosApiClient.class_kind controller.model_class %>" +<% else %> + data-object-uuid="<%= @object.uuid %>" +<% end %> +> + +<% content_for :js do %> + <% if i == 0 %> + tab_pane_valid_state['<%=j pane %>'] = true; + <% else %> + tab_pane_valid_state['<%=j pane %>'] = false; + $(document).on('ready', function() { + ajaxRefreshTabPane('<%=j pane %>'); + }); + <% end %> +<% end %> + +
+
+ <% if i == 0 %> + <%= render(partial: 'show_' + pane.downcase, + locals: { comparable: comparable, objects: @objects }) %> + <% else %> + <%= image_tag 'ajax-loader.gif' %> + <% end %> +
<% end %>
<% end %> - -<% content_for :js do %> - $(window).on('load', smart_scroll_fixup); - $(document).on('shown.bs.tab', 'ul.nav-tabs > li > a', smart_scroll_fixup); -<% end %>