OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#57655] Replace SettingsHelper.system_settings_tabs method
Tobias Dillmannf998889a64b5
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rbindex 9aea8d24eb0..d4ad0a0c38e 100644--- a/app/helpers/settings_helper.rb+++ b/app/helpers/settings_helper.rb@@ -32,31 +32,6 @@ module SettingsHelperextend selfinclude OpenProject::FormTagHelper- def system_settings_tabs- [- {- name: "general",- controller: "/admin/settings/general_settings",- label: :label_general- },- {- name: "languages",- controller: "/admin/settings/languages_settings",- label: :label_languages- },- {- name: "repositories",- controller: "/admin/settings/repositories_settings",- label: :label_repository_plural- },- {- name: "experimental",- controller: "/admin/settings/experimental_settings",- label: :label_experimental- }- ]- end-def setting_select(setting, choices, options = {})if blank_text = options.delete(:blank)choices = [[blank_text.is_a?(Symbol) ? I18n.t(blank_text) : blank_text, ""]] + choicesdiff --git a/app/views/admin/settings/experimental_settings/show.html.erb b/app/views/admin/settings/experimental_settings/show.html.erbindex 647e8281fc9..32fe0a08f86 100644--- a/app/views/admin/settings/experimental_settings/show.html.erb+++ b/app/views/admin/settings/experimental_settings/show.html.erb@@ -37,7 +37,7 @@ See COPYRIGHT and LICENSE files for more details.end%>-<%= styled_form_tag(admin_settings_update_experimental_path, method: :patch) do %>+<%= styled_form_tag(admin_settings_experimental_path, method: :patch) do %><section class="form--section"><fieldset class="form--fieldset"><legend class="form--fieldset-legend"><%= t('settings.experimental.feature_flags') %></legend>diff --git a/app/views/admin/settings/general_settings/show.html.erb b/app/views/admin/settings/general_settings/show.html.erbindex 3af6d73f1d4..d5075aaad5b 100644--- a/app/views/admin/settings/general_settings/show.html.erb+++ b/app/views/admin/settings/general_settings/show.html.erb@@ -39,7 +39,7 @@ See COPYRIGHT and LICENSE files for more details.%>-<%= styled_form_tag(admin_settings_update_general_path, method: :patch) do %>+<%= styled_form_tag(admin_settings_general_path, method: :patch) do %><section class="form--section"><div class="form--field"><%= setting_text_field :app_title, size: 30, container_class: '-middle' %></div><div class="form--field">diff --git a/app/views/admin/settings/languages_settings/show.html.erb b/app/views/admin/settings/languages_settings/show.html.erbindex 4b3312b5377..67086000008 100644--- a/app/views/admin/settings/languages_settings/show.html.erb+++ b/app/views/admin/settings/languages_settings/show.html.erb@@ -38,7 +38,7 @@ See COPYRIGHT and LICENSE files for more details.end%>-<%= styled_form_tag(admin_settings_update_languages_path, method: :patch) do %>+<%= styled_form_tag(admin_settings_languages_path, method: :patch) do %><section class="form--section"><div class="form--field" id="setting_available_languages">diff --git a/app/views/admin/settings/repositories_settings/show.html.erb b/app/views/admin/settings/repositories_settings/show.html.erbindex eb0d4810d74..316be6b0bdd 100644--- a/app/views/admin/settings/repositories_settings/show.html.erb+++ b/app/views/admin/settings/repositories_settings/show.html.erb@@ -38,7 +38,7 @@ See COPYRIGHT and LICENSE files for more details.end%>-<%= styled_form_tag(admin_settings_update_repositories_path, method: :patch) do %>+<%= styled_form_tag(admin_settings_repositories_path, method: :patch) do %><section class="form--section"><div class="form--field"><%= setting_check_box :autofetch_changesets %>diff --git a/config/initializers/menus.rb b/config/initializers/menus.rbindex 8800c3d6a77..f4f378c349a 100644--- a/config/initializers/menus.rb+++ b/config/initializers/menus.rb@@ -409,13 +409,29 @@ Redmine::MenuManager.map :admin_menu do |menu|caption: :label_system_settings,icon: "gear"- SettingsHelper.system_settings_tabs.each do |node|- menu.push :"settings_#{node[:name]}",- { controller: node[:controller], action: :show },- caption: node[:label],- if: Proc.new { User.current.admin? && (node[:name] != "experimental" || Rails.env.development?) },- parent: :settings- end+ menu.push :settings_general,+ { controller: "/admin/settings/general_settings", action: :show },+ if: Proc.new { User.current.admin? },+ caption: :label_general,+ parent: :settings++ menu.push :settings_languages,+ { controller: "/admin/settings/languages_settings", action: :show },+ if: Proc.new { User.current.admin? },+ caption: :label_languages,+ parent: :settings++ menu.push :settings_repositories,+ { controller: "/admin/settings/repositories_settings", action: :show },+ if: Proc.new { User.current.admin? },+ caption: :label_repository_plural,+ parent: :settings++ menu.push :settings_experimental,+ { controller: "/admin/settings/experimental_settings", action: :show },+ if: Proc.new { User.current.admin? && Rails.env.development? },+ caption: :label_experimental,+ parent: :settingsmenu.push :mail_and_notifications,{ controller: "/admin/settings/aggregation_settings", action: :show },diff --git a/config/routes.rb b/config/routes.rbindex f1c68581dc4..622a4a1effd 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -471,10 +471,10 @@ Rails.application.routes.draw donamespace :admin donamespace :settings do- SettingsHelper.system_settings_tabs.each do |tab|- get tab[:name], controller: tab[:controller], action: :show, as: tab[:name].to_s- patch tab[:name], controller: tab[:controller], action: :update, as: "update_#{tab[:name]}"- end+ resource :general, controller: "/admin/settings/general_settings", only: %i[show update]+ resource :languages, controller: "/admin/settings/languages_settings", only: %i[show update]+ resource :repositories, controller: "/admin/settings/repositories_settings", only: %i[show update]+ resource :experimental, controller: "/admin/settings/experimental_settings", only: %i[show update]resource :authentication, controller: "/admin/settings/authentication_settings", only: %i[show update]resource :attachments, controller: "/admin/settings/attachments_settings", only: %i[show update]