Merge pull request #1568 from consul/budgets-message

Budgets message
This commit is contained in:
Juanjo Bazán
2017-05-26 17:45:53 +02:00
committed by GitHub
9 changed files with 41 additions and 16 deletions

View File

@@ -206,9 +206,9 @@
.participation-not-allowed {
background: $warning-bg;
color: $color-warning;
height: 100%;
left: 0;
line-height: $line-height;
min-height: 100%;
padding: $line-height $line-height/2;
position: absolute;
text-align: center;

View File

@@ -145,7 +145,7 @@ class Budget
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 if ballot.present? && !enough_money?(ballot)
return :not_enough_money_html if ballot.present? && !enough_money?(ballot)
end
def permission_problem(user)

View File

@@ -50,8 +50,9 @@
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))
).html_safe %>
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>

View File

@@ -42,6 +42,12 @@
@assigned_heading.name,
budget_investments_path(@budget, heading_id: @assigned_heading.try(:id)))
) %>
<br>
<small>
<%= t("budgets.investments.header.change_ballot",
check_ballot: link_to(t("budgets.investments.header.check_ballot_link"),
budget_ballot_path(@budget))).html_safe %>
</small>
</div>
</div>
<% end %>

View File

@@ -41,11 +41,19 @@
</em>
</p>
<% elsif @assigned_heading.present? %>
<p><%= t("budgets.investments.index.sidebar.different_heading_assigned_html",
<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)))
) %></p>
) %>
<br>
<small>
<%= t("budgets.investments.index.sidebar.change_ballot",
check_ballot: link_to(t("budgets.investments.index.sidebar.check_ballot_link"),
budget_ballot_path(@budget))).html_safe %>
</small>
</p>
<% else %>
<p><strong><%= t("budgets.investments.index.sidebar.zero") %></strong></p>
<% end %>

View File

@@ -17,9 +17,10 @@ en:
not_verified: Only verified users can vote on investments; %{verify_account}.
organization: Organizations are not permitted to vote
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
different_heading_assigned: You have already voted a different heading
change_ballot: change your votes
groups:
show:
title: Select an option
@@ -64,6 +65,8 @@ en:
voted_info: You can %{link} at any time until the close of this phase. No need to spend all the money available.
voted_info_link: change your vote
different_heading_assigned_html: "You have active votes in another heading: %{heading_link}"
change_ballot: "If your change your mind you can remove your votes in %{check_ballot} and start again."
check_ballot_link: "check my ballot"
zero: You have not voted any investment project in this group.
verified_only: "To create a new budget investment %{verify}."
verify_account: "verify your account"
@@ -106,6 +109,8 @@ en:
header:
check_ballot: Check my ballot
different_heading_assigned_html: "You have active votes in another heading: %{heading_link}"
change_ballot: "If your change your mind you can remove your votes in %{check_ballot} and start again."
check_ballot_link: "check my ballot"
progress_bar:
available: "Available: "
show:

View File

@@ -17,9 +17,10 @@ es:
not_verified: Las propuestas de inversión sólo pueden ser apoyadas por usuarios verificados, %{verify_account}.
organization: Las organizaciones no pueden votar.
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.
different_heading_assigned: Ya votaste en una sección distinta del presupuesto.
change_ballot: cambiar tus votos
groups:
show:
title: Selecciona una opción
@@ -64,6 +65,8 @@ es:
voted_info: Puedes %{link} en cualquier momento hasta el cierre de esta fase. No hace falta que gastes todo el dinero disponible.
voted_info_link: cambiar tus votos
different_heading_assigned_html: "Ya apoyaste propuestas de otra sección del presupuesto: %{heading_link}"
change_ballot: "Si cambias de opinión puedes borrar tus votos en %{check_ballot} y volver a empezar."
check_ballot_link: "revisar mis votos"
zero: "Todavía no has votado ninguna propuesta de inversión en este ámbito del presupuesto."
verified_only: "Para crear una nueva propuesta de inversión %{verify}."
verify_account: "verifica tu cuenta"
@@ -106,6 +109,8 @@ es:
header:
check_ballot: Revisar mis votos
different_heading_assigned_html: "Ya apoyaste propuestas de otra sección del presupuesto: %{heading_link}"
change_ballot: "Si cambias de opinión puedes borrar tus votos en %{check_ballot} y volver a empezar."
check_ballot_link: "revisar mis votos"
progress_bar:
available: "Disponible: "
show:

View File

@@ -536,7 +536,7 @@ feature 'Ballots' do
within("#budget_investment_#{bi2.id}") do
find("div.ballot").hover
expect(page).to have_content('Price is higher than the available amount left')
expect(page).to have_content('You have already assigned the available budget')
expect(page).to have_selector('.in-favor a', visible: false)
end
end
@@ -550,7 +550,7 @@ feature 'Ballots' do
within("#budget_investment_#{bi1.id}") do
find("div.ballot").hover
expect(page).to_not have_content('Price is higher than the available amount left')
expect(page).to_not have_content('You have already assigned the available budget')
expect(page).to have_selector('.in-favor a', visible: true)
end
@@ -558,7 +558,7 @@ feature 'Ballots' do
within("#budget_investment_#{bi2.id}") do
find("div.ballot").trigger("mouseover")
expect(page).to have_content('Price is higher than the available amount left')
expect(page).to have_content('You have already assigned the available budget')
expect(page).to have_selector('.in-favor a', visible: false)
end
@@ -576,7 +576,7 @@ feature 'Ballots' do
within("#budget_investment_#{bi2.id}") do
find("div.ballot").hover
expect(page).to have_content('Price is higher than the available amount left')
expect(page).to have_content('You have already assigned the available budget')
expect(page).to have_selector('.in-favor a', visible: false)
end
@@ -587,7 +587,7 @@ feature 'Ballots' do
within("#budget_investment_#{bi2.id}") do
find("div.ballot").hover
expect(page).to_not have_content('Price is higher than the available amount left')
expect(page).to_not have_content('You have already assigned the available budget')
expect(page).to have_selector('.in-favor a', visible: true)
end
end
@@ -604,7 +604,7 @@ feature 'Ballots' do
within("#budget_investment_#{bi2.id}") do
find("div.ballot").hover
expect(page).to have_content('Price is higher than the available amount left')
expect(page).to have_content('You have already assigned the available budget')
expect(page).to have_selector('.in-favor a', visible: false)
end
@@ -616,7 +616,7 @@ feature 'Ballots' do
within("#budget_investment_#{bi2.id}") do
find("div.ballot").hover
expect(page).to_not have_content('Price is higher than the available amount left')
expect(page).to_not have_content('You have already assigned the available budget')
expect(page).to have_selector('.in-favor a', visible: true)
end
end

View File

@@ -712,7 +712,7 @@ describe Budget::Investment do
ballot = create(:budget_ballot, user: user, budget: budget)
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