diff --git a/app/assets/javascripts/votes.js.coffee b/app/assets/javascripts/votes.js.coffee index da3d55664..4ccfb2131 100644 --- a/app/assets/javascripts/votes.js.coffee +++ b/app/assets/javascripts/votes.js.coffee @@ -3,9 +3,11 @@ App.Votes = hoverize: (votes) -> $(votes).hover -> $("div.anonymous-votes", votes).show(); + $("div.organizations-votes", votes).show(); $("div.not-logged", votes).show(); , -> $("div.anonymous-votes", votes).hide(); + $("div.organizations-votes", votes).hide(); $("div.not-logged", votes).hide(); initialize: -> diff --git a/app/assets/stylesheets/debates.scss b/app/assets/stylesheets/debates.scss index a480f4870..2fe4a8383 100644 --- a/app/assets/stylesheets/debates.scss +++ b/app/assets/stylesheets/debates.scss @@ -135,7 +135,7 @@ } } - .anonymous-votes { + .anonymous-votes, .organizations-votes { background: $warning-bg; color: $warning-color; height: 100%; @@ -380,7 +380,7 @@ padding-top: rem-calc(36); } - .anonymous-votes { + .anonymous-votes, .organizations-votes { padding-top: rem-calc(24); } } diff --git a/app/helpers/cache_keys_helper.rb b/app/helpers/cache_keys_helper.rb index 088b45632..9aa6000cc 100644 --- a/app/helpers/cache_keys_helper.rb +++ b/app/helpers/cache_keys_helper.rb @@ -1,16 +1,20 @@ module CacheKeysHelper def locale_and_user_status @cache_key_user ||= calculate_user_status - "#{I18n.locale}/user:#{@cache_key_user}" + "#{I18n.locale}/#{@cache_key_user}" end def calculate_user_status - user_status = if user_signed_in? && current_user.verified_at.present? - "verified" - elsif user_signed_in? - "signed" + user_status = "user" + + if user_signed_in? + user_status += ":signed" + user_status += ":verified" if current_user.verified_at.present? + user_status += ":org" if current_user.organization? else - "visitor" + user_status += ":visitor" end + + user_status end end \ No newline at end of file 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 %> diff --git a/app/views/debates/_votes.html.erb b/app/views/debates/_votes.html.erb index 89d9313a1..e8aaf7d26 100644 --- a/app/views/debates/_votes.html.erb +++ b/app/views/debates/_votes.html.erb @@ -21,7 +21,13 @@ <%= t("debates.debate.votes", count: debate.total_votes) %> - <% if user_signed_in? && current_user.unverified? && !debate.votable_by?(current_user)%> + <% if user_signed_in? && current_user.organization? %> + + <% elsif user_signed_in? && current_user.unverified? && !debate.votable_by?(current_user)%>