Merge pull request #2528 from consul/budgets-message
Heading link on budgets message
This commit is contained in:
@@ -6,4 +6,10 @@ module BudgetHeadingsHelper
|
||||
end
|
||||
end
|
||||
|
||||
def heading_link(assigned_heading = nil, budget = nil)
|
||||
return nil unless assigned_heading && budget
|
||||
heading_path = budget_investments_path(budget, heading_id: assigned_heading.try(:id))
|
||||
link_to(assigned_heading.name, heading_path)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -208,11 +208,11 @@ class Budget
|
||||
end
|
||||
|
||||
def reason_for_not_being_ballotable_by(user, ballot)
|
||||
return permission_problem(user) if permission_problem?(user)
|
||||
return :not_selected unless selected?
|
||||
return :no_ballots_allowed unless budget.balloting?
|
||||
return :different_heading_assigned unless ballot.valid_heading?(heading)
|
||||
return :not_enough_money_html if ballot.present? && !enough_money?(ballot)
|
||||
return permission_problem(user) if permission_problem?(user)
|
||||
return :not_selected unless selected?
|
||||
return :no_ballots_allowed unless budget.balloting?
|
||||
return :different_heading_assigned_html unless ballot.valid_heading?(heading)
|
||||
return :not_enough_money_html if ballot.present? && !enough_money?(ballot)
|
||||
end
|
||||
|
||||
def permission_problem(user)
|
||||
|
||||
@@ -42,17 +42,25 @@
|
||||
|
||||
<% if reason.present? && !ballot.has_investment?(investment) %>
|
||||
|
||||
<div class="js-participation-not-allowed participation-not-allowed" style='display:none'>
|
||||
<div class="js-participation-not-allowed participation-not-allowed" style="display:none">
|
||||
|
||||
<% 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))%>
|
||||
|
||||
<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 %>
|
||||
<small>
|
||||
<%= t("budgets.ballots.reasons_for_not_balloting.#{reason}",
|
||||
verify_account: verify_account, signin: signin,
|
||||
signup: signup, my_heading: my_heading,
|
||||
change_ballot: change_ballot,
|
||||
heading_link: heading_link(@assigned_heading, @budget)).html_safe %>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -35,12 +35,9 @@
|
||||
<%= t("budgets.investments.index.by_heading", heading: @heading.name) %>
|
||||
</h2>
|
||||
<div class="small-12 medium-9">
|
||||
<div class="callout warning">
|
||||
<div class="callout warning margin-top">
|
||||
<%= t("budgets.investments.header.different_heading_assigned_html",
|
||||
heading_link: link_to(
|
||||
@assigned_heading.name,
|
||||
budget_investments_path(@budget, heading_id: @assigned_heading.try(:id)))
|
||||
) %>
|
||||
heading_link: heading_link(@assigned_heading, @budget)) %>
|
||||
<br>
|
||||
<small>
|
||||
<%= t("budgets.investments.header.change_ballot",
|
||||
|
||||
@@ -43,9 +43,7 @@
|
||||
<% elsif @assigned_heading.present? %>
|
||||
<p>
|
||||
<%= t("budgets.investments.index.sidebar.different_heading_assigned_html",
|
||||
heading_link: link_to(
|
||||
@assigned_heading.name,
|
||||
budget_investments_path(@budget, heading_id: @assigned_heading.try(:id)))
|
||||
heading_link: heading_link(@assigned_heading, @budget)
|
||||
) %>
|
||||
<br>
|
||||
<small>
|
||||
|
||||
@@ -29,11 +29,13 @@
|
||||
<% if reason.present? && !user_voted_for %>
|
||||
<div class="js-participation-not-allowed participation-not-allowed" style='display:none' aria-hidden="false">
|
||||
<p>
|
||||
<small>
|
||||
<%= t("votes.budget_investments.#{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)
|
||||
).html_safe %>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user