Hide SPV controls unless authenticated

* cleaned and removed dead code

refs diaspora/diaspora#4711
This commit is contained in:
Lukas Matt 2014-06-16 10:18:47 -04:00
parent f23fb6b6cb
commit dec7ef667e
3 changed files with 31 additions and 35 deletions

View file

@ -4,7 +4,6 @@ app.views.Feedback = app.views.Base.extend({
className : "info", className : "info",
events: { events: {
"click *[rel='auth-required']" : "requireAuth",
"click .like" : "toggleLike", "click .like" : "toggleLike",
"click .reshare" : "resharePost", "click .reshare" : "resharePost",
"click .post_report" : "report" "click .post_report" : "report"
@ -39,11 +38,5 @@ app.views.Feedback = app.views.Base.extend({
if(evt) { evt.preventDefault(); } if(evt) { evt.preventDefault(); }
if(!window.confirm(Diaspora.I18n.t("reshares.post", {name: this.model.reshareAuthor().name}))) { return } if(!window.confirm(Diaspora.I18n.t("reshares.post", {name: this.model.reshareAuthor().name}))) { return }
this.model.interactions.reshare(); this.model.interactions.reshare();
},
requireAuth : function(evt) {
if( app.currentUser.authenticated() ) { return }
alert("you must be logged in to do that!")
return false;
} }
}); });

View file

@ -7,14 +7,16 @@
<div class="bd"> <div class="bd">
<div class="controls"> <div class="controls">
{{#if canRemove}} {{#if loggedIn}}
<a href="#" class="delete comment_delete" title="{{t "delete"}}"> {{#if canRemove}}
<div alt="Deletelabel" class="icons-deletelabel" /> <a href="#" class="delete comment_delete" title="{{t "delete"}}">
<a/> <div alt="Deletelabel" class="icons-deletelabel" />
{{else}} <a/>
<a href="#" data-type="comment" class="comment_report" title="{{t "report.name"}}"> {{else}}
<div class="icons-report"/> <a href="#" data-type="comment" class="comment_report" title="{{t "report.name"}}">
</a> <div class="icons-report"/>
</a>
{{/if}}
{{/if}} {{/if}}
</div> </div>

View file

@ -1,30 +1,31 @@
<div class='pull-right'> <div class='pull-right'>
<a href="#" rel="auth-required" class="like" title="{{#if userLike}} {{t "viewer.unlike"}} {{else}} {{t "viewer.like"}} {{/if}}"> {{#if loggedIn}}
{{#if userLike}} <a href="#" class="like" title="{{#if userLike}} {{t "viewer.unlike"}} {{else}} {{t "viewer.like"}} {{/if}}">
<i class="entypo heart red large"></i> {{#if userLike}}
{{else}} <i class="entypo heart red large"></i>
<i class="entypo heart gray large"></i> {{else}}
{{/if}} <i class="entypo heart gray large"></i>
{{/if}}
</a> </a>
<a href="#" rel="auth-required" class="focus-comment" title="{{t "viewer.comment"}}"> <a href="#" class="focus-comment" title="{{t "viewer.comment"}}">
<i class="entypo comment gray large"></i> <i class="entypo comment gray large"></i>
</a> </a>
{{#if userCanReshare}} {{#if userCanReshare}}
<a href="#" rel="auth-required" class="reshare" title="{{t "viewer.reshare"}}"> <a href="#" class="reshare" title="{{t "viewer.reshare"}}">
<i class="entypo retweet gray large"></i> <i class="entypo retweet gray large"></i>
</a> </a>
{{else}} {{else}}
{{#if userReshare}} {{#if userReshare}}
<a href="#" rel="auth-required" class="reshare-viewonly" title="{{t "viewer.reshared"}}"> <a href="#" class="reshare-viewonly" title="{{t "viewer.reshared"}}">
<i class="entypo retweet blue large"></i> <i class="entypo retweet blue large"></i>
</a> </a>
{{/if}} {{/if}}
{{/if}} {{/if}}
<a href="#" rel="auth-required" data-type="post" class="post_report" title="{{t "report.name"}}"> <a href="#" data-type="post" class="post_report" title="{{t "report.name"}}">
<i class="entypo gray large">&#x21;</i> <i class="entypo gray large">&#x21;</i>
</a> </a>
</div> {{/if}}
</div> </div>