Skip to content
This repository has been archived by the owner on Dec 30, 2018. It is now read-only.

Commit

Permalink
v0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
passy committed Mar 2, 2014
1 parent bedcacc commit f4c6ff2
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 14 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<a name="0.8.0"></a>
## 0.8.0 (2014-03-02)


#### Bug Fixes

* **directive:**
* re-layout on masonry.reload ([a522364e](passy/angular-masonry/commit/a522364e087c826e735a5e2ef7924ae76efe33e1))
* allow overriding of options ([676823c6](passy/angular-masonry/commit/676823c6444019487c774df44a49199de568f073))


<a name="v0.7.0"></a>
## v0.7.0 (2013-12-09)

Expand Down
6 changes: 1 addition & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ module.exports = function (grunt) {
autoWatch: true
}
},
changelog: {
options: {
github: 'passy/angular-masonry'
}
},
changelog: {},
ngmin: {
dist: {
src: '<%= pkg.name %>.js',
Expand Down
27 changes: 20 additions & 7 deletions angular-masonry.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
var destroyed = false;
var self = this;
var timeout = null;
this.preserveOrder = false;
this.scheduleMasonryOnce = function scheduleMasonryOnce() {
var args = arguments;
var found = schedule.filter(function filterFn(item) {
Expand Down Expand Up @@ -46,14 +47,23 @@
$element.masonry('resize');
}
if (bricks[id] === undefined) {
defaultLoaded(element);
bricks[id] = true;
defaultLoaded(element);
$element.masonry('appended', element, true);
self.scheduleMasonryOnce('reloadItems');
self.scheduleMasonryOnce('layout');
}
}
element.imagesLoaded(_append);
function _layout() {
self.scheduleMasonryOnce('layout');
}
if (self.preserveOrder) {
_append();
element.imagesLoaded(_layout);
} else {
element.imagesLoaded(function imagesLoaded() {
_append();
_layout();
});
}
};
this.removeBrick = function removeBrick(id, element) {
if (destroyed) {
Expand Down Expand Up @@ -83,11 +93,13 @@
link: {
pre: function preLink(scope, element, attrs, ctrl) {
var attrOptions = scope.$eval(attrs.masonry || attrs.masonryOptions);
var options = angular.extend(attrOptions || {}, {
var options = angular.extend({
itemSelector: attrs.itemSelector || '.masonry-brick',
columnWidth: parseInt(attrs.columnWidth, 10)
});
}, attrOptions || {});
element.masonry(options);
var preserveOrder = scope.$eval(attrs.preserveOrder);
ctrl.preserveOrder = preserveOrder !== false && attrs.preserveOrder !== undefined;
scope.$emit('masonry.created', element);
scope.$on('$destroy', ctrl.destroy);
}
Expand All @@ -106,7 +118,8 @@
ctrl.removeBrick(id, element);
});
scope.$on('masonry.reload', function () {
ctrl.reload();
ctrl.scheduleMasonryOnce('reloadItems');
ctrl.scheduleMasonryOnce('layout');
});
scope.$watch('$index', function () {
if (index !== undefined && index !== scope.$index) {
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "angular-masonry",
"description": "An AngularJS directive for Masonry.",
"version": "0.7.0",
"version": "0.8.0",
"main": "./angular-masonry.js",
"ignore": [
"**/.*",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-masonry",
"version": "0.7.0",
"version": "0.8.0",
"devDependencies": {
"grunt-contrib-uglify": "~0.4.0",
"grunt": "~0.4.1",
Expand Down

0 comments on commit f4c6ff2

Please sign in to comment.