From e31a1ea39e2f139560c40a676e82f9d60f940ce3 Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 26 May 2017 14:40:25 +0200 Subject: [PATCH 1/4] fixes height of participation not allowed message --- app/assets/stylesheets/participation.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 0c3ff069a..4b1ef6700 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -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; From a49b206b424110ed24340d29e28de72edc92d1d1 Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 26 May 2017 14:55:27 +0200 Subject: [PATCH 2/4] adds help message to how change ballot --- app/views/budgets/investments/_header.html.erb | 6 ++++++ app/views/budgets/investments/_sidebar.html.erb | 12 ++++++++++-- config/locales/budgets.en.yml | 4 ++++ config/locales/budgets.es.yml | 4 ++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/app/views/budgets/investments/_header.html.erb b/app/views/budgets/investments/_header.html.erb index 2ed01d989..42e133d5a 100644 --- a/app/views/budgets/investments/_header.html.erb +++ b/app/views/budgets/investments/_header.html.erb @@ -42,6 +42,12 @@ @assigned_heading.name, budget_investments_path(@budget, heading_id: @assigned_heading.try(:id))) ) %> +
+ + <%= t("budgets.investments.header.change_ballot", + check_ballot: link_to(t("budgets.investments.header.check_ballot_link"), + budget_ballot_path(@budget))).html_safe %> + <% end %> diff --git a/app/views/budgets/investments/_sidebar.html.erb b/app/views/budgets/investments/_sidebar.html.erb index 06d3b9d81..4ae9104d5 100644 --- a/app/views/budgets/investments/_sidebar.html.erb +++ b/app/views/budgets/investments/_sidebar.html.erb @@ -41,11 +41,19 @@

<% elsif @assigned_heading.present? %> -

<%= t("budgets.investments.index.sidebar.different_heading_assigned_html", +

+ <%= 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))) - ) %>

+ ) %> +
+ + <%= 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 %> + +

<% else %>

<%= t("budgets.investments.index.sidebar.zero") %>

<% end %> diff --git a/config/locales/budgets.en.yml b/config/locales/budgets.en.yml index 570f9da35..19b52e976 100644 --- a/config/locales/budgets.en.yml +++ b/config/locales/budgets.en.yml @@ -64,6 +64,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 +108,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: diff --git a/config/locales/budgets.es.yml b/config/locales/budgets.es.yml index a8e7fa5fa..6475eea79 100644 --- a/config/locales/budgets.es.yml +++ b/config/locales/budgets.es.yml @@ -64,6 +64,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 +108,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: From 0e581896c0041e83965194d0182dfc9ee037051a Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 26 May 2017 17:12:21 +0200 Subject: [PATCH 3/4] improves message when not enough money --- app/models/budget/investment.rb | 2 +- app/views/budgets/investments/_ballot.html.erb | 5 +++-- config/locales/budgets.en.yml | 3 ++- config/locales/budgets.es.yml | 3 ++- spec/models/budget/investment_spec.rb | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index 56a50deec..7aabf7093 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -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) diff --git a/app/views/budgets/investments/_ballot.html.erb b/app/views/budgets/investments/_ballot.html.erb index 0ad43ab43..605caebc7 100644 --- a/app/views/budgets/investments/_ballot.html.erb +++ b/app/views/budgets/investments/_ballot.html.erb @@ -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 %>

diff --git a/config/locales/budgets.en.yml b/config/locales/budgets.en.yml index 19b52e976..6fba08534 100644 --- a/config/locales/budgets.en.yml +++ b/config/locales/budgets.en.yml @@ -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.
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 + change_ballot: change your votes groups: show: title: Select an option diff --git a/config/locales/budgets.es.yml b/config/locales/budgets.es.yml index 6475eea79..1cb308472 100644 --- a/config/locales/budgets.es.yml +++ b/config/locales/budgets.es.yml @@ -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.
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. + change_ballot: cambiar tus votos groups: show: title: Selecciona una opción diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb index b811e8061..2290abba9 100644 --- a/spec/models/budget/investment_spec.rb +++ b/spec/models/budget/investment_spec.rb @@ -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 From 75841a71bed02e481020c1b16cd07a630d26ae14 Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 26 May 2017 17:28:04 +0200 Subject: [PATCH 4/4] updates texts on specs --- spec/features/budgets/ballots_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/features/budgets/ballots_spec.rb b/spec/features/budgets/ballots_spec.rb index b8f40acf0..35e74a9a6 100644 --- a/spec/features/budgets/ballots_spec.rb +++ b/spec/features/budgets/ballots_spec.rb @@ -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