@@ -10,6 +10,7 @@ class Admin::SettingsController < Admin::BaseController
|
||||
@remote_census_request_settings = all_settings["remote_census.request"]
|
||||
@remote_census_response_settings = all_settings["remote_census.response"]
|
||||
@uploads_settings = all_settings["uploads"]
|
||||
@sdg_settings = all_settings["sdg"]
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
@@ -8,7 +8,7 @@ class Setting < ApplicationRecord
|
||||
end
|
||||
|
||||
def type
|
||||
if %w[feature process proposals map html homepage uploads].include? prefix
|
||||
if %w[feature process proposals map html homepage uploads sdg].include? prefix
|
||||
prefix
|
||||
elsif %w[remote_census].include? prefix
|
||||
key.rpartition(".").first
|
||||
@@ -184,7 +184,12 @@ class Setting < ApplicationRecord
|
||||
"remote_census.response.gender": "",
|
||||
"remote_census.response.name": "",
|
||||
"remote_census.response.surname": "",
|
||||
"remote_census.response.valid": ""
|
||||
"remote_census.response.valid": "",
|
||||
"sdg.process.debates": false,
|
||||
"sdg.process.proposals": false,
|
||||
"sdg.process.polls": false,
|
||||
"sdg.process.budgets": false,
|
||||
"sdg.process.legislation": false
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -47,4 +47,10 @@
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="tabs-title" id="sdg-tab">
|
||||
<%= link_to "#tab-sdg-configuration" do %>
|
||||
<%= t("admin.settings.index.sdg.title") %>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
3
app/views/admin/settings/_sdg_configuration_tab.html.erb
Normal file
3
app/views/admin/settings/_sdg_configuration_tab.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<h2><%= t("admin.settings.index.sdg.title") %></h2>
|
||||
|
||||
<%= render "featured_settings_table", features: @sdg_settings, tab: "#tab-sdg-configuration" %>
|
||||
@@ -29,4 +29,8 @@
|
||||
<div class="tabs-panel" id="tab-remote-census-configuration">
|
||||
<%= render "remote_census_configuration_tab" %>
|
||||
</div>
|
||||
|
||||
<div class="tabs-panel" id="tab-sdg-configuration">
|
||||
<%= render "sdg_configuration_tab" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1240,6 +1240,8 @@ en:
|
||||
remote_census:
|
||||
title: Remote Census configuration
|
||||
how_to_enable: 'To configure remote census (SOAP) you must enable "Configure connection to remote census (SOAP)" on "Features" tab.'
|
||||
sdg:
|
||||
title: SDG configuration
|
||||
remote_census_general_name: General Information
|
||||
remote_census_request_name: Request Data
|
||||
remote_census_response_name: Response Data
|
||||
|
||||
@@ -207,3 +207,15 @@ en:
|
||||
max_size_description: "Maximum size allowed for an uploaded document (in Megabytes/MB)"
|
||||
content_types: "Accepted content types for documents"
|
||||
content_types_description: "Select all the content types allowed for uploaded documents"
|
||||
sdg:
|
||||
process:
|
||||
debates: Related SDG in debates
|
||||
debates_description: Allow debates to be linked to Sustainable Development Goals
|
||||
proposals: Related SDG in proposals
|
||||
proposals_description: Allow proposals to be linked to Sustainable Development Goals
|
||||
polls: Related SDG in polls
|
||||
polls_description: Allow polls to be linked to Sustainable Development Goals
|
||||
budgets: Related SDG in partipatory budgets
|
||||
budgets_description: Allow participatory budgets to be linked to Sustainable Development Goals
|
||||
legislation: Related SDG in collaborative legislation
|
||||
legislation_description: Allow collaborative legislation to be linked to Sustainable Development Goals
|
||||
|
||||
@@ -1239,6 +1239,8 @@ es:
|
||||
remote_census:
|
||||
title: Configuración del Censo Remoto
|
||||
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
|
||||
remote_census_general_name: Datos Generales
|
||||
remote_census_request_name: Datos Petición
|
||||
remote_census_response_name: Datos Respuesta
|
||||
|
||||
@@ -207,3 +207,15 @@ es:
|
||||
max_size_description: "Tamaño máximo permitido al subir un documento (en Megabytes/MB)"
|
||||
content_types: "Tipos de documentos permitidos"
|
||||
content_types_description: "Selecciona todos los tipos permitidos para los documentos subidos"
|
||||
sdg:
|
||||
process:
|
||||
debates: Alineamiento ODS en debates
|
||||
debates_description: Permitir alineamiento de los Objetivos de Desarrollo Sostenible en debates
|
||||
proposals: Alineamiento ODS en propuestas
|
||||
proposals_description: Permitir alineamiento de los Objetivos de Desarrollo Sostenible en propuestas
|
||||
polls: Alineamiento ODS en votaciones
|
||||
polls_description: Permitir alineamiento de los Objetivos de Desarrollo Sostenible en votaciones
|
||||
budgets: Alineamiento ODS en presupuestos participativos
|
||||
budgets_description: Permitir alineamiento de los Objetivos de Desarrollo Sostenible en presupuestos participativos
|
||||
legislation: Alineamiento ODS en legislación colaborativa
|
||||
legislation_description: Permitir alineamiento de los Objetivos de Desarrollo Sostenible en legislación colaborativa
|
||||
|
||||
@@ -15,6 +15,11 @@ section "Creating Settings" do
|
||||
"org_name": "CONSUL",
|
||||
"proposal_code_prefix": "MAD",
|
||||
"proposal_notification_minimum_interval_in_days": 0,
|
||||
"sdg.process.debates": "true",
|
||||
"sdg.process.proposals": "true",
|
||||
"sdg.process.polls": "true",
|
||||
"sdg.process.budgets": "true",
|
||||
"sdg.process.legislation": "true",
|
||||
"telegram_handle": "CONSUL",
|
||||
"twitter_handle": "@consul_dev",
|
||||
"twitter_hashtag": "#consul_dev",
|
||||
|
||||
@@ -53,6 +53,12 @@ describe Setting do
|
||||
expect(homepage_setting.type).to eq "homepage"
|
||||
end
|
||||
|
||||
it "returns the key prefix for 'sdg' settings" do
|
||||
sdg_setting = Setting.create!(key: "sdg.whatever")
|
||||
|
||||
expect(sdg_setting.type).to eq "sdg"
|
||||
end
|
||||
|
||||
it "returns the key prefix for 'remote_census.general' settings" do
|
||||
remote_census_general_setting = Setting.create!(key: "remote_census.general.whatever")
|
||||
expect(remote_census_general_setting.type).to eq "remote_census.general"
|
||||
|
||||
@@ -265,6 +265,21 @@ describe "Admin settings", :admin do
|
||||
expect(page).to have_current_path(admin_settings_path)
|
||||
expect(page).to have_css("div#tab-feature-flags.is-active")
|
||||
end
|
||||
|
||||
scenario "On #tab-sdg-configuration", :js do
|
||||
Setting.create!(key: "sdg.whatever")
|
||||
login_as(create(:administrator).user)
|
||||
|
||||
visit admin_settings_path
|
||||
click_link "SDG configuration"
|
||||
|
||||
accept_alert do
|
||||
within("tr", text: "Whatever") { click_button "Enable" }
|
||||
end
|
||||
|
||||
expect(page).to have_current_path(admin_settings_path)
|
||||
expect(page).to have_css("h2", exact_text: "SDG configuration")
|
||||
end
|
||||
end
|
||||
|
||||
describe "Skip verification" do
|
||||
|
||||
Reference in New Issue
Block a user