Browse Source

adds more examples of modules

Former-commit-id: ce8621e0a841b1c8b49d6b846e35ad4706987778
Former-commit-id: 40c601f3dee31a05b3d5a824e4bd52d4f47f87a6
beta
jlukic 11 years ago
parent
commit
6eecbd7e30
  1. 26
      build/minified/modules/tab.js
  2. 26
      build/uncompressed/modules/tab.js
  3. 28
      node/src/documents/introduction/getting-started.html
  4. 26
      node/src/files/release/minified/modules/tab.js
  5. 26
      node/src/files/release/uncompressed/modules/tab.js
  6. 26
      src/modules/tab.js

26
build/minified/modules/tab.js

@ -109,7 +109,7 @@
$.address.value(tabPath);
}
else {
module.change(tabPath);
module.changeTab(tabPath);
}
}
else {
@ -125,7 +125,7 @@
module.debug('History change event', tabPath, event);
historyEvent = event;
if(tabPath !== undefined) {
module.change(tabPath);
module.changeTab(tabPath);
}
if(pageTitle) {
$.address.title(pageTitle);
@ -137,7 +137,7 @@
refresh: function() {
if(activeTabPath) {
module.debug('Refreshing tab', activeTabPath);
module.change(activeTabPath);
module.changeTab(activeTabPath);
}
},
@ -161,22 +161,22 @@
}
},
change: function(tabPath) {
changeTab: function(tabPath) {
var
pushStateAvailable = (window.history && window.history.pushState),
shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ),
// only get default path if not remote content
pathArray = (remoteContent && !shouldIgnoreLoad)
? module.utils.pathToArray(tabPath)
? module.utilities.pathToArray(tabPath)
: module.get.defaultPathArray(tabPath),
tabPath = module.utils.arrayToPath(pathArray)
tabPath = module.utilities.arrayToPath(pathArray)
;
module.deactivate.all();
$.each(pathArray, function(index, tab) {
var
currentPathArray = pathArray.slice(0, index + 1),
currentPath = module.utils.arrayToPath(currentPathArray),
currentPath = module.utilities.arrayToPath(currentPathArray),
isTab = module.is.tab(currentPath),
isLastIndex = (index + 1 == pathArray.length),
@ -192,14 +192,14 @@
// scope up
activeTabPath = currentPath;
parameterArray = module.utils.filterArray(pathArray, currentPathArray);
parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
if(isLastIndex) {
isLastTab = true;
}
else {
nextPathArray = pathArray.slice(0, index + 2);
nextPath = module.utils.arrayToPath(nextPathArray);
nextPath = module.utilities.arrayToPath(nextPathArray);
isLastTab = ( !module.is.tab(nextPath) );
if(isLastTab) {
module.verbose('Tab parameters found', nextPathArray);
@ -349,7 +349,7 @@
},
// adds default tabs to tab path
defaultPathArray: function(tabPath) {
return module.utils.pathToArray( module.get.defaultPath(tabPath) );
return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
},
defaultPath: function(tabPath) {
var
@ -382,8 +382,8 @@
lastTab
;
tabPath = tabPath || activeTabPath;
tabPathArray = module.utils.pathToArray(tabPath);
lastTab = module.utils.last(tabPathArray);
tabPathArray = module.utilities.pathToArray(tabPath);
lastTab = module.utilities.last(tabPathArray);
$fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]');
$simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
return ($fullPathTab.size() > 0)
@ -396,7 +396,7 @@
}
},
utils: {
utilities: {
filterArray: function(keepArray, removeArray) {
return $.grep(keepArray, function(keepValue) {
return ( $.inArray(keepValue, removeArray) == -1);

26
build/uncompressed/modules/tab.js

@ -109,7 +109,7 @@
$.address.value(tabPath);
}
else {
module.change(tabPath);
module.changeTab(tabPath);
}
}
else {
@ -125,7 +125,7 @@
module.debug('History change event', tabPath, event);
historyEvent = event;
if(tabPath !== undefined) {
module.change(tabPath);
module.changeTab(tabPath);
}
if(pageTitle) {
$.address.title(pageTitle);
@ -137,7 +137,7 @@
refresh: function() {
if(activeTabPath) {
module.debug('Refreshing tab', activeTabPath);
module.change(activeTabPath);
module.changeTab(activeTabPath);
}
},
@ -161,22 +161,22 @@
}
},
change: function(tabPath) {
changeTab: function(tabPath) {
var
pushStateAvailable = (window.history && window.history.pushState),
shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ),
// only get default path if not remote content
pathArray = (remoteContent && !shouldIgnoreLoad)
? module.utils.pathToArray(tabPath)
? module.utilities.pathToArray(tabPath)
: module.get.defaultPathArray(tabPath),
tabPath = module.utils.arrayToPath(pathArray)
tabPath = module.utilities.arrayToPath(pathArray)
;
module.deactivate.all();
$.each(pathArray, function(index, tab) {
var
currentPathArray = pathArray.slice(0, index + 1),
currentPath = module.utils.arrayToPath(currentPathArray),
currentPath = module.utilities.arrayToPath(currentPathArray),
isTab = module.is.tab(currentPath),
isLastIndex = (index + 1 == pathArray.length),
@ -192,14 +192,14 @@
// scope up
activeTabPath = currentPath;
parameterArray = module.utils.filterArray(pathArray, currentPathArray);
parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
if(isLastIndex) {
isLastTab = true;
}
else {
nextPathArray = pathArray.slice(0, index + 2);
nextPath = module.utils.arrayToPath(nextPathArray);
nextPath = module.utilities.arrayToPath(nextPathArray);
isLastTab = ( !module.is.tab(nextPath) );
if(isLastTab) {
module.verbose('Tab parameters found', nextPathArray);
@ -349,7 +349,7 @@
},
// adds default tabs to tab path
defaultPathArray: function(tabPath) {
return module.utils.pathToArray( module.get.defaultPath(tabPath) );
return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
},
defaultPath: function(tabPath) {
var
@ -382,8 +382,8 @@
lastTab
;
tabPath = tabPath || activeTabPath;
tabPathArray = module.utils.pathToArray(tabPath);
lastTab = module.utils.last(tabPathArray);
tabPathArray = module.utilities.pathToArray(tabPath);
lastTab = module.utilities.last(tabPathArray);
$fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]');
$simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
return ($fullPathTab.size() > 0)
@ -396,7 +396,7 @@
}
},
utils: {
utilities: {
filterArray: function(keepArray, removeArray) {
return $.grep(keepArray, function(keepValue) {
return ( $.inArray(keepValue, removeArray) == -1);

28
node/src/documents/introduction/getting-started.html

@ -17,18 +17,18 @@ $(document)
</script>
<div class="segment">
<div class="container">
<h1 class="ui header">Introduction
<h1 class="ui header">Getting Started
</h1>
</div>
</div>
<div class="main container">
<div class="peek">
<div class="ui vertical pointing secondary menu">
<a class="active item">Philosophy</a>
<a class="item">Getting Started</a>
<a class="active item">Interfacing Carefully</a>
<a class="item">Semantic APIs</a>
</div>
</div>
<h2 class="ui dividing header">Getting Started</h2>
<h2 class="ui dividing header">Interfacing Carefully</h2>
<p>UI definitions in Semantic are given the class name <code>ui</code>. This is to help tell the difference between ui elements and parts of the definition of an element. For example a menu may have menu items inside of it. These items are contained as part of the menu definition but do not receive the class name <code>ui</code>.</p>
@ -71,6 +71,16 @@ $(document)
<div class="ui tab segment" data-tab="second">Second</div>
<div class="ui tab segment" data-tab="third">Third</div>
</div>
<h3 class="ui header">Opening a new tab with a behavior</h3>
<p>Modules have simple behaviors for triggering common actions</p>
<div class="code" data-demo="true">
$('.demo.menu .item')
.tab('change tab', 'second')
;
</div>
<h3 class="ui header">Opening a new tab with multiple behaviors</h3>
<p>Any internal behavior is accessible as well</p>
<div class="code" data-demo="true">
$('.demo.menu .item')
.tab('deactivate all')
@ -78,6 +88,16 @@ $(document)
.tab('activate navigation', 'third')
;
</div>
<h3 class="ui header">Turning on HTML5 State</h3>
<p>Modules can be re-initialized at any time with different settings</p>
<div class="code" data-demo="true">
$('.demo.menu .item')
.tab({
history : true,
path : '/introduction/getting-started.html'
})
;
</div>
<div class="ui divider"></div>

26
node/src/files/release/minified/modules/tab.js

@ -109,7 +109,7 @@
$.address.value(tabPath);
}
else {
module.change(tabPath);
module.changeTab(tabPath);
}
}
else {
@ -125,7 +125,7 @@
module.debug('History change event', tabPath, event);
historyEvent = event;
if(tabPath !== undefined) {
module.change(tabPath);
module.changeTab(tabPath);
}
if(pageTitle) {
$.address.title(pageTitle);
@ -137,7 +137,7 @@
refresh: function() {
if(activeTabPath) {
module.debug('Refreshing tab', activeTabPath);
module.change(activeTabPath);
module.changeTab(activeTabPath);
}
},
@ -161,22 +161,22 @@
}
},
change: function(tabPath) {
changeTab: function(tabPath) {
var
pushStateAvailable = (window.history && window.history.pushState),
shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ),
// only get default path if not remote content
pathArray = (remoteContent && !shouldIgnoreLoad)
? module.utils.pathToArray(tabPath)
? module.utilities.pathToArray(tabPath)
: module.get.defaultPathArray(tabPath),
tabPath = module.utils.arrayToPath(pathArray)
tabPath = module.utilities.arrayToPath(pathArray)
;
module.deactivate.all();
$.each(pathArray, function(index, tab) {
var
currentPathArray = pathArray.slice(0, index + 1),
currentPath = module.utils.arrayToPath(currentPathArray),
currentPath = module.utilities.arrayToPath(currentPathArray),
isTab = module.is.tab(currentPath),
isLastIndex = (index + 1 == pathArray.length),
@ -192,14 +192,14 @@
// scope up
activeTabPath = currentPath;
parameterArray = module.utils.filterArray(pathArray, currentPathArray);
parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
if(isLastIndex) {
isLastTab = true;
}
else {
nextPathArray = pathArray.slice(0, index + 2);
nextPath = module.utils.arrayToPath(nextPathArray);
nextPath = module.utilities.arrayToPath(nextPathArray);
isLastTab = ( !module.is.tab(nextPath) );
if(isLastTab) {
module.verbose('Tab parameters found', nextPathArray);
@ -349,7 +349,7 @@
},
// adds default tabs to tab path
defaultPathArray: function(tabPath) {
return module.utils.pathToArray( module.get.defaultPath(tabPath) );
return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
},
defaultPath: function(tabPath) {
var
@ -382,8 +382,8 @@
lastTab
;
tabPath = tabPath || activeTabPath;
tabPathArray = module.utils.pathToArray(tabPath);
lastTab = module.utils.last(tabPathArray);
tabPathArray = module.utilities.pathToArray(tabPath);
lastTab = module.utilities.last(tabPathArray);
$fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]');
$simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
return ($fullPathTab.size() > 0)
@ -396,7 +396,7 @@
}
},
utils: {
utilities: {
filterArray: function(keepArray, removeArray) {
return $.grep(keepArray, function(keepValue) {
return ( $.inArray(keepValue, removeArray) == -1);

26
node/src/files/release/uncompressed/modules/tab.js

@ -109,7 +109,7 @@
$.address.value(tabPath);
}
else {
module.change(tabPath);
module.changeTab(tabPath);
}
}
else {
@ -125,7 +125,7 @@
module.debug('History change event', tabPath, event);
historyEvent = event;
if(tabPath !== undefined) {
module.change(tabPath);
module.changeTab(tabPath);
}
if(pageTitle) {
$.address.title(pageTitle);
@ -137,7 +137,7 @@
refresh: function() {
if(activeTabPath) {
module.debug('Refreshing tab', activeTabPath);
module.change(activeTabPath);
module.changeTab(activeTabPath);
}
},
@ -161,22 +161,22 @@
}
},
change: function(tabPath) {
changeTab: function(tabPath) {
var
pushStateAvailable = (window.history && window.history.pushState),
shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ),
// only get default path if not remote content
pathArray = (remoteContent && !shouldIgnoreLoad)
? module.utils.pathToArray(tabPath)
? module.utilities.pathToArray(tabPath)
: module.get.defaultPathArray(tabPath),
tabPath = module.utils.arrayToPath(pathArray)
tabPath = module.utilities.arrayToPath(pathArray)
;
module.deactivate.all();
$.each(pathArray, function(index, tab) {
var
currentPathArray = pathArray.slice(0, index + 1),
currentPath = module.utils.arrayToPath(currentPathArray),
currentPath = module.utilities.arrayToPath(currentPathArray),
isTab = module.is.tab(currentPath),
isLastIndex = (index + 1 == pathArray.length),
@ -192,14 +192,14 @@
// scope up
activeTabPath = currentPath;
parameterArray = module.utils.filterArray(pathArray, currentPathArray);
parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
if(isLastIndex) {
isLastTab = true;
}
else {
nextPathArray = pathArray.slice(0, index + 2);
nextPath = module.utils.arrayToPath(nextPathArray);
nextPath = module.utilities.arrayToPath(nextPathArray);
isLastTab = ( !module.is.tab(nextPath) );
if(isLastTab) {
module.verbose('Tab parameters found', nextPathArray);
@ -349,7 +349,7 @@
},
// adds default tabs to tab path
defaultPathArray: function(tabPath) {
return module.utils.pathToArray( module.get.defaultPath(tabPath) );
return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
},
defaultPath: function(tabPath) {
var
@ -382,8 +382,8 @@
lastTab
;
tabPath = tabPath || activeTabPath;
tabPathArray = module.utils.pathToArray(tabPath);
lastTab = module.utils.last(tabPathArray);
tabPathArray = module.utilities.pathToArray(tabPath);
lastTab = module.utilities.last(tabPathArray);
$fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]');
$simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
return ($fullPathTab.size() > 0)
@ -396,7 +396,7 @@
}
},
utils: {
utilities: {
filterArray: function(keepArray, removeArray) {
return $.grep(keepArray, function(keepValue) {
return ( $.inArray(keepValue, removeArray) == -1);

26
src/modules/tab.js

@ -109,7 +109,7 @@
$.address.value(tabPath);
}
else {
module.change(tabPath);
module.changeTab(tabPath);
}
}
else {
@ -125,7 +125,7 @@
module.debug('History change event', tabPath, event);
historyEvent = event;
if(tabPath !== undefined) {
module.change(tabPath);
module.changeTab(tabPath);
}
if(pageTitle) {
$.address.title(pageTitle);
@ -137,7 +137,7 @@
refresh: function() {
if(activeTabPath) {
module.debug('Refreshing tab', activeTabPath);
module.change(activeTabPath);
module.changeTab(activeTabPath);
}
},
@ -161,22 +161,22 @@
}
},
change: function(tabPath) {
changeTab: function(tabPath) {
var
pushStateAvailable = (window.history && window.history.pushState),
shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ),
// only get default path if not remote content
pathArray = (remoteContent && !shouldIgnoreLoad)
? module.utils.pathToArray(tabPath)
? module.utilities.pathToArray(tabPath)
: module.get.defaultPathArray(tabPath),
tabPath = module.utils.arrayToPath(pathArray)
tabPath = module.utilities.arrayToPath(pathArray)
;
module.deactivate.all();
$.each(pathArray, function(index, tab) {
var
currentPathArray = pathArray.slice(0, index + 1),
currentPath = module.utils.arrayToPath(currentPathArray),
currentPath = module.utilities.arrayToPath(currentPathArray),
isTab = module.is.tab(currentPath),
isLastIndex = (index + 1 == pathArray.length),
@ -192,14 +192,14 @@
// scope up
activeTabPath = currentPath;
parameterArray = module.utils.filterArray(pathArray, currentPathArray);
parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
if(isLastIndex) {
isLastTab = true;
}
else {
nextPathArray = pathArray.slice(0, index + 2);
nextPath = module.utils.arrayToPath(nextPathArray);
nextPath = module.utilities.arrayToPath(nextPathArray);
isLastTab = ( !module.is.tab(nextPath) );
if(isLastTab) {
module.verbose('Tab parameters found', nextPathArray);
@ -349,7 +349,7 @@
},
// adds default tabs to tab path
defaultPathArray: function(tabPath) {
return module.utils.pathToArray( module.get.defaultPath(tabPath) );
return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
},
defaultPath: function(tabPath) {
var
@ -382,8 +382,8 @@
lastTab
;
tabPath = tabPath || activeTabPath;
tabPathArray = module.utils.pathToArray(tabPath);
lastTab = module.utils.last(tabPathArray);
tabPathArray = module.utilities.pathToArray(tabPath);
lastTab = module.utilities.last(tabPathArray);
$fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]');
$simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
return ($fullPathTab.size() > 0)
@ -396,7 +396,7 @@
}
},
utils: {
utilities: {
filterArray: function(keepArray, removeArray) {
return $.grep(keepArray, function(keepValue) {
return ( $.inArray(keepValue, removeArray) == -1);

Loading…
Cancel
Save