Add filter to show all budgets in admin

This commit is contained in:
decabeza
2020-03-16 12:54:00 +01:00
committed by Javi Martín
parent 9debf807b6
commit 4ff8162a2e
4 changed files with 6 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ class Admin::BudgetsController < Admin::BaseController
include FeatureFlags
feature_flag :budgets
has_filters %w[open finished], only: :index
has_filters %w[all open finished], only: :index
before_action :load_budget, except: [:index, :new, :create]
before_action :load_staff, only: [:new, :create, :edit, :update, :show]

View File

@@ -70,6 +70,7 @@ en:
new_link: Create new budget
filter: Filter
filters:
all: All
open: Open
finished: Finished
help: "Participatory budgets allow citizens to propose and decide directly how to spend part of the budget, with monitoring and rigorous evaluation of proposals by the institution."

View File

@@ -70,6 +70,7 @@ es:
new_link: Crear nuevo presupuesto
filter: Filtro
filters:
all: Todos
open: Abiertos
finished: Terminados
help: "Los presupuestos participativos permiten que los ciudadanos propongan y decidan de manera directa cómo gastar parte del presupuesto, con un seguimiento y evaluación riguroso de las propuestas por parte de la institución."

View File

@@ -77,15 +77,15 @@ describe "Admin budgets", :admin do
expect(page).not_to have_content(finished_budget.name)
end
scenario "Open filter is properly highlighted" do
filters_links = { "current" => "Open", "finished" => "Finished" }
scenario "Filters are properly highlighted" do
filters_links = { "all" => "All", "open" => "Open", "finished" => "Finished" }
visit admin_budgets_path
expect(page).not_to have_link(filters_links.values.first)
filters_links.keys.drop(1).each { |filter| expect(page).to have_link(filters_links[filter]) }
filters_links.each_pair do |current_filter, link|
filters_links.each do |current_filter, link|
visit admin_budgets_path(filter: current_filter)
expect(page).not_to have_link(link)