-
<%= t("admin.homepage.feeds.#{feed.kind}") %>
+
<%= t("admin.homepage.feeds.#{feed.kind}") %>
<%= render "setting", setting: feed.setting %>
diff --git a/app/views/admin/homepage/_setting.html.erb b/app/views/admin/homepage/_setting.html.erb
index f875e3e7d..34aafe3b4 100644
--- a/app/views/admin/homepage/_setting.html.erb
+++ b/app/views/admin/homepage/_setting.html.erb
@@ -1,10 +1 @@
-
- <%= form_for(setting, url: admin_setting_path(setting), method: :put) do |f| %>
-
- <%= f.hidden_field :value,
- value: (setting.enabled? ? "" : "active") %>
-
- <%= f.submit(t("admin.settings.index.features.#{setting.enabled? ? "disable" : "enable"}"),
- class: "button #{setting.enabled? ? "hollow alert" : "success"}") %>
- <% end %>
-
+<%= render Admin::Settings::FeaturedSettingsFormComponent.new(setting, describedby: false) %>
diff --git a/app/views/admin/homepage/show.html.erb b/app/views/admin/homepage/show.html.erb
index 3c933c961..367d5cd9e 100644
--- a/app/views/admin/homepage/show.html.erb
+++ b/app/views/admin/homepage/show.html.erb
@@ -38,7 +38,7 @@
-
<%= t("settings.#{@recommendations.key}") %>
+ <%= t("settings.#{@recommendations.key}") %>
<%= render "setting", setting: @recommendations %>
diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml
index 42a20478c..b5ee4bd08 100644
--- a/config/i18n-tasks.yml
+++ b/config/i18n-tasks.yml
@@ -160,7 +160,6 @@ ignore_unused:
- "admin.legislation.draft_versions.*.submit_button"
- "admin.legislation.questions.*.submit_button"
- "admin.hidden_comments.index.hidden_*"
- - "admin.settings.index.features.*"
- "admin.polls.*.submit_button"
- "admin.booths.*.submit_button"
- "admin.admin_notifications.*.submit_button"
diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml
index b797b26a4..0749e67c6 100644
--- a/config/locales/en/admin.yml
+++ b/config/locales/en/admin.yml
@@ -1299,8 +1299,6 @@ en:
feature_flags: Features
features:
enabled: "Enabled"
- enable: "Enable"
- disable: "Disable"
map:
title: Map configuration
help: Here you can customize the way the map is displayed to users. Drag map marker or click anywhere over the map, set desired zoom and click button "Update".
diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml
index da1b4b075..5ffce5ea8 100644
--- a/config/locales/es/admin.yml
+++ b/config/locales/es/admin.yml
@@ -1298,8 +1298,6 @@ es:
feature_flags: Funcionalidades
features:
enabled: "Activada"
- enable: "Activar"
- disable: "Desactivar"
map:
title: Configuración del mapa
help: Aquí puedes personalizar la manera en la que se muestra el mapa a los usuarios. Arrastra el marcador o pulsa sobre cualquier parte del mapa, ajusta el zoom y pulsa el botón 'Actualizar'.
diff --git a/spec/components/admin/settings/featured_settings_form_component_spec.rb b/spec/components/admin/settings/featured_settings_form_component_spec.rb
index f01455405..bc04198ea 100644
--- a/spec/components/admin/settings/featured_settings_form_component_spec.rb
+++ b/spec/components/admin/settings/featured_settings_form_component_spec.rb
@@ -11,10 +11,18 @@ describe Admin::Settings::FeaturedSettingsFormComponent do
expect(page).to have_css "button[aria-labelledby='title_setting_#{setting.id}']"
end
- it "includes an aria-describedby attribute" do
- render_inline component
+ describe "aria-describedby attribute" do
+ it "is rendered by default" do
+ render_inline component
- expect(page).to have_css "button[aria-describedby='description_setting_#{setting.id}']"
+ expect(page).to have_css "button[aria-describedby='description_setting_#{setting.id}']"
+ end
+
+ it "is not rendered when the describedby option is false" do
+ render_inline Admin::Settings::FeaturedSettingsFormComponent.new(setting, describedby: false)
+
+ expect(page).not_to have_css "[aria-describedby]"
+ end
end
describe "aria-pressed attribute" do
diff --git a/spec/system/admin/homepage/homepage_spec.rb b/spec/system/admin/homepage/homepage_spec.rb
index 3783002a8..f7f89a233 100644
--- a/spec/system/admin/homepage/homepage_spec.rb
+++ b/spec/system/admin/homepage/homepage_spec.rb
@@ -33,7 +33,7 @@ describe "Homepage", :admin do
within("#widget_feed_#{proposals_feed.id}") do
select "1", from: "widget_feed_limit"
- click_button "Enable"
+ click_button "No"
end
visit root_path
@@ -52,7 +52,7 @@ describe "Homepage", :admin do
visit admin_homepage_path
within("#widget_feed_#{debates_feed.id}") do
select "2", from: "widget_feed_limit"
- click_button "Enable"
+ click_button "No"
end
visit root_path
@@ -73,12 +73,12 @@ describe "Homepage", :admin do
within("#widget_feed_#{proposals_feed.id}") do
select "3", from: "widget_feed_limit"
- click_button "Enable"
+ click_button "No"
end
within("#widget_feed_#{debates_feed.id}") do
select "3", from: "widget_feed_limit"
- click_button "Enable"
+ click_button "No"
end
visit root_path
@@ -100,7 +100,7 @@ describe "Homepage", :admin do
visit admin_homepage_path
within("#widget_feed_#{processes_feed.id}") do
select "3", from: "widget_feed_limit"
- click_button "Enable"
+ click_button "No"
end
visit root_path
@@ -153,8 +153,8 @@ describe "Homepage", :admin do
create(:proposal, tag_list: "Sport")
visit admin_homepage_path
- within("#setting_#{user_recommendations.id}") do
- click_button "Enable"
+ within("#edit_setting_#{user_recommendations.id}") do
+ click_button "No"
end
expect(page).to have_content "Value updated"