From 31d24c60c723fb3cfafdf27d2cf55eda65bd478d Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Sun, 18 Dec 2011 18:30:05 -0800 Subject: [PATCH] added spec for .like_action link being rendered; added comments div back to stream_element for now --- app/views/templates/feedback.ujs | 16 +++++++--------- app/views/templates/stream_element.ujs | 1 + public/javascripts/app/views/post_view.js | 13 ++++++++++++- spec/javascripts/app/views/post_view_spec.js | 7 +++++++ 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/app/views/templates/feedback.ujs b/app/views/templates/feedback.ujs index bded74e90..a22ea33b1 100644 --- a/app/views/templates/feedback.ujs +++ b/app/views/templates/feedback.ujs @@ -1,13 +1,11 @@
- <% if(like) { %> - - <% } else { %> - - <% } %> + ยท + + + Comment +
diff --git a/app/views/templates/stream_element.ujs b/app/views/templates/stream_element.ujs index aeb91c8e5..1aebed96c 100644 --- a/app/views/templates/stream_element.ujs +++ b/app/views/templates/stream_element.ujs @@ -47,6 +47,7 @@ <% } %>
+
diff --git a/public/javascripts/app/views/post_view.js b/public/javascripts/app/views/post_view.js index abc0ee614..3154197d6 100644 --- a/public/javascripts/app/views/post_view.js +++ b/public/javascripts/app/views/post_view.js @@ -11,11 +11,14 @@ App.Views.Post = App.Views.StreamObject.extend({ }, render: function() { + // subview rendering this.renderTemplate() - .initializeTooltips() .renderPostContent() + .renderFeedback() .renderComments(); + // + this.initializeTooltips(); this.$(".details time").timeago(); return this; @@ -39,6 +42,14 @@ App.Views.Post = App.Views.StreamObject.extend({ return this; }, + renderFeedback: function(){ + this.$(".feedback").html(new App.Views.Feedback({ + model: this.model + }).render().el); + + return this; + }, + removeNsfwShield: function(evt){ if(evt){ evt.preventDefault(); } diff --git a/spec/javascripts/app/views/post_view_spec.js b/spec/javascripts/app/views/post_view_spec.js index 11ff8f56c..1bab5dcc8 100644 --- a/spec/javascripts/app/views/post_view_spec.js +++ b/spec/javascripts/app/views/post_view_spec.js @@ -11,6 +11,13 @@ describe("App.views.Post", function(){ this.statusMessage = this.collection.models[0]; }) + it("contains a '.like_action' link", function(){ + var view = new App.Views.Post({model : this.statusMessage}).render(); + var statusElement = $(view.el); + + expect(statusElement.find(".like_action").html()).not.toBeNull(); + }) + context("NSFW", function(){ it("contains a shield element", function(){ this.statusMessage.set({text : "this is safe for work. #sfw"});