fixes styles when support a proposal

This commit is contained in:
Alberto Garcia Cabeza
2016-12-07 17:23:30 +01:00
parent b865eba1ab
commit 23d6eb3067
2 changed files with 69 additions and 65 deletions

View File

@@ -53,20 +53,22 @@
</div> </div>
<div id="<%= dom_id(proposal) %>_votes" class="small-12 medium-3 column supports-container"> <div id="<%= dom_id(proposal) %>_votes" class="small-12 medium-3 column supports-container">
<div class="supports text-center"> <% if proposal.successfull? %>
<% if proposal.successfull? %> <div class="padding text-center">
<p> <p>
<%= t("proposal_ballots.successfull", <%= t("proposal_ballots.successfull",
voting: link_to(t("proposal_ballots.voting"), proposal_ballots_path)).html_safe %> voting: link_to(t("proposal_ballots.voting"), proposal_ballots_path)).html_safe %>
</p> </p>
<% elsif proposal.archived? %> </div>
<% elsif proposal.archived? %>
<div class="padding text-center">
<strong><%= t("proposals.proposal.supports", count: proposal.total_votes) %></strong> <strong><%= t("proposals.proposal.supports", count: proposal.total_votes) %></strong>
<p><%= t("proposals.proposal.archived") %></p> <p><%= t("proposals.proposal.archived") %></p>
<% else %> </div>
<%= render 'votes', <% else %>
{ proposal: proposal, vote_url: vote_proposal_path(proposal, value: 'yes') } %> <%= render 'votes',
<% end %> { proposal: proposal, vote_url: vote_proposal_path(proposal, value: 'yes') } %>
</div> <% end %>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,64 +1,66 @@
<div class="progress small-12 round"> <div class="supports text-center">
<span class="meter" style="width: <%= progress_bar_percentage(proposal) %>%;"></span> <div class="progress small-12 round">
<span class="percentage"> <span class="meter" style="width: <%= progress_bar_percentage(proposal) %>%;"></span>
<%= supports_percentage(proposal) %>&nbsp;/&nbsp;<%= t("proposals.proposal.total_percent") %> <span class="percentage">
</span> <%= supports_percentage(proposal) %>&nbsp;/&nbsp;<%= t("proposals.proposal.total_percent") %>
</div> </span>
</div>
<span class="total-supports"> <span class="total-supports">
<%= t("proposals.proposal.supports", count: proposal.total_votes) %>&nbsp; <%= t("proposals.proposal.supports", count: proposal.total_votes) %>&nbsp;
<span> <span>
<abbr title="<%= t("proposals.proposal.reason_for_supports_necessary") %>"> <abbr title="<%= t("proposals.proposal.reason_for_supports_necessary") %>">
<%= t("proposals.proposal.supports_necessary", number: number_with_delimiter(Proposal.votes_needed_for_success)) %> <%= t("proposals.proposal.supports_necessary", number: number_with_delimiter(Proposal.votes_needed_for_success)) %>
</abbr> </abbr>
</span>
</span> </span>
</span>
<div class="in-favor"> <div class="in-favor">
<% if voted_for?(@proposal_votes, proposal) %> <% if voted_for?(@proposal_votes, proposal) %>
<div class="supported callout success"> <div class="supported callout success">
<%= t("proposals.proposal.already_supported") %> <%= t("proposals.proposal.already_supported") %>
</div> </div>
<% elsif user_signed_in? && proposal.votable_by?(current_user) %> <% elsif user_signed_in? && proposal.votable_by?(current_user) %>
<%= link_to vote_url, <%= link_to vote_url,
class: "button button-support small expanded", class: "button button-support small expanded",
title: t('proposals.proposal.support_title'), method: "post", remote: true do %> title: t('proposals.proposal.support_title'), method: "post", remote: true do %>
<%= t("proposals.proposal.support") %> <%= t("proposals.proposal.support") %>
<% end %>
<% else %>
<div class="button button-support small expanded">
<%= t("proposals.proposal.support") %>
</div>
<% end %> <% end %>
<% else %> </div>
<div class="button button-support small expanded">
<%= t("proposals.proposal.support") %> <% if user_signed_in? && current_user.organization? %>
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<p>
<%= t("votes.organizations") %>
</p>
</div>
<% 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 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 %>
<% if voted_for?(@proposal_votes, proposal) && setting['twitter_handle'] %>
<div class="share-supported">
<%= social_share_button_tag("#{proposal.title} #{setting['twitter_hashtag']}", url: proposal_url(proposal), via: setting['twitter_handle']) %>
</div> </div>
<% end %> <% end %>
</div> </div>
<% if user_signed_in? && current_user.organization? %>
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<p>
<%= t("votes.organizations") %>
</p>
</div>
<% 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 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 %>
<% if voted_for?(@proposal_votes, proposal) && setting['twitter_handle'] %>
<div class="share-supported">
<%= social_share_button_tag("#{proposal.title} #{setting['twitter_hashtag']}", url: proposal_url(proposal), via: setting['twitter_handle']) %>
</div>
<% end %>