+
+ <% 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))%>
+
+ <% if @assigned_heading.present? %>
+ <% heading_link = link_to(@assigned_heading.name,
+ budget_investments_path(@budget,
+ heading_id: @assigned_heading.try(:id))) %>
+ <% end %>
+
- <%= 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 %>
+
+ <%= 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).html_safe %>
+
diff --git a/app/views/budgets/investments/_header.html.erb b/app/views/budgets/investments/_header.html.erb
index c664abc01..d9f21523a 100644
--- a/app/views/budgets/investments/_header.html.erb
+++ b/app/views/budgets/investments/_header.html.erb
@@ -35,7 +35,7 @@
<%= t("budgets.investments.index.by_heading", heading: @heading.name) %>
-
+
<%= t("budgets.investments.header.different_heading_assigned_html",
heading_link: link_to(
@assigned_heading.name,
diff --git a/config/locales/en/budgets.yml b/config/locales/en/budgets.yml
index b224cef34..b0b393b42 100644
--- a/config/locales/en/budgets.yml
+++ b/config/locales/en/budgets.yml
@@ -19,7 +19,7 @@ en:
not_selected: Unselected investment projects can not be supported
not_enough_money_html: "You have already assigned the available budget.
Remember you can %{change_ballot} at any time"
no_ballots_allowed: Selecting phase is closed
- different_heading_assigned: You have already voted a different heading
+ different_heading_assigned_html: "You have already voted a different heading: %{heading_link}"
change_ballot: change your votes
groups:
show:
diff --git a/config/locales/es/budgets.yml b/config/locales/es/budgets.yml
index 8686f98b0..ab1a1e4ac 100644
--- a/config/locales/es/budgets.yml
+++ b/config/locales/es/budgets.yml
@@ -19,7 +19,7 @@ es:
not_selected: No se pueden votar proyectos inviables.
not_enough_money_html: "Ya has asignado el presupuesto disponible.
Recuerda que puedes %{change_ballot} en cualquier momento"
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_html: "Ya has votado proyectos de otra partida: %{heading_link}"
change_ballot: cambiar tus votos
groups:
show:
diff --git a/spec/features/budgets/ballots_spec.rb b/spec/features/budgets/ballots_spec.rb
index 6a4be8696..4790de669 100644
--- a/spec/features/budgets/ballots_spec.rb
+++ b/spec/features/budgets/ballots_spec.rb
@@ -226,7 +226,7 @@ feature 'Ballots' do
click_link "Districts"
click_link "District 2"
- expect(page).to have_content("You have active votes in another heading")
+ expect(page).to have_content("You have active votes in another heading: District 1")
end
end
@@ -296,7 +296,7 @@ feature 'Ballots' do
visit budget_investments_path(budget, heading_id: new_york.id)
expect(page).not_to have_css "#progressbar"
- expect(page).to have_content "You have active votes in another heading:"
+ expect(page).to have_content "You have active votes in another heading: California"
expect(page).to have_link california.name, href: budget_investments_path(budget, heading_id: california.id)
end
diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb
index 4c8ade0f5..b8b3d423b 100644
--- a/spec/models/budget/investment_spec.rb
+++ b/spec/models/budget/investment_spec.rb
@@ -756,7 +756,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(:different_heading_assigned)
+ expect(inv2.reason_for_not_being_ballotable_by(user, ballot)).to eq(:different_heading_assigned_html)
end
it "rejects proposals with price higher than current available money" do