MINOR Formatting in TabSet.js

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92554 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 02:32:38 +00:00
parent f418cdd55e
commit 1afe18a268

View File

@ -6,27 +6,29 @@
* their height explicitly set. This is important * their height explicitly set. This is important
* for forms inside the CMS layout. * for forms inside the CMS layout.
*/ */
$('.ss-tabset').concrete({ $('.ss-tabset').concrete('ss', function($){
onmatch: function() { return {
this.rewriteHashlinks(); onmatch: function() {
this.rewriteHashlinks();
// Initialize jQuery UI tabs // Initialize jQuery UI tabs
this.tabs({ this.tabs({
cookie: $.cookie ? { expires: 30, path: '/', name: 'ui-tabs-' + this.attr('id') } : false cookie: $.cookie ? { expires: 30, path: '/', name: 'ui-tabs-' + this.attr('id') } : false
}); });
}, },
/** /**
* Replace prefixes for all hashlinks in tabs. * Replace prefixes for all hashlinks in tabs.
* SSViewer rewrites them from "#Root_MyTab" to * SSViewer rewrites them from "#Root_MyTab" to
* e.g. "/admin/#Root_MyTab" which makes them * e.g. "/admin/#Root_MyTab" which makes them
* unusable for jQuery UI. * unusable for jQuery UI.
*/ */
rewriteHashlinks: function() { rewriteHashlinks: function() {
$(this).find('ul a').each(function() { $(this).find('ul a').each(function() {
var href = $(this).attr('href').replace(/.*(#.*)/, '$1'); var href = $(this).attr('href').replace(/.*(#.*)/, '$1');
if(href) $(this).attr('href', href); if(href) $(this).attr('href', href);
}); });
} }
};
}); });
})(jQuery); })(jQuery);