-<% content_for :js do %>
- function ajaxRefreshTabPane(pane) {
- $.ajax('<%= url_for @object %>?tab_pane='+pane, {dataType: 'html', type: 'GET'}).
- done(function(data, status, jqxhr) {
- $('#' + pane + ' > div > div').html(data);
- $(document).trigger('ajax:complete')
- });
- }
-
- $(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() {
- ajaxRefreshTabPane($('.tab-pane.active')[0].id);
- });
-<% end %>
-
<% content_for :tab_panes do %>
-<% comparable = controller.respond_to? :compare %>
-
-<ul class="nav nav-tabs">
- <% pane_list.each_with_index do |pane, i| %>
- <li class="<%= 'active' if i==0 %>"><a href="#<%= pane %>" data-toggle="tab" id="<%= pane %>-tab"> <%= pane.gsub('_', ' ') %></a></li>
- <% end %>
-</ul>
-<div class="tab-content">
-<% pane_list.each_with_index do |pane, i| %>
- <div id="<%= pane %>"
- class="tab-pane fade <%= 'in active' if i==0 %> arv-log-event-listener"
-<% if controller.action_name == "index" %>
- data-object-kind="arvados#<%= ArvadosApiClient.class_kind controller.model_class %>"
-<% else %>
- data-object-uuid="<%= @object.uuid %>"
-<% end %>
->
-
-<% content_for :js do %>
- <% if i != 0 %>
- $(document).on('ready', function() {
- ajaxRefreshTabPane('<%= pane %>');
- });
- <% end %>
-<% end %>
-
- <div class="smart-scroll" style="margin-top:0.5em;">
- <div class="pane-content">
- <% if i == 0 %>
- <%= render(partial: 'show_' + pane.downcase,
- locals: { comparable: comparable, objects: @objects }) %>
- <% else %>
- <%= image_tag 'ajax-loader.gif' %>
- <% end %>
+ <% comparable = controller.respond_to? :compare %>
+
+ <ul class="nav nav-tabs" data-tab-counts-url="<%= url_for(action: :tab_counts) rescue '' %>">
+ <% pane_list.each_with_index do |pane, i| %>
+ <% pane_name = (pane.is_a?(Hash) ? pane[:name] : pane) %>
+ <li class="<%= 'active' if i==0 %>">
+ <a href="#<%= pane_name %>"
+ class="pane-anchor"
+ id="<%= pane_name %>-tab"
+ data-toggle="tab"
+ data-tab-history=true
+ data-pane-content-url="<%= url_for(params.merge(tab_pane: pane_name)) %>">
+ <%= pane_name.gsub('_', ' ') %> <span id="<%= pane_name %>-count"></span>
+ </a>
+ </li>
+ <% end %>
+ </ul>
+
+ <div class="tab-content">
+ <% pane_list.each_with_index do |pane, i| %>
+ <% pane_name = (pane.is_a?(Hash) ? pane[:name] : pane) %>
+ <div id="<%= pane_name %>"
+ class="tab-pane fade <%= 'in active loaded' if i==0 %> arv-log-event-listener"
+ <% if controller.action_name == "index" %>
+ data-object-kind="arvados#<%= ArvadosApiClient.class_kind controller.model_class %>"
+ <% else %>
+ data-object-uuid="<%= @object.uuid %>"
+ <% end %>
+ >
+ <div id="<%= pane_name %>-scroll" style="margin-top:0.5em;">
+ <div class="pane-content">
+ <% if i == 0 %>
+ <%= render_pane pane_name, to_string: true %>
+ <% else %>
+ <div class="spinner spinner-32px spinner-h-center"></div>
+ <% end %>
+ </div>
+ </div>
</div>
- </div>
+ <% end %>
</div>
-<% end %>
-</div>
<% end %>