improves message when not enough money

This commit is contained in:
decabeza
2017-05-26 17:12:21 +02:00
parent a49b206b42
commit 0e581896c0
5 changed files with 9 additions and 6 deletions

View File

@@ -145,7 +145,7 @@ class Budget
return :not_selected unless selected? return :not_selected unless selected?
return :no_ballots_allowed unless budget.balloting? return :no_ballots_allowed unless budget.balloting?
return :different_heading_assigned unless ballot.valid_heading?(heading) return :different_heading_assigned unless ballot.valid_heading?(heading)
return :not_enough_money if ballot.present? && !enough_money?(ballot) return :not_enough_money_html if ballot.present? && !enough_money?(ballot)
end end
def permission_problem(user) def permission_problem(user)

View File

@@ -50,8 +50,9 @@
signup: link_to(t("votes.signup"), new_user_registration_path), signup: link_to(t("votes.signup"), new_user_registration_path),
my_heading: link_to(investment.heading.name, my_heading: link_to(investment.heading.name,
budget_investments_path(budget_id: investment.budget_id, budget_investments_path(budget_id: investment.budget_id,
heading_id: investment.heading_id)) heading_id: investment.heading_id)),
).html_safe %> change_ballot: link_to(t("budgets.ballots.reasons_for_not_balloting.change_ballot"),
budget_ballot_path(@budget))).html_safe %>
</p> </p>
</div> </div>

View File

@@ -17,9 +17,10 @@ en:
not_verified: Only verified users can vote on investments; %{verify_account}. not_verified: Only verified users can vote on investments; %{verify_account}.
organization: Organizations are not permitted to vote organization: Organizations are not permitted to vote
not_selected: Unselected investment projects can not be supported not_selected: Unselected investment projects can not be supported
not_enough_money: "Price is higher than the available amount left." not_enough_money_html: "You have already assigned the available budget.<br><small>Remember you can %{change_ballot} at any time</small>"
no_ballots_allowed: Selecting phase is closed no_ballots_allowed: Selecting phase is closed
different_heading_assigned: You have already voted a different heading different_heading_assigned: You have already voted a different heading
change_ballot: change your votes
groups: groups:
show: show:
title: Select an option title: Select an option

View File

@@ -17,9 +17,10 @@ es:
not_verified: Las propuestas de inversión sólo pueden ser apoyadas por usuarios verificados, %{verify_account}. not_verified: Las propuestas de inversión sólo pueden ser apoyadas por usuarios verificados, %{verify_account}.
organization: Las organizaciones no pueden votar. organization: Las organizaciones no pueden votar.
not_selected: No se pueden votar propuestas inviables. not_selected: No se pueden votar propuestas inviables.
not_enough_money: No hay fondos suficientes. not_enough_money_html: "Ya has asignado el presupuesto disponible.<br><small>Recuerda que puedes %{change_ballot} en cualquier momento</small>"
no_ballots_allowed: El periodo de votación está cerrado. no_ballots_allowed: El periodo de votación está cerrado.
different_heading_assigned: Ya votaste en una sección distinta del presupuesto. different_heading_assigned: Ya votaste en una sección distinta del presupuesto.
change_ballot: cambiar tus votos
groups: groups:
show: show:
title: Selecciona una opción title: Selecciona una opción

View File

@@ -712,7 +712,7 @@ describe Budget::Investment do
ballot = create(:budget_ballot, user: user, budget: budget) ballot = create(:budget_ballot, user: user, budget: budget)
ballot.investments << inv1 ballot.investments << inv1
expect(inv2.reason_for_not_being_ballotable_by(user, ballot)).to eq(:not_enough_money) expect(inv2.reason_for_not_being_ballotable_by(user, ballot)).to eq(:not_enough_money_html)
end end
end end