Browse Source

#3475 - Adds deactivate setting for tab used to determine what elements user would like to deactivate when a tab is selected

pull/3704/head
Jack Lukic 8 years ago
parent
commit
1b982e1842
2 changed files with 34 additions and 20 deletions
  1. 1
      RELEASE-NOTES.md
  2. 53
      src/definitions/modules/tab.js

1
RELEASE-NOTES.md

@ -18,6 +18,7 @@
**Enhancements**
- **Build Tools** - Added new `autoInstall` option to allow for Semantic to be installed without user interaction. See [docs explanation](http://www.semantic-ui.com/introduction/advanced-usage.html#Auto-Install) for how to use. #3616 **Thanks @algorithme**
-**Site** `@px` and `@relativepx` i.e. `@relative12px` which can be used to return EM value of pixels are now extended to `@relative40px`
-**Tabs** - Added option `deactivate`, defaults to `siblings` which will only deactivate tab activators that are DOM siblings elements to the activating element. Setting it <code>false</code> will deactivate any other tab element initialized at the same time.
-**Table** - Added more granular variablaes for controlling style on first column in a `definition table`
**Docs**

53
src/definitions/modules/tab.js

@ -263,6 +263,9 @@ $.fn.tab = function(parameters) {
},
set: {
activeTab($tab) {
},
auto: function() {
var
url = (typeof settings.path == 'string')
@ -508,15 +511,19 @@ $.fn.tab = function(parameters) {
},
tab: function(tabPath) {
var
$tab = module.get.tabElement(tabPath),
isActive = $tab.hasClass(className.active)
$tab = module.get.tabElement(tabPath),
$deactiveTabs = (settings.deactivate == 'siblings')
? $tab.siblings($tabs)
: $tabs.not($tab),
isActive = $tab.hasClass(className.active)
;
module.verbose('Showing tab content for', $tab);
if(!isActive) {
$tab
.addClass(className.active)
.siblings($tabs)
.removeClass(className.active + ' ' + className.loading)
;
$deactiveTabs
.removeClass(className.active + ' ' + className.loading)
;
if($tab.length > 0) {
settings.onVisible.call($tab[0], tabPath);
@ -525,15 +532,19 @@ $.fn.tab = function(parameters) {
},
navigation: function(tabPath) {
var
$navigation = module.get.navElement(tabPath),
$navigation = module.get.navElement(tabPath),
$deactiveNavigation = (settings.deactivate == 'siblings')
? $navigation.siblings($allModules)
: $allModules.not($navigation),
isActive = $navigation.hasClass(className.active)
;
module.verbose('Activating tab navigation for', $navigation, tabPath);
if(!isActive) {
$navigation
.addClass(className.active)
.siblings($allModules)
.removeClass(className.active + ' ' + className.loading)
;
$deactiveNavigation
.removeClass(className.active + ' ' + className.loading)
;
}
}
@ -840,28 +851,30 @@ $.fn.tab.settings = {
verbose : false,
performance : true,
auto : false, // uses pjax style endpoints fetching content from same url with remote-content headers
history : false, // use browser history
historyType : 'hash', // #/ or html5 state
path : false, // base path of url
auto : false, // uses pjax style endpoints fetching content from same url with remote-content headers
history : false, // use browser history
historyType : 'hash', // #/ or html5 state
path : false, // base path of url
context : false, // specify a context that tabs must appear inside
childrenOnly : false, // use only tabs that are children of context
maxDepth : 25, // max depth a tab can be nested
context : false, // specify a context that tabs must appear inside
childrenOnly : false, // use only tabs that are children of context
maxDepth : 25, // max depth a tab can be nested
deactivate : 'siblings', // whether tabs should deactivate sibling menu elements or all elements initialized together
alwaysRefresh : false, // load tab content new every tab click
cache : true, // cache the content requests to pull locally
ignoreFirstLoad : false, // don't load remote content on first load
alwaysRefresh : false, // load tab content new every tab click
cache : true, // cache the content requests to pull locally
ignoreFirstLoad : false, // don't load remote content on first load
apiSettings : false, // settings for api call
evaluateScripts : 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content
apiSettings : false, // settings for api call
evaluateScripts : 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content
onFirstLoad : function(tabPath, parameterArray, historyEvent) {}, // called first time loaded
onLoad : function(tabPath, parameterArray, historyEvent) {}, // called on every load
onVisible : function(tabPath, parameterArray, historyEvent) {}, // called every time tab visible
onRequest : function(tabPath, parameterArray, historyEvent) {}, // called ever time a tab beings loading remote content
templates : {
templates : {
determineTitle: function(tabArray) {} // returns page title for path
},

Loading…
Cancel
Save