mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '3.0'
This commit is contained in:
commit
f4a4465873
@ -368,7 +368,7 @@ jQuery.noConflict();
|
||||
* Can be hooked into an ajax 'success' callback.
|
||||
*/
|
||||
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
|
||||
// case we'll ignore the response
|
||||
@ -495,15 +495,15 @@ jQuery.noConflict();
|
||||
saveTabState: function() {
|
||||
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) {
|
||||
var id = $(el).attr('id');
|
||||
if(!id) return; // we need a unique reference
|
||||
if(!$(el).data('tabs')) return; // don't act on uninit'ed controls
|
||||
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(),
|
||||
data = window.sessionStorage.getItem('tabs-' + url),
|
||||
selectedTabs = data ? JSON.parse(data) : false;
|
||||
if(selectedTabs) {
|
||||
$.each(selectedTabs, function(i, selectedTab) {
|
||||
var el = self.find('#' + selectedTab.id);
|
||||
activeTabs = data ? JSON.parse(data) : false;
|
||||
if(activeTabs) {
|
||||
$.each(activeTabs, function(i, activeTab) {
|
||||
var el = self.find('#' + activeTab.id);
|
||||
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() {
|
||||
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({
|
||||
selected: (selectedTab.index() != -1) ? selectedTab.index() : 0,
|
||||
if(!this.data('uiTabs')) this.tabs({
|
||||
active: (activeTab.index() != -1) ? activeTab.index() : 0,
|
||||
beforeLoad: function(e, settings) {
|
||||
// Overwrite ajax loading to use CMS logic instead
|
||||
var makeAbs = $.path.makeUrlAbsolute,
|
||||
@ -939,7 +939,7 @@ jQuery.noConflict();
|
||||
|
||||
return false;
|
||||
},
|
||||
show: function(e, ui) {
|
||||
activate: function(e, ui) {
|
||||
// Usability: Hide actions for "readonly" tabs (which don't contain any editable fields)
|
||||
var actions = $(this).closest('form').find('.Actions');
|
||||
if($(ui.tab).closest('li').hasClass('readonly')) {
|
||||
|
@ -10,7 +10,7 @@
|
||||
this._super();
|
||||
},
|
||||
onremove: function() {
|
||||
if(this.data('tabs')) this.tabs('destroy');
|
||||
if(this.data('uiTabs')) this.tabs('destroy');
|
||||
this._super();
|
||||
},
|
||||
redrawTabs: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user