Files
grecia/app/views/budgets/investments/_ballot.html.erb
2017-05-26 17:12:21 +02:00

61 lines
2.5 KiB
Plaintext

<% reason = investment.reason_for_not_being_ballotable_by(current_user, ballot) %>
<div class="js-participation supports ballot">
<% if ballot.has_investment?(investment) %>
<div class="remove supported inline-block">
<span class="icon-check-circle"
title="<%= t("budgets.investments.investment.already_added") %>">
</span>
<p class="investment-project-amount">
<%= investment.formatted_price %>
</p>
<% if investment.should_show_ballots? %>
<%= link_to t('budgets.ballots.show.remove'),
budget_ballot_line_path(id: investment.id,
budget_id: investment.budget_id,
investments_ids: investment_ids),
class: "delete small expanded",
method: :delete,
remote: true %>
<% end %>
</div>
<% else %>
<div class="add in-favor">
<p class="investment-project-amount">
<%= investment.formatted_price %>
</p>
<% if investment.should_show_ballots? %>
<%= link_to t("budgets.investments.investment.add"),
budget_ballot_lines_url(investment_id: investment.id,
budget_id: investment.budget_id,
investments_ids: investment_ids),
class: "button button-support small expanded",
title: t('budgets.investments.investment.support_title'),
method: :post,
remote: true %>
<% end %>
</div>
<% end %>
<% if reason.present? && !ballot.has_investment?(investment) %>
<div class="js-participation-not-allowed participation-not-allowed" style='display:none'>
<p>
<%= t("budgets.ballots.reasons_for_not_balloting.#{reason}",
verify_account: link_to(t("votes.verify_account"), verification_path),
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path),
my_heading: link_to(investment.heading.name,
budget_investments_path(budget_id: investment.budget_id,
heading_id: investment.heading_id)),
change_ballot: link_to(t("budgets.ballots.reasons_for_not_balloting.change_ballot"),
budget_ballot_path(@budget))).html_safe %>
</p>
</div>
<% end %>
</div>