diff --git a/server/documents/modules/tab.html.eco b/server/documents/modules/tab.html.eco
index ba109358a..c84b0104a 100755
--- a/server/documents/modules/tab.html.eco
+++ b/server/documents/modules/tab.html.eco
@@ -4,12 +4,12 @@ css : 'tab'
title : 'Tab'
description : 'A tab is a section of content tied to a navigation menu'
-type : 'Draft'
+type : 'UI Module'
---
-<%- @partial('header', { tabs: 'module' }) %>
+<%- @partial('header', { tabs: { examples: 'Examples', usage: 'Usage', settings: 'Settings' } }) %>
@@ -18,7 +18,6 @@ type : 'Draft'
@@ -29,7 +28,7 @@ type : 'Draft'
Tabs are usually used in concert with an element that activates the tab. Tabs are initialized on the activating item instead of the tab.
-
If there are no menus that activate tab elements on the page, tabs can be initialized globally by using $.tab()
+
If there are no menus that activate tab elements on the page, tabs can be initialized globally by using $.tab()
and activated programmatically using $.tab('change tab', path);
Tabs are connected to their activators with a metadata attribute data-tab
. This should be added to both the activating element and the tab itself.
diff --git a/src/definitions/modules/tab.js b/src/definitions/modules/tab.js
index 2be259189..9e7438d1b 100755
--- a/src/definitions/modules/tab.js
+++ b/src/definitions/modules/tab.js
@@ -18,6 +18,11 @@ $.tab = $.fn.tab = function(parameters) {
$allModules = $.isFunction(this)
? $(window)
: $(this),
+
+ settings = ( $.isPlainObject(parameters) )
+ ? $.extend(true, {}, $.fn.tab.settings, parameters)
+ : $.extend({}, $.fn.tab.settings),
+
moduleSelector = $allModules.selector || '',
time = new Date().getTime(),
performance = [],
@@ -25,6 +30,8 @@ $.tab = $.fn.tab = function(parameters) {
query = arguments[0],
methodInvoked = (typeof query == 'string'),
queryArguments = [].slice.call(arguments, 1),
+
+ module,
returnedValue
;
@@ -32,9 +39,6 @@ $.tab = $.fn.tab = function(parameters) {
$allModules
.each(function() {
var
- settings = ( $.isPlainObject(parameters) )
- ? $.extend(true, {}, $.fn.tab.settings, parameters)
- : $.extend({}, $.fn.tab.settings),
className = settings.className,
metadata = settings.metadata,
@@ -57,8 +61,7 @@ $.tab = $.fn.tab = function(parameters) {
historyEvent,
element = this,
- instance = $module.data(moduleNamespace),
- module
+ instance = $module.data(moduleNamespace)
;
module = {
@@ -86,8 +89,6 @@ $.tab = $.fn.tab = function(parameters) {
.on('click' + eventNamespace, module.event.click)
;
}
-
- module.initializeHistory();
module.instantiate();
},
@@ -142,7 +143,6 @@ $.tab = $.fn.tab = function(parameters) {
}
}
$.address
- .unbind('change')
.bind('change', module.event.history.change)
;
}
@@ -306,7 +306,9 @@ $.tab = $.fn.tab = function(parameters) {
}
}
else {
- module.error(error.missingTab, tab);
+ if(!settings.history) {
+ module.error(error.missingTab, $module, currentPath);
+ }
return false;
}
});
@@ -320,7 +322,7 @@ $.tab = $.fn.tab = function(parameters) {
apiSettings = {
dataType : 'html',
stateContext : $tab,
- success : function(response) {
+ onSuccess : function(response) {
module.cache.add(fullTabPath, response);
module.content.update(tabPath, response);
if(tabPath == activeTabPath) {
@@ -687,6 +689,9 @@ $.tab = $.fn.tab = function(parameters) {
}
})
;
+ if(!methodInvoked) {
+ module.initializeHistory();
+ }
return (returnedValue !== undefined)
? returnedValue
: this
@@ -745,7 +750,7 @@ $.fn.tab.settings = {
error: {
api : 'You attempted to load content without API module',
method : 'The method you called is not defined',
- missingTab : 'Tab cannot be found',
+ missingTab : 'Activated tab cannot be found for this context.',
noContent : 'The tab you specified is missing a content url.',
path : 'History enabled, but no path was specified',
recursion : 'Max recursive depth reached',