Move logic from key definition to views

Before this change, two important things depend on the format of each key,
where to render it in the administration panel and which kind of interface
to use for each setting. Following this strategy led us to a very complex
code, very difficult to maintain or modify. So, we do not want to depend
on the setting key structure anymore to decide how or where to render each
setting.

With this commit, we get rid of the key format-based rules. Now we render
each setting explicitly passing to it the type and the tab where it belongs.
This commit is contained in:
Senén Rodero Rodríguez
2023-12-07 17:06:42 +01:00
committed by Javi Martín
parent 91c3bde36b
commit f8835debae
19 changed files with 157 additions and 150 deletions

View File

@@ -1,16 +1,5 @@
class Admin::SettingsController < Admin::BaseController
def index
all_settings = Setting.all.group_by(&:type)
@configuration_settings = all_settings["configuration"]
@feature_settings = all_settings["feature"]
@participation_processes_settings = all_settings["process"]
@map_configuration_settings = all_settings["map"]
@proposals_settings = all_settings["proposals"]
@remote_census_general_settings = all_settings["remote_census.general"]
@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