From 574eb7b12ddf69faeebe36e13a9d2fcef4a7f31d Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Thu, 15 Dec 2011 23:17:39 -0800 Subject: [PATCH] removed App.Views.PostContent in lieu of StreamObject; moved some view logic to where it should be --- .../app/views/commment_stream_view.js | 7 +++++- .../app/views/post_content_view.js | 23 +++---------------- public/javascripts/app/views/post_view.js | 6 ----- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/public/javascripts/app/views/commment_stream_view.js b/public/javascripts/app/views/commment_stream_view.js index f2862e35a..345d8c1c7 100644 --- a/public/javascripts/app/views/commment_stream_view.js +++ b/public/javascripts/app/views/commment_stream_view.js @@ -1,6 +1,7 @@ App.Views.CommentStream = Backbone.View.extend({ events: { - "submit form": "createComment" + "submit form": "createComment", + "focus .comment_box": "commentTextareaFocused" }, initialize: function(options) { @@ -40,6 +41,10 @@ App.Views.CommentStream = Backbone.View.extend({ this.$("ul.comments").append(new App.Views.Comment({ model: comment }).render().el); + }, + + commentTextareaFocused: function(evt){ + this.$("form").removeClass('hidden').addClass("open"); } }); diff --git a/public/javascripts/app/views/post_content_view.js b/public/javascripts/app/views/post_content_view.js index 356720911..4c2ae3d32 100644 --- a/public/javascripts/app/views/post_content_view.js +++ b/public/javascripts/app/views/post_content_view.js @@ -1,28 +1,11 @@ -App.Views.PostContent = Backbone.View.extend({ - initialize: function(options) { - this.model = options.model; - this.template = _.template($(this.template_name).html()); - }, - - render: function() { - this.el = $(this.template($.extend( - this.model.toJSON(), - App.user() - ))); - - return this; - } -}); - - -App.Views.StatusMessage = App.Views.PostContent.extend({ +App.Views.StatusMessage = App.Views.StreamObject.extend({ template_name : "#status-message-template" }); -App.Views.Reshare = App.Views.PostContent.extend({ +App.Views.Reshare = App.Views.StreamObject.extend({ template_name : "#reshare-template" }); -App.Views.ActivityStreams__Photo = App.Views.PostContent.extend({ +App.Views.ActivityStreams__Photo = App.Views.StreamObject.extend({ template_name : "#activity-streams-photo-template" }); diff --git a/public/javascripts/app/views/post_view.js b/public/javascripts/app/views/post_view.js index eae8d6abf..e2ecabe80 100644 --- a/public/javascripts/app/views/post_view.js +++ b/public/javascripts/app/views/post_view.js @@ -4,7 +4,6 @@ App.Views.Post = App.Views.StreamObject.extend({ events: { "click .focus_comment_textarea": "focusCommentTextarea", - "focus .comment_box": "commentTextareaFocused", "click .shield a": "removeNsfwShield", "click .remove_post": "destroyModel", "click .like_action": "toggleLike", @@ -68,7 +67,6 @@ App.Views.Post = App.Views.StreamObject.extend({ if(link.hasClass('like')) { var like = this.model.likes.create(); if(like) { - console.log(like); this.model.set({ user_like : like, likes_count : post.get("likes_count") + 1 @@ -162,9 +160,5 @@ App.Views.Post = App.Views.StreamObject.extend({ this.$(".comment_box").focus(); return this; - }, - - commentTextareaFocused: function(evt){ - this.$("form").removeClass('hidden').addClass("open"); } });