diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb index b369d2cbc..387f38177 100644 --- a/app/controllers/admin/settings_controller.rb +++ b/app/controllers/admin/settings_controller.rb @@ -1,7 +1,9 @@ class Admin::SettingsController < Admin::BaseController def index - @settings = Setting.all + all_settings = (Setting.all).group_by { |s| s.feature_flag? } + @settings = all_settings[false] + @feature_flags = all_settings[true] end def update diff --git a/app/views/admin/settings/index.html.erb b/app/views/admin/settings/index.html.erb index f3b54b3be..be796d0c0 100644 --- a/app/views/admin/settings/index.html.erb +++ b/app/views/admin/settings/index.html.erb @@ -12,3 +12,23 @@ <% end %> + +

<%= t("admin.settings.index.feature_flags") %>

+ + diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index d1e7e20e2..d9fcd0e2e 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -123,6 +123,12 @@ en: index: title: Configuration settings update_setting: Update + feature_flags: Features + features: + enabled: "Feature enabled" + disabled: "Feature disabled" + enable: "Enable" + disable: "Disable" shared: proposal_search: button: Search diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index ff056cb83..d71cd7b0b 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -123,6 +123,12 @@ es: index: title: Configuración global update_setting: Actualizar + feature_flags: Funcionalidades + features: + enabled: "Funcionalidad activada" + disabled: "Funcionalidad desactivada" + enable: "Activar" + disable: "Desactivar" shared: proposal_search: button: Buscar diff --git a/config/locales/settings.en.yml b/config/locales/settings.en.yml index 0f784bce4..c51eb7831 100755 --- a/config/locales/settings.en.yml +++ b/config/locales/settings.en.yml @@ -12,3 +12,6 @@ en: votes_for_proposal_success: "Number of votes necessary for approval of a Proposal" email_domain_for_officials: "Email domain for public officials" per_page_code: "Code to be included on every page" + feature: + debates: Debates + spending_proposals: Spending proposals diff --git a/config/locales/settings.es.yml b/config/locales/settings.es.yml index 48fa493eb..98ff6ae39 100644 --- a/config/locales/settings.es.yml +++ b/config/locales/settings.es.yml @@ -12,3 +12,6 @@ es: votes_for_proposal_success: "Número de votos necesarios para aprobar una Propuesta" email_domain_for_officials: "Dominio de email para cargos públicos" per_page_code: "Código a incluir en cada página" + feature: + debates: Debates + spending_proposals: Propuestas de gasto diff --git a/spec/features/admin/feature_flags_spec.rb b/spec/features/admin/feature_flags_spec.rb index b4d2a006c..63c4f1d64 100644 --- a/spec/features/admin/feature_flags_spec.rb +++ b/spec/features/admin/feature_flags_spec.rb @@ -21,8 +21,9 @@ feature 'Admin feature flags' do visit admin_settings_path within("#edit_setting_#{setting_id}") do - fill_in "setting_#{setting_id}", with: '' - click_button 'Update' + expect(page).to have_button "Disable" + expect(page).to_not have_button "Enable" + click_button 'Disable' end visit admin_root_path @@ -48,8 +49,9 @@ feature 'Admin feature flags' do visit admin_settings_path within("#edit_setting_#{setting_id}") do - fill_in "setting_#{setting_id}", with: 'true' - click_button 'Update' + expect(page).to have_button "Enable" + expect(page).to_not have_button "Disable" + click_button 'Enable' end visit admin_root_path