Permalink
Browse files

Don't break layout after adding a bookmark

  • Loading branch information...
1 parent d9db853 commit fa8aac9d290596da866b976ee7e6286cd66aaa72 @dangrossman committed Feb 9, 2012
Showing with 5 additions and 3 deletions.
  1. +4 −1 public/js/views/BookmarksView.js
  2. +1 −2 public/js/views/EditView.js
@@ -5,6 +5,8 @@ var BookmarksView = Backbone.View.extend({
this.collection = new BookmarksCollection();
this.collection.bind('reset', this.render, this);
+ this.collection.bind('add', this.render, this);
+
},
fetch: function(options) {
@@ -24,7 +26,8 @@ var BookmarksView = Backbone.View.extend({
$(window).scroll(function() { self.scroll(); });
}
- $('#app').append(this.el);
+ $(this.el).masonry('destroy');
+ $('#app').html('').append(this.el);
if (this.search == false && this.collection.models.length == 0) {
@@ -54,7 +54,6 @@ var EditView = Backbone.View.extend({
if (this.model.isNew()) {
App.router.view.body.collection.add(this.model, { at: 0 });
- App.router.view.body.render();
} else {
$(App.router.view.body.el).masonry('reload');
}
@@ -67,4 +66,4 @@ var EditView = Backbone.View.extend({
this.unrender();
}
-});
+});

0 comments on commit fa8aac9

Please sign in to comment.