diff --git a/RELEASE NOTES.md b/RELEASE NOTES.md
index 2a96f2ac0..7e346b60a 100755
--- a/RELEASE NOTES.md
+++ b/RELEASE NOTES.md
@@ -1,6 +1,6 @@
## RELEASE NOTES
-### Version 0.2.5- Sep 28, 2013
+### Version 0.2.5- Sep 30, 2013
**Fixes**
- Fixes checkbox selector issue with multiple inputs inside a checkbox
diff --git a/build/less/modules/tab.js b/build/less/modules/tab.js
index 65eea80ca..1cd832a0e 100644
--- a/build/less/modules/tab.js
+++ b/build/less/modules/tab.js
@@ -80,6 +80,7 @@
}
// attach events if navigation wasn't set to window
if( !$.isWindow( element ) ) {
+ module.debug('Attaching events to tab activator', $module);
$module
.on('click' + eventNamespace, module.event.click)
;
@@ -172,9 +173,9 @@
// only get default path if not remote content
pathArray = (remoteContent && !shouldIgnoreLoad)
? module.utilities.pathToArray(tabPath)
- : module.get.defaultPathArray(tabPath),
- tabPath = module.utilities.arrayToPath(pathArray)
+ : module.get.defaultPathArray(tabPath)
;
+ tabPath = module.utilities.arrayToPath(pathArray);
module.deactivate.all();
$.each(pathArray, function(index, tab) {
var
@@ -241,8 +242,6 @@
fetch: function(tabPath, fullTabPath) {
var
$tab = module.get.tabElement(tabPath),
- fullTabPath = fullTabPath || tabPath,
- cachedContent = module.cache.read(fullTabPath),
apiSettings = {
dataType : 'html',
stateContext : $tab,
@@ -262,8 +261,13 @@
urlData: { tab: fullTabPath }
},
request = $tab.data(metadata.promise) || false,
- existingRequest = ( request && request.state() === 'pending' )
+ existingRequest = ( request && request.state() === 'pending' ),
+ cachedContent
;
+
+ fullTabPath = fullTabPath || tabPath;
+ cachedContent = module.cache.read(fullTabPath);
+
if(settings.cache && cachedContent) {
module.debug('Showing existing content', fullTabPath);
module.content.update(tabPath, cachedContent);
@@ -630,7 +634,6 @@
// uses pjax style endpoints fetching content from same url with remote-content headers
auto : false,
-
history : false,
path : false,
@@ -649,12 +652,12 @@
error: {
api : 'You attempted to load content without API module',
- noContent : 'The tab you specified is missing a content url.',
method : 'The method you called is not defined',
- state : 'The state library has not been initialized',
missingTab : 'Tab cannot be found',
+ noContent : 'The tab you specified is missing a content url.',
path : 'History enabled, but no path was specified',
- recursion : 'Max recursive depth reached'
+ recursion : 'Max recursive depth reached',
+ state : 'The state library has not been initialized'
},
metadata : {
@@ -669,7 +672,7 @@
},
selector : {
- tabs : '.tab'
+ tabs : '.ui.tab'
}
};
diff --git a/build/minified/modules/tab.js b/build/minified/modules/tab.js
index 65eea80ca..1cd832a0e 100644
--- a/build/minified/modules/tab.js
+++ b/build/minified/modules/tab.js
@@ -80,6 +80,7 @@
}
// attach events if navigation wasn't set to window
if( !$.isWindow( element ) ) {
+ module.debug('Attaching events to tab activator', $module);
$module
.on('click' + eventNamespace, module.event.click)
;
@@ -172,9 +173,9 @@
// only get default path if not remote content
pathArray = (remoteContent && !shouldIgnoreLoad)
? module.utilities.pathToArray(tabPath)
- : module.get.defaultPathArray(tabPath),
- tabPath = module.utilities.arrayToPath(pathArray)
+ : module.get.defaultPathArray(tabPath)
;
+ tabPath = module.utilities.arrayToPath(pathArray);
module.deactivate.all();
$.each(pathArray, function(index, tab) {
var
@@ -241,8 +242,6 @@
fetch: function(tabPath, fullTabPath) {
var
$tab = module.get.tabElement(tabPath),
- fullTabPath = fullTabPath || tabPath,
- cachedContent = module.cache.read(fullTabPath),
apiSettings = {
dataType : 'html',
stateContext : $tab,
@@ -262,8 +261,13 @@
urlData: { tab: fullTabPath }
},
request = $tab.data(metadata.promise) || false,
- existingRequest = ( request && request.state() === 'pending' )
+ existingRequest = ( request && request.state() === 'pending' ),
+ cachedContent
;
+
+ fullTabPath = fullTabPath || tabPath;
+ cachedContent = module.cache.read(fullTabPath);
+
if(settings.cache && cachedContent) {
module.debug('Showing existing content', fullTabPath);
module.content.update(tabPath, cachedContent);
@@ -630,7 +634,6 @@
// uses pjax style endpoints fetching content from same url with remote-content headers
auto : false,
-
history : false,
path : false,
@@ -649,12 +652,12 @@
error: {
api : 'You attempted to load content without API module',
- noContent : 'The tab you specified is missing a content url.',
method : 'The method you called is not defined',
- state : 'The state library has not been initialized',
missingTab : 'Tab cannot be found',
+ noContent : 'The tab you specified is missing a content url.',
path : 'History enabled, but no path was specified',
- recursion : 'Max recursive depth reached'
+ recursion : 'Max recursive depth reached',
+ state : 'The state library has not been initialized'
},
metadata : {
@@ -669,7 +672,7 @@
},
selector : {
- tabs : '.tab'
+ tabs : '.ui.tab'
}
};
diff --git a/build/uncompressed/modules/tab.js b/build/uncompressed/modules/tab.js
index 65eea80ca..1cd832a0e 100644
--- a/build/uncompressed/modules/tab.js
+++ b/build/uncompressed/modules/tab.js
@@ -80,6 +80,7 @@
}
// attach events if navigation wasn't set to window
if( !$.isWindow( element ) ) {
+ module.debug('Attaching events to tab activator', $module);
$module
.on('click' + eventNamespace, module.event.click)
;
@@ -172,9 +173,9 @@
// only get default path if not remote content
pathArray = (remoteContent && !shouldIgnoreLoad)
? module.utilities.pathToArray(tabPath)
- : module.get.defaultPathArray(tabPath),
- tabPath = module.utilities.arrayToPath(pathArray)
+ : module.get.defaultPathArray(tabPath)
;
+ tabPath = module.utilities.arrayToPath(pathArray);
module.deactivate.all();
$.each(pathArray, function(index, tab) {
var
@@ -241,8 +242,6 @@
fetch: function(tabPath, fullTabPath) {
var
$tab = module.get.tabElement(tabPath),
- fullTabPath = fullTabPath || tabPath,
- cachedContent = module.cache.read(fullTabPath),
apiSettings = {
dataType : 'html',
stateContext : $tab,
@@ -262,8 +261,13 @@
urlData: { tab: fullTabPath }
},
request = $tab.data(metadata.promise) || false,
- existingRequest = ( request && request.state() === 'pending' )
+ existingRequest = ( request && request.state() === 'pending' ),
+ cachedContent
;
+
+ fullTabPath = fullTabPath || tabPath;
+ cachedContent = module.cache.read(fullTabPath);
+
if(settings.cache && cachedContent) {
module.debug('Showing existing content', fullTabPath);
module.content.update(tabPath, cachedContent);
@@ -630,7 +634,6 @@
// uses pjax style endpoints fetching content from same url with remote-content headers
auto : false,
-
history : false,
path : false,
@@ -649,12 +652,12 @@
error: {
api : 'You attempted to load content without API module',
- noContent : 'The tab you specified is missing a content url.',
method : 'The method you called is not defined',
- state : 'The state library has not been initialized',
missingTab : 'Tab cannot be found',
+ noContent : 'The tab you specified is missing a content url.',
path : 'History enabled, but no path was specified',
- recursion : 'Max recursive depth reached'
+ recursion : 'Max recursive depth reached',
+ state : 'The state library has not been initialized'
},
metadata : {
@@ -669,7 +672,7 @@
},
selector : {
- tabs : '.tab'
+ tabs : '.ui.tab'
}
};
diff --git a/node/src/documents/introduction/getting-started.html.eco b/node/src/documents/introduction/getting-started.html.eco
index 612c53ffe..6c64e17a7 100755
--- a/node/src/documents/introduction/getting-started.html.eco
+++ b/node/src/documents/introduction/getting-started.html.eco
@@ -67,7 +67,7 @@ $(document)
First
Second
Third
-
+
Modules have simple behaviors for triggering common actions
diff --git a/node/src/documents/modules/tab.html.eco b/node/src/documents/modules/tab.html.eco
new file mode 100755
index 000000000..c2516c99c
--- /dev/null
+++ b/node/src/documents/modules/tab.html.eco
@@ -0,0 +1,265 @@
+---
+layout : 'default'
+css : 'side'
+
+title : 'Tab'
+description : 'A tab is a section of content tied to a navigation menu'
+type : 'UI Module'
+---
+
+
+
+<%- @partial('header') %>
+
+
+
+
+
+
+
+
+
+
+
Tabs are usually used in concert with an element that activates the tab.
+
When using tabs, unlike other UI components, the menu or activating element is initialized instead of the tab.
+
+
+ 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.
+
+
+ $('.demo.menu .item')
+ .tab()
+ ;
+
+
+
+
+ First Tab
+
+
+ Second Tab
+
+
+ Third Tab
+
+
+
+
+
Tabs can attach to a history change event to allow for tabs to maintain history events. Tabs use Asual's Address library to provide cross-browser push state support. This makes sure in browser that don't support push state, hashchange
is used with in page anchors to provide history functionality.
+
+
+ Make sure when you use history to specify the proper path. This is required for determining the stem url from the part of the url maintaining in page history. Using the incorrect path will cause the module to work incorrectly, producing unexpected results.
+
+
+
+ Be sure to set up routes on your server for any url used with history. If you use history to change the url to a location that does not exist, it will 404 on the next refresh. For example this documentation will 404 on refresh because Github Pages are only set up to server static site content.
+
+
+ $('.history.menu .item')
+ .tab({
+ history : true,
+ path : '/modules/tab.html'
+ })
+ ;
+
+
+
+
+ First Tab
+
+
+ Second Tab
+
+
+ Third Tab
+
+
+
+
+
+
+
+
+ All the following behaviors can be called using the syntax
$('.foo').tab('behavior name', argumentOne, argumentTwo)
+
+
+
+ attach events(selector, event) |
+ Attaches tab action to given selector. Default event if none specified is toggle |
+
+
+ show |
+ Shows tab |
+
+
+ hide |
+ Hides tab |
+
+
+ toggle |
+ Toggles visibility of tab |
+
+
+ is open |
+ Returns whether tab is open |
+
+
+ is closed |
+ Returns whether tab is closed |
+
+
+ push page |
+ Pushes page content to be visible alongside tab |
+
+
+ get direction |
+ Returns direction of current tab |
+
+
+ pull page |
+ Returns page content to original position |
+
+
+ add body css |
+ Adds stylesheet to page head to trigger tab animations |
+
+
+ remove body css |
+ Removes any inline stylesheets for tab animation |
+
+
+ get transition event |
+ Returns vendor prefixed transition end event |
+
+
+
+
+
+
+
+
+ Setting |
+ Default |
+ Description |
+
+
+
+ overlay |
+ false |
+ Whether tab should overlay page instead of pushing page to the side |
+
+
+ useCSS |
+ true |
+ Whether to use css animations or fallback javascript animations |
+
+
+ duration |
+ 300 |
+ Duration of side bar animation |
+
+
+
+
+
+
+
+ Setting |
+ Default |
+ Description |
+
+
+
+ namespace |
+ tab |
+ Event namespace. Makes sure module teardown does not effect other events attached to an element. |
+
+
+ className |
+
+
+ className: {
+ active : 'active',
+ pushed : 'pushed',
+ top : 'top',
+ left : 'left',
+ right : 'right',
+ bottom : 'bottom'
+ }
+
+ |
+ Class names used to attach style to state |
+
+
+
+
+
+
+
+
+
+
+ Setting |
+ Default |
+ Description |
+
+
+
+ name |
+ Tab |
+ Name used in debug logs |
+
+
+ debug |
+ True |
+ Provides standard debug output to console |
+
+
+ performance |
+ True |
+ Provides standard debug output to console |
+
+
+ verbose |
+ True |
+ Provides ancillary debug output to console |
+
+
+ errors |
+
+
+ error : {
+ method : 'The method you called is not defined.',
+ notFound : 'There were no elements that matched the specified selector'
+ }
+
+ |
+
+
+
+
+
+