10078: Now that the recent_collections panel includes collections from Home directory...
[arvados.git] / apps / workbench / app / views / pipeline_instances / show.js.erb
index fc11e644249468e391a9762154882cb36aafe4a2..8ab1e8f68fdb5fa87150ded440436c947fd1f41e 100644 (file)
@@ -1,4 +1,15 @@
 <% self.formats = [:html] %>
 var new_content = "<%= escape_javascript(render template: 'pipeline_instances/show') %>";
-if ($('div.body-content').html() != new_content)
-   $('div.body-content').html(new_content);
+var selected_tab_hrefs = [];
+if ($('div#page-wrapper').html() != new_content) {
+    $('.nav-tabs li.active a').each(function() {
+        selected_tab_hrefs.push($(this).attr('href'));
+    });
+
+    $('div#page-wrapper').html(new_content);
+
+    // Show the same tabs that were active before we rewrote page-wrapper
+    $.each(selected_tab_hrefs, function(i, href) {
+        $('.nav-tabs li a[href="' + href + '"]').tab('show');
+    });
+}