diff --git a/app/assets/javascripts/app/views/canvas_frame.js b/app/assets/javascripts/app/views/canvas_frame.js index 5f8ab9589..fd471a4e1 100644 --- a/app/assets/javascripts/app/views/canvas_frame.js +++ b/app/assets/javascripts/app/views/canvas_frame.js @@ -5,6 +5,12 @@ app.views.CanvasFrame = app.views.SmallFrame.extend({ SINGLE_COLUMN_WIDTH : 265, DOUBLE_COLUMN_WIDTH : 560, + events : { + "click .info" : "goToPost", // the only event copied from SmallFrame + "click .content" : "favoritePost", + "click .delete" : "killPost" + }, + adjustedImageHeight : function() { if(!(this.model.get("photos") || [])[0]) { return } @@ -29,5 +35,30 @@ app.views.CanvasFrame = app.views.SmallFrame.extend({ return _.extend(this.smallFramePresenter(), { adjustedImageHeight : this.adjustedImageHeight() }) + }, + + favoritePost : function(evt) { + if(evt) { + /* follow links instead of faving the targeted post */ + if($(evt.target).is('a')) { return } + + evt.stopImmediatePropagation(); evt.preventDefault(); + } + + var prevDimension = this.dimensionsClass(); + + this.model.toggleFavorite({save : this.model.get("author").diaspora_id == app.currentUser.get("diaspora_id")}) + + this.$el.removeClass(prevDimension) + this.render() + + app.page.stream.trigger("reLayout") + //trigger moar relayouts in the case of images WHOA GROSS HAX + _.delay(function(){app.page.stream.trigger("reLayout")}, 200) + }, + + killPost : function(){ + this.destroyModel() + _.delay(function(){app.page.stream.trigger("reLayout")}, 0) } }); diff --git a/app/assets/javascripts/app/views/small_frame.js b/app/assets/javascripts/app/views/small_frame.js index 6aa8b31ef..8a5825b26 100644 --- a/app/assets/javascripts/app/views/small_frame.js +++ b/app/assets/javascripts/app/views/small_frame.js @@ -6,8 +6,6 @@ app.views.SmallFrame = app.views.Post.extend({ templateName : "small-frame/default", // default to fall back to events : { - "click .content" : "favoritePost", - "click .delete" : "killPost", "click .info" : "goToPost" }, @@ -70,31 +68,6 @@ app.views.SmallFrame = app.views.Post.extend({ return (this.model.get("favorite")) ? "x2 width height" : "" }, - favoritePost : function(evt) { - if(evt) { - /* follow links instead of faving the targeted post */ - if($(evt.target).is('a')) { return } - - evt.stopImmediatePropagation(); evt.preventDefault(); - } - - var prevDimension = this.dimensionsClass(); - - this.model.toggleFavorite({save : this.model.get("author").diaspora_id == app.currentUser.get("diaspora_id")}) - - this.$el.removeClass(prevDimension) - this.render() - - app.page.stream.trigger("reLayout") - //trigger moar relayouts in the case of images WHOA GROSS HAX - _.delay(function(){app.page.stream.trigger("reLayout")}, 200) - }, - - killPost : function(){ - this.destroyModel() - _.delay(function(){app.page.stream.trigger("reLayout")}, 0) - }, - goToPost : function(evt) { if(evt) { evt.stopImmediatePropagation(); } app.setPreload('post',this.model.attributes)