-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor settings related code #5325
Conversation
73317d9
to
4d4ed13
Compare
4d4ed13
to
0ea175c
Compare
0ea175c
to
6162e8c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Senen I've left some comments; let me know what you think!
P.S. I haven't reviewed the tests yet. Sorry! 🙏
app/components/admin/settings/content_types_form_component.html.erb
Outdated
Show resolved
Hide resolved
ea822a7
to
b61e633
Compare
ac20b59
to
1f8fc95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Senen I've left a few comments. Let me know what you think!
app/components/admin/settings/remote_census_tab_component.html.erb
Outdated
Show resolved
Hide resolved
18d3857
to
8f612c9
Compare
8f612c9
to
58fc81f
Compare
Now, with the same template we can render all kind of settings.
Instead of using a setting nested param `setting[:tab]`. We only need the tab param when rendering settings in the administration section. This change will make it easier rendering the correct tab after updating settings.
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.
Otherwise administrators cannot access the settings from other tabs.
Otherwise we get a AuthenticityToken exception. I was nor able to write a test to verify this change.
58fc81f
to
ea0cede
Compare
References
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 no longer want to depend on the setting key structure to decide how or where to render each setting.
Objectives
Do not rely on the setting key structure to decide where to render a setting or which interface to use. Now we are doing this in the view layer by using view components.
We hope customizing the settings or adding new ones will be easier for developers, too.
Visual Changes
Without changes.
Release notes
Installations using custom settings should add them to the new views when upgrading to the release 2.1.0.