From dc82316f13907997f8c939f0a384d32317aef080 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Tue, 13 Dec 2011 20:30:06 -0800 Subject: [PATCH] bind Twipsy in stream_element_view.js --- app/views/templates/stream_element.ujs | 11 ++++----- public/javascripts/app/views/post_view.js | 30 +++++++++++++++++------ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/app/views/templates/stream_element.ujs b/app/views/templates/stream_element.ujs index 48cece618..de4bd2e37 100644 --- a/app/views/templates/stream_element.ujs +++ b/app/views/templates/stream_element.ujs @@ -2,12 +2,12 @@
<% if(author.id != current_user.id) { %> - - Ignoreuser + + Ignoreuser <% } %> - + @@ -57,7 +57,8 @@ - <% } %> - + + <%= public ? "Public" : "Limited" %> - @@ -90,8 +91,6 @@ <% } %> - - Comment diff --git a/public/javascripts/app/views/post_view.js b/public/javascripts/app/views/post_view.js index 96844c885..a72f0a1b1 100644 --- a/public/javascripts/app/views/post_view.js +++ b/public/javascripts/app/views/post_view.js @@ -9,21 +9,17 @@ App.Views.Post = App.Views.StreamObject.extend({ }, render: function() { - var self = this; this.el = $(this.template($.extend( this.model.toJSON(), App.user() )))[0]; - this.delegateEvents(); //we need this because we are explicitly setting this.el in this.render() - - this.$(".comments").html(new App.Views.CommentStream({ - model: this.model - }).render().el); - - this.renderPostContent(); + this.initializeTooltips() + .renderPostContent() + .renderComments(); this.$(".details time").timeago(); + this.delegateEvents(); //we need this because we are explicitly setting this.el in this.render() return this; }, @@ -38,6 +34,24 @@ App.Views.Post = App.Views.StreamObject.extend({ return this; }, + renderComments: function(){ + this.$(".comments").html(new App.Views.CommentStream({ + model: this.model + }).render().el); + + return this; + }, + + initializeTooltips: function(){ + $([ + this.$(".delete"), + this.$(".block_user"), + this.$(".post_scope") + ]).map(function() { this.twipsy(); }); + + return this; + }, + focusCommentTextarea: function(evt){ evt.preventDefault(); this.$(".new_comment_form_wrapper").removeClass("hidden");