projects
/
arvados.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e4b0ff6
)
Stash and restore current tab selections when replacing body content.
author
Tom Clegg <tom@curoverse.com>
Wed, 9 Apr 2014 02:51:36 +0000
(22:51 -0400)
committer
Tom Clegg <tom@curoverse.com>
Wed, 9 Apr 2014 02:51:36 +0000
(22:51 -0400)
apps/workbench/app/views/pipeline_instances/show.js.erb
patch
|
blob
|
history
diff --git
a/apps/workbench/app/views/pipeline_instances/show.js.erb
b/apps/workbench/app/views/pipeline_instances/show.js.erb
index cfe288d0e322785294fce8bbcaaf8c4f144e268e..8d8292cb7436e29cb1cfad658541fb2389dd9c0b 100644
(file)
--- 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') %>";
<% 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');
$(document).trigger('ajax:complete');