Skip to content
This repository
Browse code

Disable tab state logic on uninit'ed tabs, allow opt-out

Fixes a problem when switching between ajax tabs,
e.g. "Content" and "Settings" in admin/pages/edit/show/<id>.
  • Loading branch information...
commit bf91594e4fe367e714bdc3b2ad0726427d0cfe84 1 parent c493dc7
Ingo Schommer authored July 13, 2012

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. 6  admin/javascript/LeftAndMain.js
6  admin/javascript/LeftAndMain.js
@@ -444,6 +444,8 @@ jQuery.noConflict();
444 444
 				this.find('.cms-tabset,.ss-tabset').each(function(i, el) {
445 445
 					var id = $(el).attr('id');
446 446
 					if(!id) return; // we need a unique reference
  447
+					if(!$(el).data('tabs')) return; // don't act on uninit'ed controls
  448
+					if($(el).data('ignoreTabState')) return; // allow opt-out
447 449
 					selectedTabs.push({id:id, selected:$(el).tabs('option', 'selected')});
448 450
 				});
449 451
 				if(selectedTabs) window.sessionStorage.setItem('tabs-' + url, JSON.stringify(selectedTabs));
@@ -461,7 +463,9 @@ jQuery.noConflict();
461 463
 					selectedTabs = data ? JSON.parse(data) : false;
462 464
 				if(selectedTabs) {
463 465
 					$.each(selectedTabs, function(i, selectedTab) {
464  
-						self.find('#' + selectedTab.id).tabs('select', selectedTab.selected);
  466
+						var el = self.find('#' + selectedTab.id);
  467
+						if(!el.data('tabs')) return; // don't act on uninit'ed controls
  468
+						el.tabs('select', selectedTab.selected);
465 469
 					});
466 470
 				}
467 471
 			},

0 notes on commit bf91594

Please sign in to comment.
Something went wrong with that request. Please try again.