From 954d98a7211a50f4a50a4d8f031a66b1355d6572 Mon Sep 17 00:00:00 2001 From: "Higgins, Joshua" Date: Tue, 10 Mar 2015 10:47:18 -0400 Subject: [PATCH 1/7] atom's cleaning up spacing --- .gitignore | 2 +- .jshintrc | 4 ++-- LICENSE | 2 +- README.MD | 6 +++--- dist/packery.js | 14 +++++++------- dist/packery.min.js | 2 +- src/packery.js | 16 ++++++++-------- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 29a48a4..606ebd1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ app/ node_modules/ bower_components/ .sass-cache/ -_includes/ \ No newline at end of file +_includes/ diff --git a/.jshintrc b/.jshintrc index 3f76a8d..d4c0932 100644 --- a/.jshintrc +++ b/.jshintrc @@ -21,5 +21,5 @@ "angular": true, "Packery": true, "Draggabilly": true - } -} \ No newline at end of file + } +} diff --git a/LICENSE b/LICENSE index b96700d..ccd1bfb 100644 --- a/LICENSE +++ b/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file +THE SOFTWARE. diff --git a/README.MD b/README.MD index 24c9ced..7b19cb4 100644 --- a/README.MD +++ b/README.MD @@ -20,7 +20,7 @@ Angular module for the popular Packery library. By default, this module listens for an element or attribute call and instantiates with the options described in [Packery's API](http://packery.metafizzy.co/options.html). It looks to a self-created object, `div.packery-sizer`, to control the grid dimensions. ##### HTML ##### - + ``` @@ -48,7 +48,7 @@ By default, this module listens for an element or attribute call and instantiate ``` - + #### CSS #### ``` @@ -119,7 +119,7 @@ This module supports almost all of the Packery options in their intended form. A ## CSS Classes / Animating ## -Two CSS classes are applied to the objects to show depth during dragging events, `hovered` and `lifted`. The classes are triggered by both mouse events and touch events. +Two CSS classes are applied to the objects to show depth during dragging events, `hovered` and `lifted`. The classes are triggered by both mouse events and touch events. Animation can be applied easily with CSS: diff --git a/dist/packery.js b/dist/packery.js index 784365e..2d776f4 100644 --- a/dist/packery.js +++ b/dist/packery.js @@ -65,7 +65,7 @@ return packeryObj; } else { var interval = $interval(function(){ - if (packeryObj !== undefined) { + if (packeryObj !== undefined) { $interval.cancel(interval); deferred.resolve(packeryObj); } @@ -75,7 +75,7 @@ $interval.cancel(interval); deferred.reject(false); }, config.timeout); - + return deferred.promise; } } @@ -93,7 +93,7 @@ self.packery = {}; this.bindDragEvents = function(el) { - var handleSelector, handle, draggabilly; + var handleSelector, handle, draggabilly; handleSelector = self.dragHandle; @@ -156,7 +156,7 @@ el.css('visibility','visible'); $rootScope.$emit('packeryObjectPacked', el[0]); - }); + }); }; this.setDraggable = function (handle) { @@ -189,7 +189,7 @@ handle: '@?' // Type: Boolean // Let's come back to this one... - // stamp: '@?', + // stamp: '@?', }, link: function (scope, element, attrs, controller) { @@ -247,7 +247,7 @@ element.css('visibility','hidden'); // Packs individual objects - controller.packObject(element); + controller.packObject(element); } }; }; @@ -255,7 +255,7 @@ var packeryTemplates = function ($templateCache) { $templateCache .put('template/packery/packery.html', [ - '
', + '
', '
', '
', '
' diff --git a/dist/packery.min.js b/dist/packery.min.js index b0aeb5e..b8811ca 100644 --- a/dist/packery.min.js +++ b/dist/packery.min.js @@ -5,4 +5,4 @@ * License: MIT */ -"use strict";!function(){var a=["packeryTemplates"],b={columnWidth:".packery-sizer",itemSelector:".packery-object",rowHeight:".packery-sizer",draggable:!0,handle:"*",timeout:2e3,acceptedAttributes:["containerStyle","columnWidth","gutter","isHorizontal","isInitLayout","isOriginLeft","isOriginTop","isResizeBound","itemSelector","rowHeight","transitionDuration"]},c=function(a,b,c,d,e){var f,g=[],h=function(a,b){for(var c=0;c",'
','
',"
"].join("")),a.put("template/packery/packery-object.html",'
')};angular.module("angular-packery",a).constant("packeryConfig",b).service("packeryService",["$rootScope","$q","$interval","$timeout","packeryConfig",c]).controller("PackeryController",["$rootScope","packeryConfig","packeryService",d]).directive("packery",["packeryConfig","packeryService",e]).directive("packeryObject",[f]).directive("packeryObject",[g]),angular.module("packeryTemplates",[]).run(["$templateCache",h])}(); \ No newline at end of file +"use strict";!function(){var a=["packeryTemplates"],b={columnWidth:".packery-sizer",itemSelector:".packery-object",rowHeight:".packery-sizer",draggable:!0,handle:"*",timeout:2e3,acceptedAttributes:["containerStyle","columnWidth","gutter","isHorizontal","isInitLayout","isOriginLeft","isOriginTop","isResizeBound","itemSelector","rowHeight","transitionDuration"]},c=function(a,b,c,d,e){var f,g=[],h=function(a,b){for(var c=0;c",'
','
',""].join("")),a.put("template/packery/packery-object.html",'
')};angular.module("angular-packery",a).constant("packeryConfig",b).service("packeryService",["$rootScope","$q","$interval","$timeout","packeryConfig",c]).controller("PackeryController",["$rootScope","packeryConfig","packeryService",d]).directive("packery",["packeryConfig","packeryService",e]).directive("packeryObject",[f]).directive("packeryObject",[g]),angular.module("packeryTemplates",[]).run(["$templateCache",h])}(); diff --git a/src/packery.js b/src/packery.js index 0843c6c..97d1ff2 100644 --- a/src/packery.js +++ b/src/packery.js @@ -59,7 +59,7 @@ return packeryObj; } else { var interval = $interval(function(){ - if (packeryObj !== undefined) { + if (packeryObj !== undefined) { $interval.cancel(interval); deferred.resolve(packeryObj); } @@ -69,7 +69,7 @@ $interval.cancel(interval); deferred.reject(false); }, config.timeout); - + return deferred.promise; } } @@ -87,7 +87,7 @@ self.packery = {}; this.bindDragEvents = function(el) { - var handleSelector, handle, draggabilly; + var handleSelector, handle, draggabilly; handleSelector = self.dragHandle; @@ -150,7 +150,7 @@ el.css('visibility','visible'); $rootScope.$emit('packeryObjectPacked', el[0]); - }); + }); }; this.setDraggable = function (handle) { @@ -160,7 +160,7 @@ }; var packeryDirective = function (config, service) { - + var createObject = function (str) { try { var obj = JSON.parse(JSON.stringify(eval('('+str+')'))); @@ -195,7 +195,7 @@ handle: '@?' // Type: Boolean // Let's come back to this one... - // stamp: '@?', + // stamp: '@?', }, link: function (scope, element, attrs, controller) { @@ -256,7 +256,7 @@ element.css('visibility','hidden'); // Packs individual objects - controller.packObject(element); + controller.packObject(element); } }; }; @@ -264,7 +264,7 @@ var packeryTemplates = function ($templateCache) { $templateCache .put('template/packery/packery.html', [ - '
', + '
', '
', '
', '
' From 95699bbca659709d34fc3563c503e636fa5b2985 Mon Sep 17 00:00:00 2001 From: "Higgins, Joshua" Date: Tue, 10 Mar 2015 10:47:44 -0400 Subject: [PATCH 2/7] add support for travis / future testing, closes #21 --- .travis.yml | 3 +++ Gruntfile.js | 6 +++++- README.MD | 2 ++ package.json | 3 ++- 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..796d98f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.12" diff --git a/Gruntfile.js b/Gruntfile.js index efe987c..545ef94 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -65,4 +65,8 @@ module.exports = function( grunt ) { 'usebanner' ]); -}; \ No newline at end of file + grunt.registerTask( 'test', [ + 'jshint' + ]); + +}; diff --git a/README.MD b/README.MD index 7b19cb4..c15dbcf 100644 --- a/README.MD +++ b/README.MD @@ -2,6 +2,8 @@ Angular module for the popular Packery library. +![Travis CI](https://api.travis-ci.org/sungard-labs/angular-packery.png) + #### Requirements #### diff --git a/package.json b/package.json index 3fccfb5..60852da 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "grunt-banner": "~0.2.3" }, "scripts": { - "postinstall": "bower install" + "postinstall": "bower install", + "test": "grunt test --verbose" }, "license": "MIT" } From 1bbf848ee84316a1bb00e179925b26d4b91c22c8 Mon Sep 17 00:00:00 2001 From: "Higgins, Joshua" Date: Tue, 10 Mar 2015 10:53:48 -0400 Subject: [PATCH 3/7] jshint cleanup --- src/packery.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/packery.js b/src/packery.js index 97d1ff2..20927c5 100644 --- a/src/packery.js +++ b/src/packery.js @@ -164,7 +164,7 @@ var createObject = function (str) { try { var obj = JSON.parse(JSON.stringify(eval('('+str+')'))); - if (obj && typeof obj === "object") { + if (obj && typeof obj === 'object') { return obj; } } @@ -218,7 +218,7 @@ if (scope.isResizeBound === 'false') { scope.isResizeBound = false; } // Creates JS Object for passing CSS styles into Packery - if (scope.containerStyle) { scope.containerStyle = createObject(scope.containerStyle) }; + if (scope.containerStyle) { scope.containerStyle = createObject(scope.containerStyle); } // Set global draggability if (scope.draggable) { controller.setDraggable(scope.handle); } From 58cf091e3d746fa7719ee72185e48206bb422934 Mon Sep 17 00:00:00 2001 From: "Higgins, Joshua" Date: Tue, 10 Mar 2015 11:23:44 -0400 Subject: [PATCH 4/7] fixing a scope issue with containerStyle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #da9e66b was obviously a late night bad decision… --- src/packery.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/packery.js b/src/packery.js index 20927c5..09f1ec3 100644 --- a/src/packery.js +++ b/src/packery.js @@ -161,17 +161,6 @@ var packeryDirective = function (config, service) { - var createObject = function (str) { - try { - var obj = JSON.parse(JSON.stringify(eval('('+str+')'))); - if (obj && typeof obj === 'object') { - return obj; - } - } - catch (e) {} - return false; - }; - return { restrict: 'EAC', controller: 'PackeryController', @@ -179,7 +168,7 @@ replace: true, templateUrl: 'template/packery/packery.html', scope: { - containerStyle: '@?', // Type: Object, null + containerStyle: '=?', // Type: Object, null columnWidth: '@?', // Type: Number, Selector String gutter: '@?', // Type: Number, Selector String isHorizontal: '@?', // Type: Boolean @@ -218,7 +207,7 @@ if (scope.isResizeBound === 'false') { scope.isResizeBound = false; } // Creates JS Object for passing CSS styles into Packery - if (scope.containerStyle) { scope.containerStyle = createObject(scope.containerStyle); } + if (scope.containerStyle && (typeof scope.containerStyle === 'Object' )) { scope.containerStyle = scope.containerStyle }; // Set global draggability if (scope.draggable) { controller.setDraggable(scope.handle); } From dbc05a3eb796b248a3cefe71fd02accfa007dc5f Mon Sep 17 00:00:00 2001 From: "Higgins, Joshua" Date: Tue, 10 Mar 2015 11:41:13 -0400 Subject: [PATCH 5/7] updated gitignore to include _site --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 606ebd1..7ab073a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules/ bower_components/ .sass-cache/ _includes/ +_site/ From 80de9710f950b0547c89818fcc0915757c6cde90 Mon Sep 17 00:00:00 2001 From: "Higgins, Joshua" Date: Tue, 10 Mar 2015 11:44:57 -0400 Subject: [PATCH 6/7] fixing more jshint issues --- src/packery.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packery.js b/src/packery.js index 09f1ec3..64e4e90 100644 --- a/src/packery.js +++ b/src/packery.js @@ -207,7 +207,7 @@ if (scope.isResizeBound === 'false') { scope.isResizeBound = false; } // Creates JS Object for passing CSS styles into Packery - if (scope.containerStyle && (typeof scope.containerStyle === 'Object' )) { scope.containerStyle = scope.containerStyle }; + if (scope.containerStyle && (typeof scope.containerStyle === 'object' )) { scope.containerStyle = scope.containerStyle; } // Set global draggability if (scope.draggable) { controller.setDraggable(scope.handle); } From a36805d8067306b311b8cd4ee934be30b0ddface Mon Sep 17 00:00:00 2001 From: "Higgins, Joshua" Date: Tue, 10 Mar 2015 11:45:10 -0400 Subject: [PATCH 7/7] version bump, 1.0.3 --- bower.json | 2 +- dist/packery.js | 15 ++++++++++----- dist/packery.min.js | 4 ++-- package.json | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bower.json b/bower.json index da70ec6..48776c5 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-packery", - "version": "1.0.2", + "version": "1.0.3", "author": "http://github.com/sungard-labs/angular-packery/graphs/contributors", "homepage": "http://github.com/sungard-labs/angular-packery", "repository": { diff --git a/dist/packery.js b/dist/packery.js index 2d776f4..8ce2a0e 100644 --- a/dist/packery.js +++ b/dist/packery.js @@ -1,7 +1,7 @@ /*! * angular-packery * http://github.com/sungard-labs/angular-packery - * Version: 1.0.2 + * Version: 1.0.3 * License: MIT */ @@ -61,6 +61,7 @@ id: hash, packery: packeryObj }); + el.data('Packery', packeryObj); $rootScope.$emit('packeryInstantiated', packeryObj); return packeryObj; } else { @@ -104,14 +105,14 @@ draggabilly = new Draggabilly(el[0], { handle: handleSelector }); - handle = el.querySelectorAll(handleSelector); + handle = el[0].querySelectorAll(handleSelector); } // Init Draggabilly events self.packery.bindDraggabillyEvents(draggabilly); // Bind animate events for touch - handle.on('mouseenter', function(){ + angular.element(handle).on('mouseenter', function(){ el.addClass('hovered'); }). on('mouseleave', function(){ @@ -166,6 +167,7 @@ }; var packeryDirective = function (config, service) { + return { restrict: 'EAC', controller: 'PackeryController', @@ -173,7 +175,7 @@ replace: true, templateUrl: 'template/packery/packery.html', scope: { - containerStyle: '@?', // Type: Object, null + containerStyle: '=?', // Type: Object, null columnWidth: '@?', // Type: Number, Selector String gutter: '@?', // Type: Number, Selector String isHorizontal: '@?', // Type: Boolean @@ -211,6 +213,9 @@ if (scope.isOriginTop === 'false') { scope.isOriginTop = false; } if (scope.isResizeBound === 'false') { scope.isResizeBound = false; } + // Creates JS Object for passing CSS styles into Packery + if (scope.containerStyle && (typeof scope.containerStyle === 'object' )) { scope.containerStyle = scope.containerStyle; } + // Set global draggability if (scope.draggable) { controller.setDraggable(scope.handle); } @@ -255,7 +260,7 @@ var packeryTemplates = function ($templateCache) { $templateCache .put('template/packery/packery.html', [ - '
', + '
', '
', '
', '
' diff --git a/dist/packery.min.js b/dist/packery.min.js index b8811ca..a8a1d18 100644 --- a/dist/packery.min.js +++ b/dist/packery.min.js @@ -1,8 +1,8 @@ /*! * angular-packery * http://github.com/sungard-labs/angular-packery - * Version: 1.0.2 + * Version: 1.0.3 * License: MIT */ -"use strict";!function(){var a=["packeryTemplates"],b={columnWidth:".packery-sizer",itemSelector:".packery-object",rowHeight:".packery-sizer",draggable:!0,handle:"*",timeout:2e3,acceptedAttributes:["containerStyle","columnWidth","gutter","isHorizontal","isInitLayout","isOriginLeft","isOriginTop","isResizeBound","itemSelector","rowHeight","transitionDuration"]},c=function(a,b,c,d,e){var f,g=[],h=function(a,b){for(var c=0;c",'
','
',"
"].join("")),a.put("template/packery/packery-object.html",'
')};angular.module("angular-packery",a).constant("packeryConfig",b).service("packeryService",["$rootScope","$q","$interval","$timeout","packeryConfig",c]).controller("PackeryController",["$rootScope","packeryConfig","packeryService",d]).directive("packery",["packeryConfig","packeryService",e]).directive("packeryObject",[f]).directive("packeryObject",[g]),angular.module("packeryTemplates",[]).run(["$templateCache",h])}(); +"use strict";!function(){var a=["packeryTemplates"],b={columnWidth:".packery-sizer",itemSelector:".packery-object",rowHeight:".packery-sizer",draggable:!0,handle:"*",timeout:2e3,acceptedAttributes:["containerStyle","columnWidth","gutter","isHorizontal","isInitLayout","isOriginLeft","isOriginTop","isResizeBound","itemSelector","rowHeight","transitionDuration"]},c=function(a,b,c,d,e){var f,g=[],h=function(a,b){for(var c=0;c','
','
',"
"].join("")),a.put("template/packery/packery-object.html",'
')};angular.module("angular-packery",a).constant("packeryConfig",b).service("packeryService",["$rootScope","$q","$interval","$timeout","packeryConfig",c]).controller("PackeryController",["$rootScope","packeryConfig","packeryService",d]).directive("packery",["packeryConfig","packeryService",e]).directive("packeryObject",[f]).directive("packeryObject",[g]),angular.module("packeryTemplates",[]).run(["$templateCache",h])}(); \ No newline at end of file diff --git a/package.json b/package.json index 60852da..8ee38b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-packery", - "version": "1.0.2", + "version": "1.0.3", "author": "http://github.com/sungard-labs/angular-packery/graphs/contributors", "homepage": "http://github.com/sungard-labs/angular-packery", "repository": {