Merge branch '3.0'

This commit is contained in:
Sean Harvey 2012-11-07 11:12:01 +13:00
commit f4a4465873
2 changed files with 14 additions and 14 deletions

View File

@ -368,7 +368,7 @@ jQuery.noConflict();
* Can be hooked into an ajax 'success' callback. * Can be hooked into an ajax 'success' callback.
*/ */
handleAjaxResponse: function(data, status, xhr) { handleAjaxResponse: function(data, status, xhr) {
var self = this, url, selectedTabs, guessFragment; var self = this, url, activeTabs, guessFragment;
// Pseudo-redirects via X-ControllerURL might return empty data, in which // Pseudo-redirects via X-ControllerURL might return empty data, in which
// case we'll ignore the response // case we'll ignore the response
@ -495,15 +495,15 @@ jQuery.noConflict();
saveTabState: function() { saveTabState: function() {
if(typeof(window.sessionStorage)=="undefined" || window.sessionStorage == null) return; if(typeof(window.sessionStorage)=="undefined" || window.sessionStorage == null) return;
var selectedTabs = [], url = this._tabStateUrl(); var activeTabs = [], url = this._tabStateUrl();
this.find('.cms-tabset,.ss-tabset').each(function(i, el) { this.find('.cms-tabset,.ss-tabset').each(function(i, el) {
var id = $(el).attr('id'); var id = $(el).attr('id');
if(!id) return; // we need a unique reference if(!id) return; // we need a unique reference
if(!$(el).data('tabs')) return; // don't act on uninit'ed controls if(!$(el).data('tabs')) return; // don't act on uninit'ed controls
if($(el).data('ignoreTabState')) return; // allow opt-out if($(el).data('ignoreTabState')) return; // allow opt-out
selectedTabs.push({id:id, selected:$(el).tabs('option', 'selected')}); activeTabs.push({id:id, active:$(el).tabs('option', 'active')});
}); });
if(selectedTabs) window.sessionStorage.setItem('tabs-' + url, JSON.stringify(selectedTabs)); if(activeTabs) window.sessionStorage.setItem('tabs-' + url, JSON.stringify(activeTabs));
}, },
/** /**
@ -515,12 +515,12 @@ jQuery.noConflict();
var self = this, url = this._tabStateUrl(), var self = this, url = this._tabStateUrl(),
data = window.sessionStorage.getItem('tabs-' + url), data = window.sessionStorage.getItem('tabs-' + url),
selectedTabs = data ? JSON.parse(data) : false; activeTabs = data ? JSON.parse(data) : false;
if(selectedTabs) { if(activeTabs) {
$.each(selectedTabs, function(i, selectedTab) { $.each(activeTabs, function(i, activeTab) {
var el = self.find('#' + selectedTab.id); var el = self.find('#' + activeTab.id);
if(!el.data('tabs')) return; // don't act on uninit'ed controls if(!el.data('tabs')) return; // don't act on uninit'ed controls
el.tabs('select', selectedTab.selected); el.tabs('option', 'active', activeTab.active);
}); });
} }
}, },
@ -924,10 +924,10 @@ jQuery.noConflict();
redrawTabs: function() { redrawTabs: function() {
this.rewriteHashlinks(); this.rewriteHashlinks();
var id = this.attr('id'), selectedTab = this.find('ul:first .ui-tabs-active'); var id = this.attr('id'), activeTab = this.find('ul:first .ui-tabs-active');
if(!this.data('tabs')) this.tabs({ if(!this.data('uiTabs')) this.tabs({
selected: (selectedTab.index() != -1) ? selectedTab.index() : 0, active: (activeTab.index() != -1) ? activeTab.index() : 0,
beforeLoad: function(e, settings) { beforeLoad: function(e, settings) {
// Overwrite ajax loading to use CMS logic instead // Overwrite ajax loading to use CMS logic instead
var makeAbs = $.path.makeUrlAbsolute, var makeAbs = $.path.makeUrlAbsolute,
@ -939,7 +939,7 @@ jQuery.noConflict();
return false; return false;
}, },
show: function(e, ui) { activate: function(e, ui) {
// Usability: Hide actions for "readonly" tabs (which don't contain any editable fields) // Usability: Hide actions for "readonly" tabs (which don't contain any editable fields)
var actions = $(this).closest('form').find('.Actions'); var actions = $(this).closest('form').find('.Actions');
if($(ui.tab).closest('li').hasClass('readonly')) { if($(ui.tab).closest('li').hasClass('readonly')) {

View File

@ -10,7 +10,7 @@
this._super(); this._super();
}, },
onremove: function() { onremove: function() {
if(this.data('tabs')) this.tabs('destroy'); if(this.data('uiTabs')) this.tabs('destroy');
this._super(); this._super();
}, },
redrawTabs: function() { redrawTabs: function() {