From 4a2fae5e905e8c28b03e531eabf8090a6a8b0aa0 Mon Sep 17 00:00:00 2001 From: Marko Lovic Date: Mon, 9 Jul 2018 17:33:00 +0200 Subject: [PATCH] Add headings to "headings limit reached" alert msg --- app/views/budgets/investments/_votes.html.erb | 5 +++-- config/locales/en/general.yml | 4 ++-- config/locales/es/general.yml | 4 ++-- spec/features/budgets/votes_spec.rb | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/views/budgets/investments/_votes.html.erb b/app/views/budgets/investments/_votes.html.erb index 491664663..7d1593a05 100644 --- a/app/views/budgets/investments/_votes.html.erb +++ b/app/views/budgets/investments/_votes.html.erb @@ -35,8 +35,9 @@ count: investment.group.max_votable_headings, 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 %> + signup: link_to(t("votes.signup"), new_user_registration_path), + supported_headings: (current_user && current_user.headings_voted_within_group(investment.group).map(&:name).to_sentence) + ).html_safe %>

diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index 35781e16a..3d2db791e 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -771,8 +771,8 @@ en: unfeasible: Unfeasible investment projects can not be supported not_voting_allowed: Voting phase is closed different_heading_assigned: - one: "You can only support investment projects in %{count} district" - other: "You can only support investment projects in %{count} districts" + one: "You can only support investment projects in %{count} district. You have already supported investments in %{supported_headings}." + other: "You can only support investment projects in %{count} districts. You have already supported investments in %{supported_headings}." welcome: feed: most_active: diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index 02b56b8da..0802979b9 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -770,8 +770,8 @@ es: unfeasible: No se pueden votar propuestas inviables. not_voting_allowed: El periodo de votación está cerrado. different_heading_assigned: - one: "Sólo puedes apoyar proyectos de gasto de %{count} distrito" - other: "Sólo puedes apoyar proyectos de gasto de %{count} distritos" + one: "Sólo puedes apoyar proyectos de gasto de %{count} distrito. Ya has apoyado en %{supported_headings}." + other: "Sólo puedes apoyar proyectos de gasto de %{count} distritos. Ya has apoyado en %{supported_headings}." welcome: feed: most_active: diff --git a/spec/features/budgets/votes_spec.rb b/spec/features/budgets/votes_spec.rb index 85f2dfbb0..5ab1550e7 100644 --- a/spec/features/budgets/votes_spec.rb +++ b/spec/features/budgets/votes_spec.rb @@ -142,7 +142,7 @@ feature 'Votes' do within("#budget_investment_#{third_heading_investment.id}") do find('.in-favor a').click - expect(page).to have_content "You can only support investment projects in 2 districts" + expect(page).to have_content "You can only support investment projects in 2 districts. You have already supported investments in #{new_york.name} and #{san_francisco.name}" expect(page).not_to have_content "1 support" expect(page).not_to have_content "You have already supported this investment project. Share it!" @@ -165,7 +165,7 @@ feature 'Votes' do visit budget_investment_path(budget, third_heading_investment) find('.in-favor a').click - expect(page).to have_content "You can only support investment projects in 2 districts" + expect(page).to have_content "You can only support investment projects in 2 districts. You have already supported investments in #{new_york.name} and #{san_francisco.name}" expect(page).not_to have_content "1 support" expect(page).not_to have_content "You have already supported this investment project. Share it!"