From 10117b81b309c82ff5c27605fa79a747d1790f58 Mon Sep 17 00:00:00 2001 From: Lukas Matt Date: Tue, 17 Jun 2014 12:23:54 -0400 Subject: [PATCH] Hide report icon on SPV if author is current user --- .../views/single-post-viewer/single_post_actions.js | 10 ++++++++++ .../single-post-viewer/single-post-actions_tpl.jst.hbs | 10 ++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/app/views/single-post-viewer/single_post_actions.js b/app/assets/javascripts/app/views/single-post-viewer/single_post_actions.js index eebd39327..8dbce4adb 100644 --- a/app/assets/javascripts/app/views/single-post-viewer/single_post_actions.js +++ b/app/assets/javascripts/app/views/single-post-viewer/single_post_actions.js @@ -7,6 +7,12 @@ app.views.SinglePostActions = app.views.Feedback.extend({ }, app.views.Feedback.prototype.events); }, + presenter: function() { + return _.extend(this.defaultPresenter(), { + authorIsNotCurrentUser : this.authorIsNotCurrentUser(), + }) + }, + renderPluginWidgets : function() { app.views.Base.prototype.renderPluginWidgets.apply(this); this.$('a').tooltip({placement: 'bottom'}); @@ -16,6 +22,10 @@ app.views.SinglePostActions = app.views.Feedback.extend({ $('.comment_stream .comment_box').focus(); $('html,body').animate({scrollTop: $('.comment_stream .comment_box').offset().top - ($('.comment_stream .comment_box').height() + 20)}); return false; + }, + + authorIsNotCurrentUser: function() { + return app.currentUser.authenticated() && this.model.get("author").id != app.user().id } }); diff --git a/app/assets/templates/single-post-viewer/single-post-actions_tpl.jst.hbs b/app/assets/templates/single-post-viewer/single-post-actions_tpl.jst.hbs index be1bec2c8..908c2d4ab 100644 --- a/app/assets/templates/single-post-viewer/single-post-actions_tpl.jst.hbs +++ b/app/assets/templates/single-post-viewer/single-post-actions_tpl.jst.hbs @@ -23,9 +23,11 @@ {{/if}} {{/if}} - - - ! - + + {{#if authorIsNotCurrentUser}} + + ! + + {{/if}} {{/if}}