[ARVADOS] created: 7e28b26cc58f9d5833ffac6760a99a6a037e4770

git at public.curoverse.com git at public.curoverse.com
Tue Apr 8 22:51:16 EDT 2014


        at  7e28b26cc58f9d5833ffac6760a99a6a037e4770 (commit)


commit 7e28b26cc58f9d5833ffac6760a99a6a037e4770
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Apr 8 22:51:36 2014 -0400

    Stash and restore current tab selections when replacing body content.

diff --git a/apps/workbench/app/views/pipeline_instances/show.js.erb b/apps/workbench/app/views/pipeline_instances/show.js.erb
index cfe288d..8d8292c 100644
--- a/apps/workbench/app/views/pipeline_instances/show.js.erb
+++ b/apps/workbench/app/views/pipeline_instances/show.js.erb
@@ -1,5 +1,16 @@
 <% 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.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');

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list