Skip to content

Commit

Permalink
Merge pull request consuldemocracy#3656 from consul/fix_alert_text
Browse files Browse the repository at this point in the history
Fix text confirming investment heading support
  • Loading branch information
javierm committed Sep 11, 2019
2 parents 15bca82 + b867617 commit 1d57fb4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/budgets/investments/_votes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
method: "post",
remote: (display_support_alert?(investment) ? false : true),
data: (display_support_alert?(investment) ? {
confirm: t("budgets.investments.investment.confirm_group") } : nil),
confirm: t("budgets.investments.investment.confirm_group", count: investment.group.max_votable_headings) } : nil),
"aria-hidden" => css_for_aria_hidden(reason) do %>
<%= t("budgets.investments.investment.give_support") %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en/budgets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ en:
support_title: Support this project
confirm_group:
one: "You can only support investments in %{count} district. If you continue you cannot change the election of your district. Are you sure?"
other: "You can only support investments in %{count} district. If you continue you cannot change the election of your district. Are you sure?"
other: "You can only support investments in %{count} districts. If you continue you cannot change the election of your district. Are you sure?"
supports:
one: 1 support
other: "%{count} supports"
Expand Down
7 changes: 7 additions & 0 deletions spec/features/budgets/votes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@
"Share it!"
end

scenario "Confirm message shows the right text", :js do
visit budget_investments_path(budget, heading_id: new_york.id)
find(".in-favor a").click

expect(page.driver.send(:find_modal).text).to match "You can only support investments in 2 districts."
end

end
end
end

0 comments on commit 1d57fb4

Please sign in to comment.