show feedback for posts on their show pages if user is not logged in.

This commit is contained in:
danielgrippi 2012-02-27 14:49:13 -08:00
parent 0112285985
commit 278c7ee0c4
4 changed files with 15 additions and 8 deletions

View file

@ -1,4 +1,4 @@
<a href="#" class="label like" title="{{#if user_like}} Unlike {{else}} Like {{/if}}">
<a href="#" rel="auth-required" class="label like" title="{{#if user_like}} Unlike {{else}} Like {{/if}}">
{{#if user_like}}
<i class="icon-heart icon-red"></i>
{{else}}
@ -7,7 +7,7 @@
{{likes_count}}
</a>
<a href="#" class="label follow" title="{{#if user_participation}} Stop Following {{else}} Follow {{/if}} Post">
<a href="#" rel="auth-required" class="label follow" title="{{#if user_participation}} Stop Following {{else}} Follow {{/if}} Post">
{{#if user_participation}}
<i class="icon-plus icon-green"></i>
{{else}}
@ -17,7 +17,7 @@
</a>
{{#if userCanReshare}}
<a href="#" class="label reshare" title="{{#if user_reshare}} Reshared {{else}} Reshare {{/if}}">
<a href="#" rel="auth-required" class="label reshare" title="{{#if user_reshare}} Reshared {{else}} Reshare {{/if}}">
{{#if user_reshare}}
<i class="icon-retweet icon-blue"></i>
{{else}}

View file

@ -5,9 +5,9 @@ app.views.Feedback = app.views.Base.extend({
className : "info",
events: {
"click .like_action": "toggleLike",
"click .participate_action": "toggleFollow",
"click .reshare_action": "resharePost"
"click .like_action" : "toggleLike",
"click .participate_action" : "toggleFollow",
"click .reshare_action" : "resharePost"
},
initialize : function() {

View file

@ -6,6 +6,8 @@ app.views.PostViewerFeedback = app.views.Feedback.extend({
templateName: "post-viewer/feedback",
events : {
"click *[rel='auth-required']" : "requireAuth",
"click .like" : "toggleLike",
"click .follow" : "toggleFollow",
"click .reshare" : "resharePost",
@ -27,6 +29,11 @@ app.views.PostViewerFeedback = app.views.Feedback.extend({
},
invokePane : function(evt){ this.trigger("invokePane") },
hidePane : function(evt){ this.trigger("hidePane") }
hidePane : function(evt){ this.trigger("hidePane") },
requireAuth : function(evt) {
alert("you must be logged in to do that!")
return false;
}
})

View file

@ -21,8 +21,8 @@ app.views.PostViewerInteractions = app.views.Base.extend({
this.reactionsView = new app.views.PostViewerReactions({ model : this.model })
/* subviews that require user */
this.feedbackView = new app.views.PostViewerFeedback({ model : this.model })
if(app.currentUser.authenticated()) {
this.feedbackView = new app.views.PostViewerFeedback({ model : this.model })
this.newCommentView = new app.views.PostViewerNewComment({ model : this.model })
}
},