From 2a53488bb886400dd5f4e7c6c331f24fe902ec33 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 21 Nov 2009 02:30:21 +0000 Subject: [PATCH] ENHANCEMENT Storing last selected tab in a cookie for TabSet.js. Requires jquery.cookie plugin. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92508 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/TabSet.php | 1 + javascript/TabSet.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/forms/TabSet.php b/forms/TabSet.php index 3f7b8beaa..6ae705cc0 100644 --- a/forms/TabSet.php +++ b/forms/TabSet.php @@ -54,6 +54,7 @@ class TabSet extends CompositeField { Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/jquery-ui.js'); Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/ui.core.js'); Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/ui.tabs.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-cookie/jquery.cookie.js'); Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/ui.all.css'); Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/ui.tabs.css'); diff --git a/javascript/TabSet.js b/javascript/TabSet.js index 538ff2f5c..d85ecd5b6 100644 --- a/javascript/TabSet.js +++ b/javascript/TabSet.js @@ -11,7 +11,9 @@ this.rewriteHashlinks(); // Initialize jQuery UI tabs - this.tabs(); + this.tabs({ + cookie: $.cookie ? { expires: 30, path: '/' } : false + }); }, /**