API Allow ignoring persistent tab state through entwine property.

In this case we don't want to rely on data attributes in the DOM, as
this should be an inbuilt property associated with this class.
This commit is contained in:
Mateusz Uzdowski 2012-12-11 11:30:06 +13:00 committed by Ingo Schommer
parent 5cef05ebea
commit 4d6d823cb1
3 changed files with 8 additions and 1 deletions

View File

@ -14,6 +14,8 @@
* * SiteTree ActionTabs
*/
$('.ss-tabset.ss-ui-action-tabset').entwine({
// Ignore tab state so it will not be reopened on form submission.
IgnoreTabState: true,
onadd: function() {
// Make sure the .ss-tabset is already initialised to apply our modifications on top.

View File

@ -576,7 +576,10 @@ jQuery.noConflict();
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
// Allow opt-out via data element or entwine property.
if($(el).data('ignoreTabState') || $(el).getIgnoreTabState()) return;
selectedTabs.push({id:id, selected:$(el).tabs('option', 'selected')});
});

View File

@ -4,6 +4,8 @@
* Lightweight wrapper around jQuery UI tabs for generic tab set-up
*/
$('.ss-tabset').entwine({
IgnoreTabState: false,
onadd: function() {
// Can't name redraw() as it clashes with other CMS entwine classes
this.redrawTabs();