Merge branch 'master' into 2767-doc-updates
[arvados.git] / apps / workbench / app / views / pipeline_instances / show.js.erb
index 9460f0bc9d8ec5e2fdb2c87eaf2d7d854156a9d8..8d8292cb7436e29cb1cfad658541fb2389dd9c0b 100644 (file)
@@ -1,3 +1,16 @@
-var new_content = "<%= escape_javascript(render template: 'pipeline_instances/show.html') %>";
-if ($('div.body-content').html() != new_content)
-   $('div.body-content').html(new_content);
+<% self.formats = [:html] %>
+var new_content = "<%= escape_javascript(render template: 'pipeline_instances/show') %>";
+var selected_tab_hrefs = [];
+if ($('div.body-content').html() != new_content) {
+    $('.nav-tabs li.active a').each(function() {
+        selected_tab_hrefs.push($(this).attr('href'));
+    });
+
+    $('div.body-content').html(new_content);
+
+    // Show the same tabs that were active before we rewrote body-content
+    $.each(selected_tab_hrefs, function(i, href) {
+        $('.nav-tabs li a[href="' + href + '"]').tab('show');
+    });
+}
+$(document).trigger('ajax:complete');