From e6f6a34054316fa382ba56f1f0c26573ab018492 Mon Sep 17 00:00:00 2001 From: Susana Truebano Date: Mon, 27 Feb 2017 13:04:56 +0100 Subject: [PATCH 01/12] fix close div and close thead in admin budgets groups edit partial --- app/views/admin/budgets/_group.html.erb | 56 ++++++++++++------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/app/views/admin/budgets/_group.html.erb b/app/views/admin/budgets/_group.html.erb index 422834f61..e90bd4905 100644 --- a/app/views/admin/budgets/_group.html.erb +++ b/app/views/admin/budgets/_group.html.erb @@ -7,23 +7,24 @@ - <% if headings.blank? %> - - - -
- <%= t("admin.budgets.form.no_heading") %> -
- - - <% else %> - - <%= t("admin.budgets.form.table_heading") %> - <%= t("admin.budgets.form.table_amount") %> - - - - <% end %> + <% if headings.blank? %> + + + + +
+ <%= t("admin.budgets.form.no_heading") %> +
+ + + <% else %> + + <%= t("admin.budgets.form.table_heading") %> + <%= t("admin.budgets.form.table_amount") %> + + + + <% end %> @@ -52,16 +53,15 @@ <% headings.each do |heading| %> - - - <%= heading.name %> - - - <%= heading.price %> - - + + + <%= heading.name %> + + + <%= heading.price %> + + <% end %> - - - + + From 580ed6e4c670f8e5863198a150d9f52f467baf2a Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Mar 2017 13:15:12 +0100 Subject: [PATCH 02/12] adds alternative text for share on WhatsApp links --- app/views/budgets/investments/_investment_show.html.erb | 1 + app/views/debates/show.html.erb | 1 + app/views/proposals/show.html.erb | 1 + app/views/spending_proposals/show.html.erb | 1 + config/locales/social_share_button.en.yml | 1 + config/locales/social_share_button.es.yml | 1 + 6 files changed, 6 insertions(+) diff --git a/app/views/budgets/investments/_investment_show.html.erb b/app/views/budgets/investments/_investment_show.html.erb index 17abf4faf..37ddc8930 100644 --- a/app/views/budgets/investments/_investment_show.html.erb +++ b/app/views/budgets/investments/_investment_show.html.erb @@ -105,6 +105,7 @@ <% if browser.device.mobile? %> + <%= t("social_share_button.whatsapp") %> <% end %> diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb index 363a3bab3..f28691727 100644 --- a/app/views/debates/show.html.erb +++ b/app/views/debates/show.html.erb @@ -55,6 +55,7 @@ <% if browser.device.mobile? %> + <%= t("social_share_button.whatsapp") %> <% end %> diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index 6209805cf..869417777 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -128,6 +128,7 @@ <% if browser.device.mobile? %> + <%= t("social_share_button.whatsapp") %> <% end %> diff --git a/app/views/spending_proposals/show.html.erb b/app/views/spending_proposals/show.html.erb index 0da045860..96468eb4c 100644 --- a/app/views/spending_proposals/show.html.erb +++ b/app/views/spending_proposals/show.html.erb @@ -47,6 +47,7 @@ <% if browser.device.mobile? %> + <%= t("social_share_button.whatsapp") %> <% end %> diff --git a/config/locales/social_share_button.en.yml b/config/locales/social_share_button.en.yml index b06cb5ad3..a4ba5436f 100644 --- a/config/locales/social_share_button.en.yml +++ b/config/locales/social_share_button.en.yml @@ -17,3 +17,4 @@ en: plurk: "Plurk" pinterest: "Pinterest" email: "Email" + whatsapp: "WhatsApp" \ No newline at end of file diff --git a/config/locales/social_share_button.es.yml b/config/locales/social_share_button.es.yml index 45e4ab2a5..4647fc010 100644 --- a/config/locales/social_share_button.es.yml +++ b/config/locales/social_share_button.es.yml @@ -17,3 +17,4 @@ es: plurk: "Plurk" pinterest: "Pinterest" email: "Correo electrónico" + whatsapp: "WhatsApp" \ No newline at end of file From ad9d6d0713ddc3ce38cee6903827fce14c874ecd Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Mar 2017 13:31:18 +0100 Subject: [PATCH 03/12] fixes tabs role on proposals show --- app/views/proposals/_filter_subnav.html.erb | 2 +- app/views/proposals/show.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/proposals/_filter_subnav.html.erb b/app/views/proposals/_filter_subnav.html.erb index fe875c9a9..6347d56b0 100644 --- a/app/views/proposals/_filter_subnav.html.erb +++ b/app/views/proposals/_filter_subnav.html.erb @@ -1,6 +1,6 @@
-
    +
    • <%= link_to "#tab-comments" do %>

      diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index 869417777..22d17d29f 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -137,7 +137,7 @@

<% end %> -
+
<%= render "proposals/filter_subnav" %> <%= render "proposals/notifications" %> From 5cf9a98e6a79f0251eaf115880880250cdc3ccf4 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Mar 2017 13:38:40 +0100 Subject: [PATCH 04/12] adds lang attribute on error pages --- public/404.html | 2 +- public/422.html | 2 +- public/500.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/404.html b/public/404.html index cc6820bba..5b5362192 100644 --- a/public/404.html +++ b/public/404.html @@ -1,5 +1,5 @@ - + Error 404 | Not found diff --git a/public/422.html b/public/422.html index e68d2956f..cca90e5a3 100644 --- a/public/422.html +++ b/public/422.html @@ -1,5 +1,5 @@ - + Error 422 | The change you wanted was rejected diff --git a/public/500.html b/public/500.html index 71978cdce..0b563452a 100644 --- a/public/500.html +++ b/public/500.html @@ -1,5 +1,5 @@ - + Error 500 | Internal server error From 24920e73f6538a807b93ba4497795c3fc47170eb Mon Sep 17 00:00:00 2001 From: kikito Date: Mon, 6 Mar 2017 13:42:52 +0100 Subject: [PATCH 05/12] Adds permissions for authors to destroy budget investments --- app/models/abilities/common.rb | 1 + spec/models/abilities/common_spec.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/app/models/abilities/common.rb b/app/models/abilities/common.rb index e324540d2..7ac6a12f4 100644 --- a/app/models/abilities/common.rb +++ b/app/models/abilities/common.rb @@ -46,6 +46,7 @@ module Abilities can :create, SpendingProposal can :create, Budget::Investment, budget: { phase: "accepting" } + can :destroy, Budget::Investment, budget: { phase: ["accepting", "reviewing"] }, author_id: user.id can :vote, Budget::Investment, budget: { phase: "selecting" } can [:show, :create], Budget::Ballot, budget: { phase: "balloting" } can [:create, :destroy], Budget::Ballot::Line, budget: { phase: "balloting" } diff --git a/spec/models/abilities/common_spec.rb b/spec/models/abilities/common_spec.rb index ce90ab967..f82bcc839 100644 --- a/spec/models/abilities/common_spec.rb +++ b/spec/models/abilities/common_spec.rb @@ -10,12 +10,18 @@ describe "Abilities::Common" do let(:comment) { create(:comment) } let(:proposal) { create(:proposal) } let(:accepting_budget) { create(:budget, phase: 'accepting') } + let(:reviewing_budget) { create(:budget, phase: 'reviewing') } let(:selecting_budget) { create(:budget, phase: 'selecting') } let(:balloting_budget) { create(:budget, phase: 'balloting') } let(:investment_in_accepting_budget) { create(:budget_investment, budget: accepting_budget) } + let(:investment_in_reviewing_budget) { create(:budget_investment, budget: reviewing_budget) } let(:investment_in_selecting_budget) { create(:budget_investment, budget: selecting_budget) } let(:investment_in_balloting_budget) { create(:budget_investment, budget: balloting_budget) } + let(:own_investment_in_accepting_budget) { create(:budget_investment, budget: accepting_budget, author: user) } + let(:own_investment_in_reviewing_budget) { create(:budget_investment, budget: reviewing_budget, author: user) } + let(:own_investment_in_selecting_budget) { create(:budget_investment, budget: selecting_budget, author: user) } + let(:own_investment_in_balloting_budget) { create(:budget_investment, budget: balloting_budget, author: user) } let(:ballot_in_accepting_budget) { create(:budget_ballot, budget: accepting_budget) } let(:ballot_in_selecting_budget) { create(:budget_ballot, budget: selecting_budget) } let(:ballot_in_balloting_budget) { create(:budget_ballot, budget: balloting_budget) } @@ -117,6 +123,16 @@ describe "Abilities::Common" do it { should be_able_to(:vote, investment_in_selecting_budget) } it { should_not be_able_to(:vote, investment_in_balloting_budget) } + it { should_not be_able_to(:destroy, investment_in_accepting_budget) } + it { should_not be_able_to(:destroy, investment_in_reviewing_budget) } + it { should_not be_able_to(:destroy, investment_in_selecting_budget) } + it { should_not be_able_to(:destroy, investment_in_balloting_budget) } + + it { should be_able_to(:destroy, own_investment_in_accepting_budget) } + it { should be_able_to(:destroy, own_investment_in_reviewing_budget) } + it { should_not be_able_to(:destroy, own_investment_in_selecting_budget) } + it { should_not be_able_to(:destroy, investment_in_balloting_budget) } + it { should_not be_able_to(:create, ballot_in_accepting_budget) } it { should_not be_able_to(:create, ballot_in_selecting_budget) } it { should be_able_to(:create, ballot_in_balloting_budget) } From 737d347c4a3f0de76c6de8fb723eacccbea1e5d1 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Mar 2017 13:45:11 +0100 Subject: [PATCH 06/12] changes alt text of header logo --- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- config/locales/fr.yml | 2 +- config/locales/pt-BR.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index dd9624188..b09ab94cd 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -195,7 +195,7 @@ en: external_link_transparency: Transparency external_link_transparency_url: https://transparency.consul locale: 'Language:' - logo: Consul + logo: Consul logo management: Management moderation: Moderation valuation: Valuation diff --git a/config/locales/es.yml b/config/locales/es.yml index 0b8fa4b1c..7f8164335 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -195,7 +195,7 @@ es: external_link_transparency: Transparencia external_link_transparency_url: https://transparency.consul locale: 'Idioma:' - logo: Consul + logo: Consul logo management: Gestión moderation: Moderar valuation: Evaluación diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 596531c0d..cc0b1c590 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -874,7 +874,7 @@ fr: external_link_transparency: Transparence external_link_transparency_url: https://transparency.consul locale: 'Langue :' - logo: Consul + logo: Consul logo moderation: Modération more_information: Plus d'information my_account_link: Mon compte diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 75e7aebb6..febe0ed5c 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -860,7 +860,7 @@ pt-BR: external_link_transparency: Transparência external_link_transparency_url: https://transparency.consul locale: 'Idioma:' - logo: Consul + logo: Consul logotipo moderation: Moderação more_information: Mais informações my_account_link: Minha conta From 1e3ea14c9939d5ef950f85cf2c59be28eb105d4a Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Mar 2017 14:00:08 +0100 Subject: [PATCH 07/12] improves color contrast on hollow buttons --- app/assets/stylesheets/layout.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 7c3300fa3..1511910b1 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -70,6 +70,11 @@ a { } } +.button.hollow { + border: 1px solid $link; + color: $link; +} + .postfix.button { padding: 0; } From b5fd8cc8b293d52d29b52ffc8156537352031da0 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Mar 2017 14:04:17 +0100 Subject: [PATCH 08/12] fixes missing i18n --- app/views/budgets/investments/_investment_show.html.erb | 2 +- app/views/debates/show.html.erb | 2 +- app/views/proposals/show.html.erb | 2 +- app/views/spending_proposals/show.html.erb | 2 +- config/locales/en.yml | 1 + config/locales/es.yml | 1 + config/locales/social_share_button.en.yml | 3 +-- config/locales/social_share_button.es.yml | 3 +-- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/budgets/investments/_investment_show.html.erb b/app/views/budgets/investments/_investment_show.html.erb index 37ddc8930..ebac39186 100644 --- a/app/views/budgets/investments/_investment_show.html.erb +++ b/app/views/budgets/investments/_investment_show.html.erb @@ -105,7 +105,7 @@ <% if browser.device.mobile? %> - <%= t("social_share_button.whatsapp") %> + <%= t("social.whatsapp") %> <% end %>
diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb index f28691727..096369bc3 100644 --- a/app/views/debates/show.html.erb +++ b/app/views/debates/show.html.erb @@ -55,7 +55,7 @@ <% if browser.device.mobile? %> - <%= t("social_share_button.whatsapp") %> + <%= t("social.whatsapp") %> <% end %>
diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index 22d17d29f..5d184088d 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -128,7 +128,7 @@ <% if browser.device.mobile? %> - <%= t("social_share_button.whatsapp") %> + <%= t("social.whatsapp") %> <% end %>
diff --git a/app/views/spending_proposals/show.html.erb b/app/views/spending_proposals/show.html.erb index 96468eb4c..4cdfb688b 100644 --- a/app/views/spending_proposals/show.html.erb +++ b/app/views/spending_proposals/show.html.erb @@ -47,7 +47,7 @@ <% if browser.device.mobile? %> - <%= t("social_share_button.whatsapp") %> + <%= t("social.whatsapp") %> <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index b09ab94cd..0bd238892 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -472,6 +472,7 @@ en: facebook: Facebook twitter: Twitter youtube: YouTube + whatsapp: WhatsApp spending_proposals: form: association_name_label: 'If you propose in name of an assocation or collective add the name here' diff --git a/config/locales/es.yml b/config/locales/es.yml index 7f8164335..4df6e870e 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -472,6 +472,7 @@ es: facebook: Facebook twitter: Twitter youtube: YouTube + whatsapp: WhatsApp spending_proposals: form: association_name_label: 'Si propones en nombre de una asociación o colectivo añade el nombre aquí' diff --git a/config/locales/social_share_button.en.yml b/config/locales/social_share_button.en.yml index a4ba5436f..84ee6baba 100644 --- a/config/locales/social_share_button.en.yml +++ b/config/locales/social_share_button.en.yml @@ -16,5 +16,4 @@ en: tumblr: "Tumblr" plurk: "Plurk" pinterest: "Pinterest" - email: "Email" - whatsapp: "WhatsApp" \ No newline at end of file + email: "Email" \ No newline at end of file diff --git a/config/locales/social_share_button.es.yml b/config/locales/social_share_button.es.yml index 4647fc010..aa0c3f224 100644 --- a/config/locales/social_share_button.es.yml +++ b/config/locales/social_share_button.es.yml @@ -16,5 +16,4 @@ es: tumblr: "Tumblr" plurk: "Plurk" pinterest: "Pinterest" - email: "Correo electrónico" - whatsapp: "WhatsApp" \ No newline at end of file + email: "Correo electrónico" \ No newline at end of file From 3dbdc8f455e5fe18ff25079b0745c934a5608392 Mon Sep 17 00:00:00 2001 From: kikito Date: Mon, 6 Mar 2017 19:24:10 +0100 Subject: [PATCH 09/12] Adds delete link to budget investment list in user activities --- .../budgets/investments_controller.rb | 2 +- app/views/users/_budget_investments.html.erb | 5 +++++ config/locales/en.yml | 1 + config/locales/es.yml | 1 + config/routes.rb | 2 +- spec/features/budgets/investments_spec.rb | 18 +++++++++++++++++- 6 files changed, 26 insertions(+), 3 deletions(-) diff --git a/app/controllers/budgets/investments_controller.rb b/app/controllers/budgets/investments_controller.rb index 0a5e78eef..7f9c6e7ee 100644 --- a/app/controllers/budgets/investments_controller.rb +++ b/app/controllers/budgets/investments_controller.rb @@ -55,7 +55,7 @@ module Budgets end def destroy - investment.destroy + @investment.destroy redirect_to user_path(current_user, filter: 'budget_investments'), notice: t('flash.actions.destroy.budget_investment') end diff --git a/app/views/users/_budget_investments.html.erb b/app/views/users/_budget_investments.html.erb index b5773cbdf..d16f022ce 100644 --- a/app/views/users/_budget_investments.html.erb +++ b/app/views/users/_budget_investments.html.erb @@ -4,6 +4,11 @@ <%= link_to budget_investment.title, budget_investment_path(budget_investment.budget, budget_investment) %> + + <% if can? :destroy, budget_investment %> + <%= link_to t('shared.delete'), budget_investment_path(budget_investment.budget, budget_investment), method: :delete %> + <% end %> + <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index dd9624188..0e8462cb8 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -428,6 +428,7 @@ en: search: 'Filter' title: 'Advanced search' to: 'To' + delete: Delete author_info: author_deleted: User deleted back: Go back diff --git a/config/locales/es.yml b/config/locales/es.yml index 0b8fa4b1c..ba9b2c706 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -428,6 +428,7 @@ es: search: 'Filtrar' title: 'Búsqueda avanzada' to: 'Hasta' + delete: 'Borrar' author_info: author_deleted: Usuario eliminado back: Volver diff --git a/config/routes.rb b/config/routes.rb index cc76297f6..8d5e84ad3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -298,7 +298,7 @@ Rails.application.routes.draw do get :support_investments get :print_investments end - resources :investments, only: [:index, :new, :create, :show], controller: 'budgets/investments' do + resources :investments, only: [:index, :new, :create, :show, :destroy], controller: 'budgets/investments' do post :vote, on: :member get :print, on: :collection end diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index a6feb6f44..323948c16 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -315,6 +315,20 @@ feature 'Budget Investments' do end end + scenario "Author can destroy while on the selecting phase" do + user = create(:user, :level_two) + sp1 = create(:budget_investment, :selected, heading: heading, price: 10000, author: user) + + login_as(user) + visit user_path(user, tab: :budget_investments) + + within("#budget_investment_#{sp1.id}") do + expect(page).to have_content(sp1.title) + click_link('Delete') + end + + visit user_path(user, tab: :budget_investments) + end end context "Selecting Phase" do @@ -476,6 +490,8 @@ feature 'Budget Investments' do expect(page).to have_content "€10,000" end + + scenario "Sidebar in show should display vote text" do investment = create(:budget_investment, :selected, budget: budget) visit budget_investment_path(budget, investment) @@ -561,4 +577,4 @@ feature 'Budget Investments' do end end -end \ No newline at end of file +end From f67b8d8aeebe3806213e1390d5ca0927b7e25986 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Mar 2017 19:34:47 +0100 Subject: [PATCH 10/12] improves styles of delete button --- app/views/users/_budget_investments.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/users/_budget_investments.html.erb b/app/views/users/_budget_investments.html.erb index d16f022ce..64cad676d 100644 --- a/app/views/users/_budget_investments.html.erb +++ b/app/views/users/_budget_investments.html.erb @@ -4,9 +4,10 @@ <%= link_to budget_investment.title, budget_investment_path(budget_investment.budget, budget_investment) %> - + <% if can? :destroy, budget_investment %> - <%= link_to t('shared.delete'), budget_investment_path(budget_investment.budget, budget_investment), method: :delete %> + <%= link_to t('shared.delete'), budget_investment_path(budget_investment.budget, budget_investment), + method: :delete, class: "button hollow alert" %> <% end %> From 8f91b1e2cc064377a913aa8e6e3459439d3b61e1 Mon Sep 17 00:00:00 2001 From: kikito Date: Tue, 7 Mar 2017 16:42:45 +0100 Subject: [PATCH 11/12] fixes incorrect title/setup in spec --- spec/features/budgets/investments_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index 323948c16..1d812bd7e 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -315,9 +315,9 @@ feature 'Budget Investments' do end end - scenario "Author can destroy while on the selecting phase" do + scenario "Author can destroy while on the accepting phase" do user = create(:user, :level_two) - sp1 = create(:budget_investment, :selected, heading: heading, price: 10000, author: user) + sp1 = create(:budget_investment, heading: heading, price: 10000, author: user) login_as(user) visit user_path(user, tab: :budget_investments) From 712d5f2d9a6ebbc1da46099dd41770f58b3a95de Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 7 Mar 2017 18:17:49 +0100 Subject: [PATCH 12/12] displays only valuation tags for filtering --- app/helpers/budgets_helper.rb | 4 ++++ app/views/admin/budget_investments/index.html.erb | 2 +- spec/features/admin/budget_investments_spec.rb | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/helpers/budgets_helper.rb b/app/helpers/budgets_helper.rb index 84f04139c..4b9dfd311 100644 --- a/app/helpers/budgets_helper.rb +++ b/app/helpers/budgets_helper.rb @@ -38,4 +38,8 @@ module BudgetsHelper def current_ballot Budget::Ballot.where(user: current_user, budget: @budget).first end + + def investment_tags_select_options + Budget::Investment.tags_on(:valuation).order(:name).select(:name).distinct + end end diff --git a/app/views/admin/budget_investments/index.html.erb b/app/views/admin/budget_investments/index.html.erb index 126a933b7..beb5eb856 100644 --- a/app/views/admin/budget_investments/index.html.erb +++ b/app/views/admin/budget_investments/index.html.erb @@ -28,7 +28,7 @@
<%= select_tag :tag_name, - options_for_select(spending_proposal_tags_select_options, params[:tag_name]), + options_for_select(investment_tags_select_options, params[:tag_name]), { prompt: t("admin.budget_investments.index.tags_filter_all"), label: false, class: "js-submit-on-change" } %> diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index ede09ec4f..f4dde2425 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -252,6 +252,21 @@ feature 'Admin budget investments' do expect(page).to have_content("More schools") end + scenario "Filtering by tag, display only valuation tags" do + investment1 = create(:budget_investment, budget: @budget, tag_list: 'Education') + investment2 = create(:budget_investment, budget: @budget, tag_list: 'Health') + + investment1.set_tag_list_on(:valuation, 'Teachers') + investment2.set_tag_list_on(:valuation, 'Hospitals') + + investment1.save + investment2.save + + visit admin_budget_budget_investments_path(budget_id: @budget.id) + + expect(page).to have_select("tag_name", options: ["All tags", "Hospitals", "Teachers"]) + end + end scenario 'Show' do