diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb
index 509d6aa97..384a91ce4 100644
--- a/app/controllers/admin/settings_controller.rb
+++ b/app/controllers/admin/settings_controller.rb
@@ -4,6 +4,7 @@ class Admin::SettingsController < Admin::BaseController
all_settings = Setting.all.group_by { |setting| setting.type }
@configuration_settings = all_settings["configuration"]
@feature_settings = all_settings["feature"]
+ @participation_processes_settings = all_settings["process"]
@map_configuration_settings = all_settings["map"]
end
diff --git a/app/controllers/concerns/feature_flags.rb b/app/controllers/concerns/feature_flags.rb
index ca3cd929e..830b44f4b 100644
--- a/app/controllers/concerns/feature_flags.rb
+++ b/app/controllers/concerns/feature_flags.rb
@@ -10,7 +10,7 @@ module FeatureFlags
end
def check_feature_flag(name)
- raise FeatureDisabled, name unless Setting["feature.#{name}"]
+ raise FeatureDisabled, name unless Setting["feature.#{name}"] || Setting["process.#{name}"]
end
class FeatureDisabled < Exception
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 76723b232..6b2e141e3 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -14,8 +14,8 @@ class UsersController < ApplicationController
def set_activity_counts
@activity_counts = HashWithIndifferentAccess.new(
proposals: Proposal.where(author_id: @user.id).count,
- debates: (Setting["feature.debates"] ? Debate.where(author_id: @user.id).count : 0),
- budget_investments: (Setting["feature.budgets"] ? Budget::Investment.where(author_id: @user.id).count : 0),
+ debates: (Setting["process.debates"] ? Debate.where(author_id: @user.id).count : 0),
+ budget_investments: (Setting["process.budgets"] ? Budget::Investment.where(author_id: @user.id).count : 0),
comments: only_active_commentables.count,
follows: @user.follows.map(&:followable).compact.count)
end
@@ -93,8 +93,8 @@ class UsersController < ApplicationController
def only_active_commentables
disabled_commentables = []
- disabled_commentables << "Debate" unless Setting["feature.debates"]
- disabled_commentables << "Budget::Investment" unless Setting["feature.budgets"]
+ disabled_commentables << "Debate" unless Setting["process.debates"]
+ disabled_commentables << "Budget::Investment" unless Setting["process.budgets"]
if disabled_commentables.present?
all_user_comments.where("commentable_type NOT IN (?)", disabled_commentables)
else
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb
index ad844e29f..b7db90beb 100644
--- a/app/helpers/settings_helper.rb
+++ b/app/helpers/settings_helper.rb
@@ -1,7 +1,7 @@
module SettingsHelper
def feature?(name)
- setting["feature.#{name}"].presence
+ setting["feature.#{name}"].presence || setting["process.#{name}"].presence
end
def setting
diff --git a/app/views/admin/settings/_filter_subnav.html.erb b/app/views/admin/settings/_filter_subnav.html.erb
index 71894ec43..81523aad3 100644
--- a/app/views/admin/settings/_filter_subnav.html.erb
+++ b/app/views/admin/settings/_filter_subnav.html.erb
@@ -11,6 +11,12 @@
<% end %>
+
+ <%= link_to "#tab-participation-processes" do %>
+ <%= t("admin.settings.index.participation_processes") %>
+ <% end %>
+
+
<%= link_to "#tab-feature-flags" do %>
<%= t("admin.settings.index.feature_flags") %>
diff --git a/app/views/admin/settings/_participation_processes_tab.html.erb b/app/views/admin/settings/_participation_processes_tab.html.erb
new file mode 100644
index 000000000..c554dd7c6
--- /dev/null
+++ b/app/views/admin/settings/_participation_processes_tab.html.erb
@@ -0,0 +1,3 @@
+<%= t("admin.settings.index.participation_processes") %>
+
+<%= render "featured_settings_table", features: @participation_processes_settings %>
diff --git a/app/views/admin/settings/index.html.erb b/app/views/admin/settings/index.html.erb
index 8005e4db7..d105d765f 100644
--- a/app/views/admin/settings/index.html.erb
+++ b/app/views/admin/settings/index.html.erb
@@ -6,6 +6,10 @@
<%= render "configuration_settings_tab" %>
+
+ <%= render "participation_processes_tab" %>
+
+
<%= render "features_tab" %>
diff --git a/app/views/management/_menu.html.erb b/app/views/management/_menu.html.erb
index a3030406e..90add29e8 100644
--- a/app/views/management/_menu.html.erb
+++ b/app/views/management/_menu.html.erb
@@ -29,7 +29,7 @@
<%= link_to t("management.menu.support_proposals"), management_proposals_path %>
- <% if Setting["feature.budgets"] %>
+ <% if Setting["process.budgets"] %>
>
<%= link_to t("management.menu.create_budget_investment"), create_investments_management_budgets_path %>
@@ -42,7 +42,7 @@
- <% if Setting["feature.budgets"] %>
+ <% if Setting["process.budgets"] %>
>
<%= link_to print_investments_management_budgets_path do %>
diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml
index bfbd5f9bd..44376c5d2 100644
--- a/config/locales/en/admin.yml
+++ b/config/locales/en/admin.yml
@@ -1175,6 +1175,7 @@ en:
index:
title: Configuration settings
update_setting: Update
+ participation_processes: "Participation processes"
feature_flags: Features
features:
enabled: "Feature enabled"
diff --git a/config/locales/en/settings.yml b/config/locales/en/settings.yml
index ab4b34803..b039d547b 100644
--- a/config/locales/en/settings.yml
+++ b/config/locales/en/settings.yml
@@ -70,26 +70,16 @@ en:
direct_message_max_per_day: "Direct Message max number per day"
direct_message_max_per_day_description: "Number max of direct messages one user can send per day"
feature:
- budgets: "Participatory budgeting"
- budgets_description: "With participatory budgets, citizens decide which projects presented by their neighbours will receive a part of the budget"
twitter_login: "Twitter login"
twitter_login_description: "Allow users to sign up with their Twitter account"
facebook_login: "Facebook login"
facebook_login_description: "Allow users to sign up with their Facebook account"
google_login: "Google login"
google_login_description: "Allow users to sign up with their Google Account"
- proposals: "Proposals"
- proposals_description: "Citizens' proposals are an opportunity for neighbours and collectives to decide directly how they want their society to be, after getting sufficient support and submitting to a citizens' vote"
featured_proposals: "Featured proposals"
featured_proposals_description: "Shows featured proposals on index proposals page"
- debates: "Debates"
- debates_description: "The citizens' debate space is aimed at anyone who can present issues that concern them and about which they want to share their views with others"
- polls: "Polls"
- polls_description: "Citizens' polls are a participatory mechanism by which citizens with voting rights can make direct decisions"
signature_sheets: "Signature sheets"
signature_sheets_description: "It allows adding from the Administration panel signatures collected on-site to Proposals and investment projects of the Participative Budgets"
- legislation: "Collaborative Legislation"
- legislation_description: "In participatory processes, citizens are offered the opportunity to participate in the drafting and modification of regulations and to give their opinion on certain actions that are planned to be carried out"
spending_proposals: "Spending proposals"
spending_proposals_description: "⚠️ NOTE: This functionality has been replaced by Participatory Budgeting and will disappear in new versions"
spending_proposal_features:
@@ -125,3 +115,14 @@ en:
longitude_description: "Longitude to show the position of the map"
zoom: "Zoom"
zoom_description: "Zoom to show the map position"
+ process:
+ debates: "Debates"
+ debates_description: "The citizens' debate space is aimed at anyone who can present issues that concern them and about which they want to share their views with others"
+ proposals: "Proposals"
+ proposals_description: "Citizens' proposals are an opportunity for neighbours and collectives to decide directly how they want their society to be, after getting sufficient support and submitting to a citizens' vote"
+ polls: "Polls"
+ polls_description: "Citizens' polls are a participatory mechanism by which citizens with voting rights can make direct decisions"
+ budgets: "Participatory budgeting"
+ budgets_description: "With participatory budgets, citizens decide which projects presented by their neighbours will receive a part of the budget"
+ legislation: "Legislation"
+ legislation_description: "In participatory processes, citizens are offered the opportunity to participate in the drafting and modification of regulations that affect the society and to give their opinion on certain actions that are planned to be carried out"
diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml
index 037620ab8..dab5eccdb 100644
--- a/config/locales/es/admin.yml
+++ b/config/locales/es/admin.yml
@@ -1174,6 +1174,7 @@ es:
index:
title: Configuración global
update_setting: Actualizar
+ participation_processes: "Procesos de participación"
feature_flags: Funcionalidades
features:
enabled: "Funcionalidad activada"
diff --git a/config/locales/es/settings.yml b/config/locales/es/settings.yml
index 6a251102c..c33e2f6f7 100644
--- a/config/locales/es/settings.yml
+++ b/config/locales/es/settings.yml
@@ -70,26 +70,16 @@ es:
direct_message_max_per_day: "Mensajes directos máximos por día"
direct_message_max_per_day_description: "Número de mensajes directos máximos que un usuario puede enviar por día"
feature:
- budgets: "Presupuestos participativos"
- budgets_description: "Con los presupuestos participativos la ciudadanía decide a qué proyectos presentados por los vecinos y vecinas va destinada una parte del presupuesto"
twitter_login: "Registro con Twitter"
twitter_login_description: "Permitir que los usuarios se registren con su cuenta de Twitter"
facebook_login: "Registro con Facebook"
facebook_login_description: "Permitir que los usuarios se registren con su cuenta de Facebook"
google_login: "Registro con Google"
google_login_description: "Permitir que los usuarios se registren con su cuenta de Google"
- proposals: "Propuestas"
- proposals_description: "Las propuestas ciudadanas son una oportunidad para que los vecinos y colectivos decidan directamente cómo quieren que sea su sociedad, después de conseguir los apoyos suficientes y de someterse a votación ciudadana"
featured_proposals: "Propuestas destacadas"
featured_proposals_description: "Muestra propuestas destacadas en la página principal de propuestas"
- debates: "Debates"
- debates_description: "El espacio de debates ciudadanos está dirigido a que cualquier persona pueda exponer temas que le preocupan y sobre los que quiera compartir puntos de vista con otras personas"
- polls: "Votaciones"
- polls_description: "Las votaciones ciudadanas son un mecanismo de participación por el que la ciudadanía con derecho a voto puede tomar decisiones de forma directa"
signature_sheets: "Hojas de firmas"
signature_sheets_description: "Permite añadir desde el panel de Administración firmas recogidas de forma presencial a Propuestas y proyectos de gasto de los Presupuestos participativos"
- legislation: "Legislación colaborativa"
- legislation_description: "En los procesos participativos se ofrece a la ciudadanía la oportunidad de participar en la elaboración y modificación de normativa y de dar su opinión sobre ciertas actuaciones que se tiene previsto llevar a cabo"
spending_proposals: "Propuestas de inversión"
spending_proposals_description: "⚠️ NOTA: Esta funcionalidad ha sido sustituida por Pesupuestos Participativos y desaparecerá en nuevas versiones"
spending_proposal_features:
@@ -125,3 +115,14 @@ es:
longitude_description: "Longitud para mostrar la posición del mapa"
zoom: "Zoom"
zoom_description: "Zoom para mostrar la posición del mapa"
+ process:
+ debates: "Debates"
+ debates_description: "El espacio de debates ciudadanos está dirigido a que cualquier persona pueda exponer temas que le preocupan y sobre los que quiera compartir puntos de vista con otras personas"
+ proposals: "Propuestas"
+ proposals_description: "Las propuestas ciudadanas son una oportunidad para que los vecinos y colectivos decidan directamente cómo quieren que sea su sociedad, después de conseguir los apoyos suficientes y de someterse a votación ciudadana"
+ polls: "Votaciones"
+ polls_description: "Las votaciones ciudadanas son un mecanismo de participación por el que la ciudadanía con derecho a voto puede tomar decisiones de forma directa"
+ budgets: "Presupuestos participativos"
+ budgets_description: "Con los presupuestos participativos la ciudadanía decide a qué proyectos presentados por los vecinos y vecinas va destinada una parte del presupuesto"
+ legislation: "Legislación"
+ legislation_description: "En los procesos participativos se ofrece a la ciudadanía la oportunidad de participar en la elaboración y modificación de normativa que afecta a la sociedad y de dar su opinión sobre ciertas actuaciones que se tiene previsto llevar a cabo"
diff --git a/db/dev_seeds/settings.rb b/db/dev_seeds/settings.rb
index 5d4abbb6b..157e99b72 100644
--- a/db/dev_seeds/settings.rb
+++ b/db/dev_seeds/settings.rb
@@ -26,18 +26,20 @@ section "Creating Settings" do
Setting.create(key: "url", value: "http://localhost:3000")
Setting.create(key: "org_name", value: "CONSUL")
- Setting.create(key: "feature.debates", value: "true")
- Setting.create(key: "feature.proposals", value: "true")
- Setting.create(key: "feature.featured_proposals", value: nil)
- Setting.create(key: "feature.polls", value: "true")
+ Setting.create(key: "process.debates", value: "true")
+ Setting.create(key: "process.proposals", value: "true")
+ Setting.create(key: "process.polls", value: "true")
+ Setting.create(key: "process.budgets", value: "true")
+ Setting.create(key: "process.legislation", value: "true")
+
+ Setting.create(key: "feature.featured_proposals", value: "true")
Setting.create(key: "feature.spending_proposals", value: nil)
Setting.create(key: "feature.spending_proposal_features.voting_allowed", value: nil)
- Setting.create(key: "feature.budgets", value: "true")
+
Setting.create(key: "feature.twitter_login", value: "true")
Setting.create(key: "feature.facebook_login", value: "true")
Setting.create(key: "feature.google_login", value: "true")
Setting.create(key: "feature.signature_sheets", value: "true")
- Setting.create(key: "feature.legislation", value: "true")
Setting.create(key: "feature.user.recommendations", value: "true")
Setting.create(key: "feature.user.recommendations_on_debates", value: "true")
Setting.create(key: "feature.user.recommendations_on_proposals", value: "true")
diff --git a/db/seeds.rb b/db/seeds.rb
index 72e800f8d..581e5e932 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -65,19 +65,21 @@ Setting["meta_title"] = nil
Setting["meta_description"] = nil
Setting["meta_keywords"] = nil
+# Processes
+Setting["process.debates"] = true
+Setting["process.proposals"] = true
+Setting["process.polls"] = true
+Setting["process.budgets"] = true
+Setting["process.legislation"] = true
+
# Feature flags
-Setting["feature.debates"] = true
-Setting["feature.proposals"] = true
Setting["feature.featured_proposals"] = nil
Setting["feature.spending_proposals"] = nil
-Setting["feature.polls"] = true
Setting["feature.twitter_login"] = true
Setting["feature.facebook_login"] = true
Setting["feature.google_login"] = true
Setting["feature.public_stats"] = true
-Setting["feature.budgets"] = true
Setting["feature.signature_sheets"] = true
-Setting["feature.legislation"] = true
Setting["feature.user.recommendations"] = true
Setting["feature.user.recommendations_on_debates"] = true
Setting["feature.user.recommendations_on_proposals"] = true
diff --git a/spec/features/admin/budget_groups_spec.rb b/spec/features/admin/budget_groups_spec.rb
index 4c89abaeb..f719dc6a8 100644
--- a/spec/features/admin/budget_groups_spec.rb
+++ b/spec/features/admin/budget_groups_spec.rb
@@ -17,11 +17,11 @@ feature "Admin budget groups" do
context "Feature flag" do
background do
- Setting["feature.budgets"] = nil
+ Setting["process.budgets"] = nil
end
after do
- Setting["feature.budgets"] = true
+ Setting["process.budgets"] = true
end
scenario "Disabled with a feature flag" do
diff --git a/spec/features/admin/budget_headings_spec.rb b/spec/features/admin/budget_headings_spec.rb
index 2c918b6da..2429b1ad4 100644
--- a/spec/features/admin/budget_headings_spec.rb
+++ b/spec/features/admin/budget_headings_spec.rb
@@ -18,11 +18,11 @@ feature "Admin budget headings" do
context "Feature flag" do
background do
- Setting["feature.budgets"] = nil
+ Setting["process.budgets"] = nil
end
after do
- Setting["feature.budgets"] = true
+ Setting["process.budgets"] = true
end
scenario "Disabled with a feature flag" do
diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb
index fc9d51ce1..ea3711364 100644
--- a/spec/features/admin/budget_investments_spec.rb
+++ b/spec/features/admin/budget_investments_spec.rb
@@ -19,11 +19,11 @@ feature "Admin budget investments" do
context "Feature flag" do
background do
- Setting["feature.budgets"] = nil
+ Setting["process.budgets"] = nil
end
after do
- Setting["feature.budgets"] = true
+ Setting["process.budgets"] = true
end
scenario "Disabled with a feature flag" do
diff --git a/spec/features/admin/budgets_spec.rb b/spec/features/admin/budgets_spec.rb
index fb441844a..e24c344b2 100644
--- a/spec/features/admin/budgets_spec.rb
+++ b/spec/features/admin/budgets_spec.rb
@@ -1,6 +1,6 @@
-require 'rails_helper'
+require "rails_helper"
-feature 'Admin budgets' do
+feature "Admin budgets" do
background do
admin = create(:administrator)
@@ -12,31 +12,27 @@ feature 'Admin budgets' do
"edit_admin_budget_path",
%w[name]
- context 'Feature flag' do
+ context "Feature flag" do
background do
- Setting['feature.budgets'] = nil
+ Setting["process.budgets"] = nil
end
- after do
- Setting['feature.budgets'] = true
- end
-
- scenario 'Disabled with a feature flag' do
+ scenario "Disabled with a feature flag" do
expect{ visit admin_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled)
end
end
- context 'Index' do
+ context "Index" do
- scenario 'Displaying no open budgets text' do
+ scenario "Displaying no open budgets text" do
visit admin_budgets_path
expect(page).to have_content("There are no budgets.")
end
- scenario 'Displaying budgets' do
+ scenario "Displaying budgets" do
budget = create(:budget)
visit admin_budgets_path
@@ -44,7 +40,7 @@ feature 'Admin budgets' do
expect(page).to have_content(translated_phase_name(phase_kind: budget.phase))
end
- scenario 'Filters by phase' do
+ scenario "Filters by phase" do
drafting_budget = create(:budget, :drafting)
accepting_budget = create(:budget, :accepting)
selecting_budget = create(:budget, :selecting)
@@ -58,14 +54,14 @@ feature 'Admin budgets' do
expect(page).to have_content(balloting_budget.name)
expect(page).not_to have_content(finished_budget.name)
- click_link 'Finished'
+ click_link "Finished"
expect(page).not_to have_content(drafting_budget.name)
expect(page).not_to have_content(accepting_budget.name)
expect(page).not_to have_content(selecting_budget.name)
expect(page).not_to have_content(balloting_budget.name)
expect(page).to have_content(finished_budget.name)
- click_link 'Open'
+ click_link "Open"
expect(page).to have_content(drafting_budget.name)
expect(page).to have_content(accepting_budget.name)
expect(page).to have_content(selecting_budget.name)
@@ -73,8 +69,8 @@ feature 'Admin budgets' 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 "Open filter is properly highlighted" do
+ filters_links = {"current" => "Open", "finished" => "Finished"}
visit admin_budgets_path
@@ -94,26 +90,26 @@ feature 'Admin budgets' do
end
- context 'New' do
+ context "New" do
- scenario 'Create budget' do
+ scenario "Create budget" do
visit admin_budgets_path
- click_link 'Create new budget'
+ click_link "Create new budget"
fill_in "Name", with: "M30 - Summer campaign"
- select 'Accepting projects', from: 'budget[phase]'
+ select "Accepting projects", from: "budget[phase]"
- click_button 'Create Budget'
+ click_button "Create Budget"
- expect(page).to have_content 'New participatory budget created successfully!'
- expect(page).to have_content 'M30 - Summer campaign'
+ expect(page).to have_content "New participatory budget created successfully!"
+ expect(page).to have_content "M30 - Summer campaign"
end
- scenario 'Name is mandatory' do
+ scenario "Name is mandatory" do
visit new_admin_budget_path
- click_button 'Create Budget'
+ click_button "Create Budget"
- expect(page).not_to have_content 'New participatory budget created successfully!'
+ expect(page).not_to have_content "New participatory budget created successfully!"
expect(page).to have_css("label.error", text: "Name")
end
@@ -131,44 +127,44 @@ feature 'Admin budgets' do
end
- context 'Destroy' do
+ context "Destroy" do
let!(:budget) { create(:budget) }
let(:heading) { create(:budget_heading, group: create(:budget_group, budget: budget)) }
- scenario 'Destroy a budget without investments' do
+ scenario "Destroy a budget without investments" do
visit admin_budgets_path
- click_link 'Edit budget'
- click_link 'Delete budget'
+ click_link "Edit budget"
+ click_link "Delete budget"
- expect(page).to have_content('Budget deleted successfully')
+ expect(page).to have_content("Budget deleted successfully")
expect(page).to have_content("There are no budgets.")
end
- scenario 'Try to destroy a budget with investments' do
+ scenario "Try to destroy a budget with investments" do
create(:budget_investment, heading: heading)
visit admin_budgets_path
- click_link 'Edit budget'
- click_link 'Delete budget'
+ click_link "Edit budget"
+ click_link "Delete budget"
- expect(page).to have_content('You cannot destroy a Budget that has associated investments')
- expect(page).to have_content('There is 1 budget')
+ expect(page).to have_content("You cannot destroy a Budget that has associated investments")
+ expect(page).to have_content("There is 1 budget")
end
end
- context 'Edit' do
+ context "Edit" do
let!(:budget) { create(:budget) }
- scenario 'Show phases table' do
+ scenario "Show phases table" do
budget.update(phase: "selecting")
visit admin_budgets_path
- click_link 'Edit budget'
+ click_link "Edit budget"
expect(page).to have_select("budget_phase", selected: "Selecting projects")
- within '#budget-phases-table' do
+ within "#budget-phases-table" do
Budget::Phase::PHASE_KINDS.each do |phase_kind|
phase_index = Budget::Phase::PHASE_KINDS.index(phase_kind)
@@ -184,9 +180,9 @@ feature 'Admin budgets' do
within "#budget_phase_#{phase.id}" do
expect(page).to have_content(translated_phase_name(phase_kind: phase.kind))
expect(page).to have_content("#{phase.starts_at.to_date} - #{phase.ends_at.to_date}")
- expect(page).to have_css('.budget-phase-enabled.enabled')
- expect(page).to have_link('Edit phase', href: edit_phase_link)
- expect(page).to have_content('Active') if budget.current_phase == phase
+ expect(page).to have_css(".budget-phase-enabled.enabled")
+ expect(page).to have_link("Edit phase", href: edit_phase_link)
+ expect(page).to have_content("Active") if budget.current_phase == phase
end
end
end
@@ -218,20 +214,20 @@ feature 'Admin budgets' do
end
- context 'Update' do
+ context "Update" do
background do
create(:budget)
end
- scenario 'Update budget' do
+ scenario "Update budget" do
visit admin_budgets_path
- click_link 'Edit budget'
+ click_link "Edit budget"
fill_in "Name", with: "More trees on the streets"
- click_button 'Update Budget'
+ click_button "Update Budget"
- expect(page).to have_content('More trees on the streets')
+ expect(page).to have_content("More trees on the streets")
expect(page).to have_current_path(admin_budgets_path)
end
@@ -239,8 +235,8 @@ feature 'Admin budgets' do
context "Calculate Budget's Winner Investments" do
- scenario 'For a Budget in reviewing balloting', :js do
- budget = create(:budget, phase: 'reviewing_ballots')
+ scenario "For a Budget in reviewing balloting", :js do
+ budget = create(:budget, phase: "reviewing_ballots")
group = create(:budget_group, budget: budget)
heading = create(:budget_heading, group: group, price: 4)
unselected = create(:budget_investment, :unselected, heading: heading, price: 1,
@@ -250,16 +246,16 @@ feature 'Admin budgets' do
selected = create(:budget_investment, :selected, heading: heading, price: 2, ballot_lines_count: 1)
visit edit_admin_budget_path(budget)
- expect(page).not_to have_content 'See results'
- click_link 'Calculate Winner Investments'
- expect(page).to have_content 'Winners being calculated, it may take a minute.'
+ expect(page).not_to have_content "See results"
+ click_link "Calculate Winner Investments"
+ expect(page).to have_content "Winners being calculated, it may take a minute."
expect(page).to have_content winner.title
expect(page).not_to have_content unselected.title
expect(page).not_to have_content selected.title
visit edit_admin_budget_path(budget)
- expect(page).to have_content 'See results'
+ expect(page).to have_content "See results"
end
scenario "For a finished Budget" do
diff --git a/spec/features/admin/debates_spec.rb b/spec/features/admin/debates_spec.rb
index 874707eac..18c238646 100644
--- a/spec/features/admin/debates_spec.rb
+++ b/spec/features/admin/debates_spec.rb
@@ -3,13 +3,13 @@ require "rails_helper"
feature "Admin debates" do
scenario "Disabled with a feature flag" do
- Setting["feature.debates"] = nil
+ Setting["process.debates"] = nil
admin = create(:administrator)
login_as(admin.user)
expect{ visit admin_debates_path }.to raise_exception(FeatureFlags::FeatureDisabled)
- Setting["feature.debates"] = true
+ Setting["process.debates"] = true
end
background do
diff --git a/spec/features/admin/feature_flags_spec.rb b/spec/features/admin/feature_flags_spec.rb
index 92b8f0f55..155c822e7 100644
--- a/spec/features/admin/feature_flags_spec.rb
+++ b/spec/features/admin/feature_flags_spec.rb
@@ -17,12 +17,14 @@ feature "Admin feature flags" do
end
end
- scenario "Disable a feature" do
- setting_id = Setting.find_by(key: "feature.spending_proposals").id
+ scenario "Disable a participatory process" do
+ setting = Setting.find_by(key: "process.budgets")
+ budget = create(:budget)
visit admin_settings_path
+ within("#settings-tabs") { click_link "Participation processes" }
- within("#edit_setting_#{setting_id}") do
+ within("#edit_setting_#{setting.id}") do
expect(page).to have_button "Disable"
expect(page).not_to have_button "Enable"
click_button "Disable"
@@ -31,28 +33,27 @@ feature "Admin feature flags" do
visit admin_root_path
within("#side_menu") do
- expect(page).not_to have_link "Budgets"
- expect(page).not_to have_link "Spending proposals"
+ expect(page).not_to have_link "Participatory budgets"
end
- expect{ visit spending_proposals_path }.to raise_exception(FeatureFlags::FeatureDisabled)
- expect{ visit admin_spending_proposals_path }.to raise_exception(FeatureFlags::FeatureDisabled)
+ expect{ visit budget_path(budget) }.to raise_exception(FeatureFlags::FeatureDisabled)
+ expect{ visit admin_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled)
end
- scenario "Enable a disabled feature" do
- Setting["feature.spending_proposals"] = nil
- setting_id = Setting.find_by(key: "feature.spending_proposals").id
+ scenario "Enable a disabled participatory process" do
+ Setting["process.budgets"] = nil
+ setting = Setting.find_by(key: "process.budgets")
visit admin_root_path
within("#side_menu") do
- expect(page).not_to have_link "Budgets"
- expect(page).not_to have_link "Spending proposals"
+ expect(page).not_to have_link "Participatory budgets"
end
visit admin_settings_path
+ within("#settings-tabs") { click_link "Participation processes" }
- within("#edit_setting_#{setting_id}") do
+ within("#edit_setting_#{setting.id}") do
expect(page).to have_button "Enable"
expect(page).not_to have_button "Disable"
click_button "Enable"
@@ -61,7 +62,45 @@ feature "Admin feature flags" do
visit admin_root_path
within("#side_menu") do
- expect(page).to have_link "Spending proposals"
+ expect(page).to have_link "Participatory budgets"
+ end
+ end
+
+ scenario "Disable a feature" do
+ setting = Setting.find_by(key: "feature.spending_proposals")
+
+ visit admin_settings_path
+
+ within("#edit_setting_#{setting.id}") do
+ expect(page).to have_button "Disable"
+ expect(page).not_to have_button "Enable"
+ click_button "Disable"
+ end
+
+ expect(page).to have_content "Value updated"
+
+ within("#edit_setting_#{setting.id}") do
+ expect(page).to have_button "Enable"
+ expect(page).not_to have_button "Disable"
+ end
+ end
+
+ scenario "Enable a disabled feature" do
+ setting = Setting.find_by(key: "feature.map")
+
+ visit admin_settings_path
+
+ within("#edit_setting_#{setting.id}") do
+ expect(page).to have_button "Enable"
+ expect(page).not_to have_button "Disable"
+ click_button "Enable"
+ end
+
+ expect(page).to have_content "Value updated"
+
+ within("#edit_setting_#{setting.id}") do
+ expect(page).to have_button "Disable"
+ expect(page).not_to have_button "Enable"
end
end
diff --git a/spec/features/admin/hidden_budget_investments_spec.rb b/spec/features/admin/hidden_budget_investments_spec.rb
index 592f04144..1b1944ea0 100644
--- a/spec/features/admin/hidden_budget_investments_spec.rb
+++ b/spec/features/admin/hidden_budget_investments_spec.rb
@@ -12,11 +12,9 @@ feature "Admin hidden budget investments" do
end
scenario "Disabled with a feature flag" do
- Setting["feature.budgets"] = nil
+ Setting["process.budgets"] = nil
expect{ visit admin_hidden_budget_investments_path }.to raise_exception(FeatureFlags::FeatureDisabled)
-
- Setting["feature.budgets"] = true
end
scenario "List shows all relevant info" do
diff --git a/spec/features/admin/hidden_proposals_spec.rb b/spec/features/admin/hidden_proposals_spec.rb
index 71a290ecb..eb8c69b59 100644
--- a/spec/features/admin/hidden_proposals_spec.rb
+++ b/spec/features/admin/hidden_proposals_spec.rb
@@ -8,13 +8,11 @@ feature "Admin hidden proposals" do
end
scenario "Disabled with a feature flag" do
- Setting["feature.proposals"] = nil
+ Setting["process.proposals"] = nil
admin = create(:administrator)
login_as(admin.user)
expect{ visit admin_hidden_proposals_path }.to raise_exception(FeatureFlags::FeatureDisabled)
-
- Setting["feature.proposals"] = true
end
scenario "List shows all relevant info" do
diff --git a/spec/features/admin/legislation/draft_versions_spec.rb b/spec/features/admin/legislation/draft_versions_spec.rb
index 2de2345d6..5fedbab5a 100644
--- a/spec/features/admin/legislation/draft_versions_spec.rb
+++ b/spec/features/admin/legislation/draft_versions_spec.rb
@@ -16,7 +16,7 @@ feature "Admin legislation draft versions" do
context "Feature flag" do
scenario "Disabled with a feature flag" do
- Setting["feature.legislation"] = nil
+ Setting["process.legislation"] = nil
process = create(:legislation_process)
expect{ visit admin_legislation_process_draft_versions_path(process) }.to raise_exception(FeatureFlags::FeatureDisabled)
end
diff --git a/spec/features/admin/legislation/processes_spec.rb b/spec/features/admin/legislation/processes_spec.rb
index 895ea65f8..838dbe2bb 100644
--- a/spec/features/admin/legislation/processes_spec.rb
+++ b/spec/features/admin/legislation/processes_spec.rb
@@ -19,7 +19,7 @@ feature "Admin collaborative legislation" do
context "Feature flag" do
scenario "Disabled with a feature flag" do
- Setting["feature.legislation"] = nil
+ Setting["process.legislation"] = nil
expect{ visit admin_legislation_processes_path }
.to raise_exception(FeatureFlags::FeatureDisabled)
end
diff --git a/spec/features/admin/legislation/questions_spec.rb b/spec/features/admin/legislation/questions_spec.rb
index bd97672c7..ec1355f15 100644
--- a/spec/features/admin/legislation/questions_spec.rb
+++ b/spec/features/admin/legislation/questions_spec.rb
@@ -17,7 +17,7 @@ feature "Admin legislation questions" do
context "Feature flag" do
background do
- Setting["feature.legislation"] = nil
+ Setting["process.legislation"] = nil
end
scenario "Disabled with a feature flag" do
diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb
index 8282ab265..2424597cf 100644
--- a/spec/features/debates_spec.rb
+++ b/spec/features/debates_spec.rb
@@ -4,9 +4,8 @@ require "rails_helper"
feature "Debates" do
scenario "Disabled with a feature flag" do
- Setting["feature.debates"] = nil
+ Setting["process.debates"] = nil
expect{ visit debates_path }.to raise_exception(FeatureFlags::FeatureDisabled)
- Setting["feature.debates"] = true
end
context "Concerns" do
diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb
index ff71ec6d5..94904695a 100644
--- a/spec/features/emails_spec.rb
+++ b/spec/features/emails_spec.rb
@@ -380,7 +380,7 @@ feature "Emails" do
context "Budgets" do
background do
- Setting["feature.budgets"] = true
+ Setting["process.budgets"] = true
end
let(:author) { create(:user, :level_two) }
diff --git a/spec/features/moderation/budget_investments_spec.rb b/spec/features/moderation/budget_investments_spec.rb
index 58d61aa30..79aac76b5 100644
--- a/spec/features/moderation/budget_investments_spec.rb
+++ b/spec/features/moderation/budget_investments_spec.rb
@@ -12,7 +12,7 @@ feature "Moderate budget investments" do
end
scenario "Disabled with a feature flag" do
- Setting["feature.budgets"] = nil
+ Setting["process.budgets"] = nil
login_as(@mod.user)
expect{ visit moderation_budget_investments_path }.to raise_exception(FeatureFlags::FeatureDisabled)
diff --git a/spec/features/moderation/debates_spec.rb b/spec/features/moderation/debates_spec.rb
index df55f5cd5..bcf32e065 100644
--- a/spec/features/moderation/debates_spec.rb
+++ b/spec/features/moderation/debates_spec.rb
@@ -3,13 +3,11 @@ require "rails_helper"
feature "Moderate debates" do
scenario "Disabled with a feature flag" do
- Setting["feature.debates"] = nil
+ Setting["process.debates"] = nil
moderator = create(:moderator)
login_as(moderator.user)
expect{ visit moderation_debates_path }.to raise_exception(FeatureFlags::FeatureDisabled)
-
- Setting["feature.debates"] = true
end
scenario "Hide", :js do
diff --git a/spec/features/moderation/proposals_spec.rb b/spec/features/moderation/proposals_spec.rb
index 6dad35f57..513baf0b8 100644
--- a/spec/features/moderation/proposals_spec.rb
+++ b/spec/features/moderation/proposals_spec.rb
@@ -3,13 +3,11 @@ require "rails_helper"
feature "Moderate proposals" do
scenario "Disabled with a feature flag" do
- Setting["feature.proposals"] = nil
+ Setting["process.proposals"] = nil
moderator = create(:moderator)
login_as(moderator.user)
expect{ visit moderation_proposals_path }.to raise_exception(FeatureFlags::FeatureDisabled)
-
- Setting["feature.proposals"] = true
end
scenario "Hide", :js do
diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb
index f185a44ab..557c3d6a9 100644
--- a/spec/features/proposals_spec.rb
+++ b/spec/features/proposals_spec.rb
@@ -8,9 +8,8 @@ feature "Proposals" do
"proposal_path"
scenario "Disabled with a feature flag" do
- Setting["feature.proposals"] = nil
+ Setting["process.proposals"] = nil
expect{ visit proposals_path }.to raise_exception(FeatureFlags::FeatureDisabled)
- Setting["feature.proposals"] = true
end
context "Concerns" do
diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb
index 81c8cc2c6..49ef05562 100644
--- a/spec/features/users_spec.rb
+++ b/spec/features/users_spec.rb
@@ -409,11 +409,11 @@ feature "Users" do
visit user_path(user)
expect(page).to have_content("7 Comments")
- Setting["feature.debates"] = nil
+ Setting["process.debates"] = nil
visit user_path(user)
expect(page).to have_content("6 Comments")
- Setting["feature.budgets"] = nil
+ Setting["process.budgets"] = nil
visit user_path(user)
expect(page).to have_content("4 Comments")
end
diff --git a/spec/features/valuation/budget_investments_spec.rb b/spec/features/valuation/budget_investments_spec.rb
index 560d1ec14..fa918b500 100644
--- a/spec/features/valuation/budget_investments_spec.rb
+++ b/spec/features/valuation/budget_investments_spec.rb
@@ -12,7 +12,7 @@ feature "Valuation budget investments" do
end
scenario "Disabled with a feature flag" do
- Setting["feature.budgets"] = nil
+ Setting["process.budgets"] = nil
expect{
visit valuation_budget_budget_investments_path(create(:budget))
}.to raise_exception(FeatureFlags::FeatureDisabled)
diff --git a/spec/features/valuation/budgets_spec.rb b/spec/features/valuation/budgets_spec.rb
index bc5a828ec..fc20dcd75 100644
--- a/spec/features/valuation/budgets_spec.rb
+++ b/spec/features/valuation/budgets_spec.rb
@@ -8,10 +8,8 @@ feature "Valuation budgets" do
end
scenario "Disabled with a feature flag" do
- Setting["feature.budgets"] = nil
+ Setting["process.budgets"] = nil
expect{ visit valuation_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled)
-
- Setting["feature.budgets"] = true
end
context "Index" do