Render 'how to enable' when the related feature setting is disabled

Add 'how to enable' information on SDG configuration tab when related
sdg feature setting is disabled.
This commit is contained in:
taitus
2020-11-11 19:45:37 +01:00
committed by Javi Martín
parent 676adfcb3f
commit 72e64bd543
4 changed files with 35 additions and 2 deletions

View File

@@ -1,3 +1,9 @@
<h2><%= t("admin.settings.index.sdg.title") %></h2>
<% if feature?(:sdg) %>
<h2><%= t("admin.settings.index.sdg.title") %></h2>
<%= render "featured_settings_table", features: @sdg_settings, tab: "#tab-sdg-configuration" %>
<%= render "featured_settings_table", features: @sdg_settings, tab: "#tab-sdg-configuration" %>
<% else %>
<div class="callout primary">
<%= t("admin.settings.index.sdg.how_to_enable") %>
</div>
<% end %>

View File

@@ -1242,6 +1242,7 @@ en:
how_to_enable: 'To configure remote census (SOAP) you must enable "Configure connection to remote census (SOAP)" on "Features" tab.'
sdg:
title: SDG configuration
how_to_enable: 'To show the configuration options from Sustainable Development Goals you must enable "SDG" on "Features" tab.'
remote_census_general_name: General Information
remote_census_request_name: Request Data
remote_census_response_name: Response Data

View File

@@ -1241,6 +1241,7 @@ es:
how_to_enable: 'Para configurar la conexión con el Censo Remoto (SOAP) se debe activar "Configurar la conexión al censo remoto (SOAP)" en la pestaña "Funcionalidades".'
sdg:
title: Configuración ODS
how_to_enable: 'Para mostrar las opciones de configuración de los Objetivos de Desarrollo Sostenible se debe activar "ODS" en la pestaña "Funcionalidades".'
remote_census_general_name: Datos Generales
remote_census_request_name: Datos Petición
remote_census_response_name: Datos Respuesta

View File

@@ -267,6 +267,7 @@ describe "Admin settings", :admin do
end
scenario "On #tab-sdg-configuration", :js do
Setting["feature.sdg"] = true
Setting.create!(key: "sdg.whatever")
login_as(create(:administrator).user)
@@ -313,4 +314,28 @@ describe "Admin settings", :admin do
Setting["feature.user.skip_verification"] = nil
end
end
describe "SDG configuration tab", :js do
scenario "is enabled when the sdg feature is enabled" do
Setting["feature.sdg"] = true
login_as(create(:administrator).user)
visit admin_settings_path
click_link "SDG configuration"
expect(page).to have_css "h2", exact_text: "SDG configuration"
end
scenario "is disabled when the sdg feature is disabled" do
Setting["feature.sdg"] = false
login_as(create(:administrator).user)
visit admin_settings_path
click_link "SDG configuration"
expect(page).to have_content "To show the configuration options from " \
"Sustainable Development Goals you must " \
'enable "SDG" on "Features" tab.'
end
end
end