From 5c104350645271b465444c51a6363b59405da0db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Wed, 2 Sep 2015 12:23:56 +0200 Subject: [PATCH] disables voting on comments for not allowed users --- app/views/comments/_votes.html.erb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/views/comments/_votes.html.erb b/app/views/comments/_votes.html.erb index d7af65bff..495837af6 100644 --- a/app/views/comments/_votes.html.erb +++ b/app/views/comments/_votes.html.erb @@ -3,17 +3,25 @@  |  - <%= link_to vote_comment_path(comment, value: 'yes'), - method: "post", remote: true do %> - + <% if can?(:vote, comment) %> + <%= link_to vote_comment_path(comment, value: 'yes'), + method: "post", remote: true do %> + + <% end %> + <% else %> + <% end %> <%= comment.total_likes %> - <%= link_to vote_comment_path(comment, value: 'no'), - method: "post", remote: true do %> - + <% if can?(:vote, comment) %> + <%= link_to vote_comment_path(comment, value: 'no'), + method: "post", remote: true do %> + + <% end %> + <% else %> + <% end %> <%= comment.total_dislikes %>