removes links on debates and proposals to unlogged users

This commit is contained in:
Alberto Garcia Cabeza
2016-12-07 17:12:45 +01:00
parent 85c11ec81f
commit b865eba1ab
2 changed files with 54 additions and 26 deletions

View File

@@ -1,23 +1,41 @@
<% voted_classes = css_classes_for_vote(@debate_votes, debate) %>
<div class="votes">
<div class="in-favor inline-block">
<%= link_to vote_debate_path(debate, value: 'yes'),
class: "like #{voted_classes[:in_favor]}", title: t('votes.agree'), method: "post", remote: true do %>
<span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span>
</span>
<span class="percentage"><%= votes_percentage('likes', debate) %></span>
<% if user_signed_in? %>
<%= link_to vote_debate_path(debate, value: 'yes'),
class: "like #{voted_classes[:in_favor]}", title: t('votes.agree'), method: "post", remote: true do %>
<span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span>
</span>
<span class="percentage"><%= votes_percentage('likes', debate) %></span>
<% end %>
<% else %>
<div class="like">
<span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span>
</span>
<span class="percentage"><%= votes_percentage('likes', debate) %></span>
</div>
<% end %>
</div>
<span class="divider"></span>
<div class="against inline-block">
<%= link_to vote_debate_path(debate, value: 'no'), class: "unlike #{voted_classes[:against]}", title: t('votes.disagree'), method: "post", remote: true do %>
<span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span>
</span>
<span class="percentage"><%= votes_percentage('dislikes', debate) %></span>
<% if user_signed_in? %>
<%= link_to vote_debate_path(debate, value: 'no'), class: "unlike #{voted_classes[:against]}", title: t('votes.disagree'), method: "post", remote: true do %>
<span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span>
</span>
<span class="percentage"><%= votes_percentage('dislikes', debate) %></span>
<% end %>
<% else %>
<div class="unlike">
<span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span>
</span>
<span class="percentage"><%= votes_percentage('dislikes', debate) %></span>
</div>
<% end %>
</div>
@@ -39,10 +57,12 @@
</p>
</div>
<% elsif !user_signed_in? %>
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<%= t("votes.unauthenticated",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
<div tabindex="0">
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<%= t("votes.unauthenticated",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div>
</div>
<% end %>
</div>

View File

@@ -19,12 +19,16 @@
<div class="supported callout success">
<%= t("proposals.proposal.already_supported") %>
</div>
<% else %>
<% elsif user_signed_in? && proposal.votable_by?(current_user) %>
<%= link_to vote_url,
class: "button button-support small expanded",
title: t('proposals.proposal.support_title'), method: "post", remote: true do %>
<%= t("proposals.proposal.support") %>
<% end %>
<% else %>
<div class="button button-support small expanded">
<%= t("proposals.proposal.support") %>
</div>
<% end %>
</div>
@@ -34,18 +38,22 @@
<%= t("votes.organizations") %>
</p>
</div>
<% elsif user_signed_in? && !proposal.votable_by?(current_user)%>
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<p>
<%= t("votes.verified_only",
verify_account: link_to(t("votes.verify_account"), verification_path )).html_safe %>
</p>
<% elsif user_signed_in? && !proposal.votable_by?(current_user) %>
<div tabindex="0">
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<p>
<%= t("votes.verified_only",
verify_account: link_to(t("votes.verify_account"), verification_path )).html_safe %>
</p>
</div>
</div>
<% elsif !user_signed_in? %>
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<%= t("votes.unauthenticated",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
<div tabindex="0">
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<%= t("votes.unauthenticated",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div>
</div>
<% end %>