diff --git a/RELEASE NOTES.md b/RELEASE NOTES.md index 7e346b60a..9d16e6d44 100755 --- a/RELEASE NOTES.md +++ b/RELEASE NOTES.md @@ -1,13 +1,24 @@ ## RELEASE NOTES -### Version 0.2.5- Sep 30, 2013 +### Version 0.3.0 - Sep 30, 2013 + +**Additions** +- Adds new UI module tab with documentation. + +**Updates** +- Adds new methods to rating, 'get rating', 'clear rating', adds new setting 'clearable' +- Adds rating as first callback parameter on 'onRate' + +**Fixes** + +### Version 0.2.5 - Sep 30, 2013 **Fixes** - Fixes checkbox selector issue with multiple inputs inside a checkbox - Modal no longer uses inline css to center when in fixed position mode - Fixes dropdown to now set active item to whatever hidden input field is when using action updateForm -### Version 0.2.4- Sep 28, 2013 +### Version 0.2.4 - Sep 28, 2013 **Updates** diff --git a/build/less/collections/grid.less b/build/less/collections/grid.less index 2e332a322..9e5b89220 100644 --- a/build/less/collections/grid.less +++ b/build/less/collections/grid.less @@ -98,7 +98,8 @@ .ui.page.grid { margin: 0%; - padding: 0% 2%; + padding-left: 0%; + padding-right: 0%; } diff --git a/build/less/modules/rating.js b/build/less/modules/rating.js index 7267eb2ea..0eabb5953 100644 --- a/build/less/modules/rating.js +++ b/build/less/modules/rating.js @@ -87,29 +87,6 @@ $.fn.rating = function(parameters) { ; }, - setRating: function(rating) { - var - $activeIcon = $icon.eq(rating - 1) - ; - module.verbose('Setting current rating to', rating); - $module - .removeClass(className.hover) - ; - $icon - .removeClass(className.hover) - ; - $activeIcon - .nextAll() - .removeClass(className.active) - ; - $activeIcon - .addClass(className.active) - .prevAll() - .addClass(className.active) - ; - $.proxy(settings.onRate, element)(); - }, - event: { mouseenter: function() { var @@ -138,11 +115,57 @@ $.fn.rating = function(parameters) { }, click: function() { var - $activeIcon = $(this) + $activeIcon = $(this), + currentRating = module.getRating(), + rating = $icon.index($activeIcon) + 1 + ; + if(settings.clearable && currentRating == rating) { + module.clearRating(); + } + else { + module.setRating( rating ); + } + } + }, + + clearRating: function() { + module.debug('Clearing current rating'); + module.setRating(0); + }, + + getRating: function() { + var + currentRating = $icon.filter('.' + className.active).size() + ; + module.verbose('Current rating retrieved', currentRating); + return currentRating; + }, + + setRating: function(rating) { + var + ratingIndex = (rating - 1 >= 0) + ? (rating - 1) + : 0, + $activeIcon = $icon.eq(ratingIndex) + ; + $module + .removeClass(className.hover) + ; + $icon + .removeClass(className.hover) + .removeClass(className.active) + ; + if(rating > 0) { + module.verbose('Setting current rating to', rating); + $activeIcon + .addClass(className.active) + .prevAll() + .addClass(className.active) ; - module.setRating( $icon.index($activeIcon) + 1); } + $.proxy(settings.onRate, element)(rating); }, + setting: function(name, value) { if(value !== undefined) { if( $.isPlainObject(name) ) { @@ -231,9 +254,6 @@ $.fn.rating = function(parameters) { if(moduleSelector) { title += ' \'' + moduleSelector + '\''; } - if($allModules.size() > 1) { - title += ' ' + '(' + $allModules.size() + ')'; - } if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { console.groupCollapsed(title); if(console.table) { @@ -336,7 +356,9 @@ $.fn.rating.settings = { initialRating : 0, interactive : true, - onRate : function(){}, + clearable : false, + + onRate : function(rating){}, error : { method : 'The method you called is not defined' diff --git a/build/less/modules/tab.js b/build/less/modules/tab.js index 1cd832a0e..f6efcdcb6 100644 --- a/build/less/modules/tab.js +++ b/build/less/modules/tab.js @@ -54,6 +54,15 @@ initialize: function() { module.debug('Initializing Tabs', $module); + + // set up automatic routing + if(settings.auto) { + module.verbose('Setting up automatic tab retrieval from server'); + settings.apiSettings = { + url: settings.path + '/{$tab}' + }; + } + // attach history events if(settings.history) { if( $.address === undefined ) { @@ -65,11 +74,6 @@ return false; } else { - if(settings.auto) { - settings.apiSettings = { - url: settings.path + '/{$tab}' - }; - } module.verbose('Address library found adding state change event'); $.address .state(settings.path) @@ -78,9 +82,10 @@ ; } } + // attach events if navigation wasn't set to window if( !$.isWindow( element ) ) { - module.debug('Attaching events to tab activator', $module); + module.debug('Attaching tab activation events to element', $module); $module .on('click' + eventNamespace, module.event.click) ; @@ -103,7 +108,7 @@ }, event: { - click: function() { + click: function(event) { module.debug('Navigation clicked'); var tabPath = $(this).data(metadata.tab) @@ -115,6 +120,7 @@ else { module.changeTab(tabPath); } + event.preventDefault(); } else { module.debug('No tab specified'); @@ -262,6 +268,7 @@ }, request = $tab.data(metadata.promise) || false, existingRequest = ( request && request.state() === 'pending' ), + requestSettings, cachedContent ; @@ -281,8 +288,10 @@ ; } else if($.api !== undefined) { - module.debug('Retrieving remote content', fullTabPath); - $.api( $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings) ); + console.log(settings.apiSettings); + requestSettings = $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings); + module.debug('Retrieving remote content', fullTabPath, requestSettings); + $.api( requestSettings ); } else { module.error(error.api); @@ -372,7 +381,7 @@ module.error(error.recursion); } else { - module.debug('No default tabs found for', tabPath); + module.debug('No default tabs found for', tabPath, $tabs); } recursionDepth = 0; return tabPath; @@ -642,7 +651,7 @@ // max depth a tab can be nested maxDepth : 25, // dont load content on first load - ignoreFirstLoad : true, + ignoreFirstLoad : false, // load tab content new every tab click alwaysRefresh : false, // cache the content requests to pull locally diff --git a/build/minified/modules/rating.js b/build/minified/modules/rating.js index 7267eb2ea..0eabb5953 100644 --- a/build/minified/modules/rating.js +++ b/build/minified/modules/rating.js @@ -87,29 +87,6 @@ $.fn.rating = function(parameters) { ; }, - setRating: function(rating) { - var - $activeIcon = $icon.eq(rating - 1) - ; - module.verbose('Setting current rating to', rating); - $module - .removeClass(className.hover) - ; - $icon - .removeClass(className.hover) - ; - $activeIcon - .nextAll() - .removeClass(className.active) - ; - $activeIcon - .addClass(className.active) - .prevAll() - .addClass(className.active) - ; - $.proxy(settings.onRate, element)(); - }, - event: { mouseenter: function() { var @@ -138,11 +115,57 @@ $.fn.rating = function(parameters) { }, click: function() { var - $activeIcon = $(this) + $activeIcon = $(this), + currentRating = module.getRating(), + rating = $icon.index($activeIcon) + 1 + ; + if(settings.clearable && currentRating == rating) { + module.clearRating(); + } + else { + module.setRating( rating ); + } + } + }, + + clearRating: function() { + module.debug('Clearing current rating'); + module.setRating(0); + }, + + getRating: function() { + var + currentRating = $icon.filter('.' + className.active).size() + ; + module.verbose('Current rating retrieved', currentRating); + return currentRating; + }, + + setRating: function(rating) { + var + ratingIndex = (rating - 1 >= 0) + ? (rating - 1) + : 0, + $activeIcon = $icon.eq(ratingIndex) + ; + $module + .removeClass(className.hover) + ; + $icon + .removeClass(className.hover) + .removeClass(className.active) + ; + if(rating > 0) { + module.verbose('Setting current rating to', rating); + $activeIcon + .addClass(className.active) + .prevAll() + .addClass(className.active) ; - module.setRating( $icon.index($activeIcon) + 1); } + $.proxy(settings.onRate, element)(rating); }, + setting: function(name, value) { if(value !== undefined) { if( $.isPlainObject(name) ) { @@ -231,9 +254,6 @@ $.fn.rating = function(parameters) { if(moduleSelector) { title += ' \'' + moduleSelector + '\''; } - if($allModules.size() > 1) { - title += ' ' + '(' + $allModules.size() + ')'; - } if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { console.groupCollapsed(title); if(console.table) { @@ -336,7 +356,9 @@ $.fn.rating.settings = { initialRating : 0, interactive : true, - onRate : function(){}, + clearable : false, + + onRate : function(rating){}, error : { method : 'The method you called is not defined' diff --git a/build/minified/modules/tab.js b/build/minified/modules/tab.js index 1cd832a0e..f6efcdcb6 100644 --- a/build/minified/modules/tab.js +++ b/build/minified/modules/tab.js @@ -54,6 +54,15 @@ initialize: function() { module.debug('Initializing Tabs', $module); + + // set up automatic routing + if(settings.auto) { + module.verbose('Setting up automatic tab retrieval from server'); + settings.apiSettings = { + url: settings.path + '/{$tab}' + }; + } + // attach history events if(settings.history) { if( $.address === undefined ) { @@ -65,11 +74,6 @@ return false; } else { - if(settings.auto) { - settings.apiSettings = { - url: settings.path + '/{$tab}' - }; - } module.verbose('Address library found adding state change event'); $.address .state(settings.path) @@ -78,9 +82,10 @@ ; } } + // attach events if navigation wasn't set to window if( !$.isWindow( element ) ) { - module.debug('Attaching events to tab activator', $module); + module.debug('Attaching tab activation events to element', $module); $module .on('click' + eventNamespace, module.event.click) ; @@ -103,7 +108,7 @@ }, event: { - click: function() { + click: function(event) { module.debug('Navigation clicked'); var tabPath = $(this).data(metadata.tab) @@ -115,6 +120,7 @@ else { module.changeTab(tabPath); } + event.preventDefault(); } else { module.debug('No tab specified'); @@ -262,6 +268,7 @@ }, request = $tab.data(metadata.promise) || false, existingRequest = ( request && request.state() === 'pending' ), + requestSettings, cachedContent ; @@ -281,8 +288,10 @@ ; } else if($.api !== undefined) { - module.debug('Retrieving remote content', fullTabPath); - $.api( $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings) ); + console.log(settings.apiSettings); + requestSettings = $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings); + module.debug('Retrieving remote content', fullTabPath, requestSettings); + $.api( requestSettings ); } else { module.error(error.api); @@ -372,7 +381,7 @@ module.error(error.recursion); } else { - module.debug('No default tabs found for', tabPath); + module.debug('No default tabs found for', tabPath, $tabs); } recursionDepth = 0; return tabPath; @@ -642,7 +651,7 @@ // max depth a tab can be nested maxDepth : 25, // dont load content on first load - ignoreFirstLoad : true, + ignoreFirstLoad : false, // load tab content new every tab click alwaysRefresh : false, // cache the content requests to pull locally diff --git a/build/uncompressed/collections/grid.css b/build/uncompressed/collections/grid.css index 2cf88cb45..bd79875fa 100644 --- a/build/uncompressed/collections/grid.css +++ b/build/uncompressed/collections/grid.css @@ -78,7 +78,8 @@ --------------------*/ .ui.page.grid { margin: 0%; - padding: 0% 2%; + padding-left: 0%; + padding-right: 0%; } /*------------------- Responsive diff --git a/build/uncompressed/modules/rating.js b/build/uncompressed/modules/rating.js index 7267eb2ea..0eabb5953 100644 --- a/build/uncompressed/modules/rating.js +++ b/build/uncompressed/modules/rating.js @@ -87,29 +87,6 @@ $.fn.rating = function(parameters) { ; }, - setRating: function(rating) { - var - $activeIcon = $icon.eq(rating - 1) - ; - module.verbose('Setting current rating to', rating); - $module - .removeClass(className.hover) - ; - $icon - .removeClass(className.hover) - ; - $activeIcon - .nextAll() - .removeClass(className.active) - ; - $activeIcon - .addClass(className.active) - .prevAll() - .addClass(className.active) - ; - $.proxy(settings.onRate, element)(); - }, - event: { mouseenter: function() { var @@ -138,11 +115,57 @@ $.fn.rating = function(parameters) { }, click: function() { var - $activeIcon = $(this) + $activeIcon = $(this), + currentRating = module.getRating(), + rating = $icon.index($activeIcon) + 1 + ; + if(settings.clearable && currentRating == rating) { + module.clearRating(); + } + else { + module.setRating( rating ); + } + } + }, + + clearRating: function() { + module.debug('Clearing current rating'); + module.setRating(0); + }, + + getRating: function() { + var + currentRating = $icon.filter('.' + className.active).size() + ; + module.verbose('Current rating retrieved', currentRating); + return currentRating; + }, + + setRating: function(rating) { + var + ratingIndex = (rating - 1 >= 0) + ? (rating - 1) + : 0, + $activeIcon = $icon.eq(ratingIndex) + ; + $module + .removeClass(className.hover) + ; + $icon + .removeClass(className.hover) + .removeClass(className.active) + ; + if(rating > 0) { + module.verbose('Setting current rating to', rating); + $activeIcon + .addClass(className.active) + .prevAll() + .addClass(className.active) ; - module.setRating( $icon.index($activeIcon) + 1); } + $.proxy(settings.onRate, element)(rating); }, + setting: function(name, value) { if(value !== undefined) { if( $.isPlainObject(name) ) { @@ -231,9 +254,6 @@ $.fn.rating = function(parameters) { if(moduleSelector) { title += ' \'' + moduleSelector + '\''; } - if($allModules.size() > 1) { - title += ' ' + '(' + $allModules.size() + ')'; - } if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { console.groupCollapsed(title); if(console.table) { @@ -336,7 +356,9 @@ $.fn.rating.settings = { initialRating : 0, interactive : true, - onRate : function(){}, + clearable : false, + + onRate : function(rating){}, error : { method : 'The method you called is not defined' diff --git a/build/uncompressed/modules/tab.js b/build/uncompressed/modules/tab.js index 1cd832a0e..f6efcdcb6 100644 --- a/build/uncompressed/modules/tab.js +++ b/build/uncompressed/modules/tab.js @@ -54,6 +54,15 @@ initialize: function() { module.debug('Initializing Tabs', $module); + + // set up automatic routing + if(settings.auto) { + module.verbose('Setting up automatic tab retrieval from server'); + settings.apiSettings = { + url: settings.path + '/{$tab}' + }; + } + // attach history events if(settings.history) { if( $.address === undefined ) { @@ -65,11 +74,6 @@ return false; } else { - if(settings.auto) { - settings.apiSettings = { - url: settings.path + '/{$tab}' - }; - } module.verbose('Address library found adding state change event'); $.address .state(settings.path) @@ -78,9 +82,10 @@ ; } } + // attach events if navigation wasn't set to window if( !$.isWindow( element ) ) { - module.debug('Attaching events to tab activator', $module); + module.debug('Attaching tab activation events to element', $module); $module .on('click' + eventNamespace, module.event.click) ; @@ -103,7 +108,7 @@ }, event: { - click: function() { + click: function(event) { module.debug('Navigation clicked'); var tabPath = $(this).data(metadata.tab) @@ -115,6 +120,7 @@ else { module.changeTab(tabPath); } + event.preventDefault(); } else { module.debug('No tab specified'); @@ -262,6 +268,7 @@ }, request = $tab.data(metadata.promise) || false, existingRequest = ( request && request.state() === 'pending' ), + requestSettings, cachedContent ; @@ -281,8 +288,10 @@ ; } else if($.api !== undefined) { - module.debug('Retrieving remote content', fullTabPath); - $.api( $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings) ); + console.log(settings.apiSettings); + requestSettings = $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings); + module.debug('Retrieving remote content', fullTabPath, requestSettings); + $.api( requestSettings ); } else { module.error(error.api); @@ -372,7 +381,7 @@ module.error(error.recursion); } else { - module.debug('No default tabs found for', tabPath); + module.debug('No default tabs found for', tabPath, $tabs); } recursionDepth = 0; return tabPath; @@ -642,7 +651,7 @@ // max depth a tab can be nested maxDepth : 25, // dont load content on first load - ignoreFirstLoad : true, + ignoreFirstLoad : false, // load tab content new every tab click alwaysRefresh : false, // cache the content requests to pull locally diff --git a/node/src/documents/modules/rating.html.eco b/node/src/documents/modules/rating.html.eco index eaa19ccf7..4d70804cd 100755 --- a/node/src/documents/modules/rating.html.eco +++ b/node/src/documents/modules/rating.html.eco @@ -122,6 +122,22 @@ type : 'UI Module' +
When clearable is set to true
you can clear the rating by clicking on the current start rating.
A rating can be retrieved
+A rating can be cleared
+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 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.
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.