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
feature/48815 user interface for activating feature flags within the settings (#12966)
Wieland Lindenthal494da7a2d2f0
diff --git a/app/controllers/admin/settings/experimental_settings_controller.rb b/app/controllers/admin/settings/experimental_settings_controller.rbnew file mode 100644index 00000000000..9a1ab039169--- /dev/null+++ b/app/controllers/admin/settings/experimental_settings_controller.rb@@ -0,0 +1,37 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2023 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Admin::Settings+ class ExperimentalSettingsController < ::Admin::SettingsController+ menu_item :settings++ def default_breadcrumb+ t(:label_experimental)+ end+ end+enddiff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rbindex 365665de099..730764bd593 100644--- a/app/helpers/settings_helper.rb+++ b/app/helpers/settings_helper.rb@@ -58,6 +58,11 @@ module SettingsHelpername: 'repositories',controller: '/admin/settings/repositories_settings',label: :label_repository_plural+ },+ {+ name: 'experimental',+ controller: '/admin/settings/experimental_settings',+ label: :label_experimental}]end@@ -183,7 +188,7 @@ module SettingsHelperreturn ''.html_safe if label == falsestyled_label_tag(- "settings_#{setting}", I18n.t(label || "setting_#{setting}"),+ "settings_#{setting}", options[:not_translated_label] || I18n.t(label || "setting_#{setting}"),options.slice(:title))enddiff --git a/app/views/admin/settings/experimental_settings/show.html.erb b/app/views/admin/settings/experimental_settings/show.html.erbnew file mode 100644index 00000000000..5db821c0d33--- /dev/null+++ b/app/views/admin/settings/experimental_settings/show.html.erb@@ -0,0 +1,55 @@+<%#-- copyright+OpenProject is an open source project management software.+Copyright (C) 2012-2023 the OpenProject GmbH++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License version 3.++OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+Copyright (C) 2006-2013 Jean-Philippe Lang+Copyright (C) 2010-2013 the ChiliProject Team++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License+as published by the Free Software Foundation; either version 2+of the License, or (at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; if not, write to the Free Software+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.++See COPYRIGHT and LICENSE files for more details.++++#%>+<%= toolbar title: t(:label_experimental) %>++<%= styled_form_tag(admin_settings_update_experimental_path, method: :patch) do %>+ <section class="form--section">+ <fieldset class="form--fieldset">+ <legend class="form--fieldset-legend"><%= t('settings.experimental.feature_flags') %></legend>++ <div class="op-toast -warning -with-bottom-spacing">+ <div class="op-toast--content">+ <p>+ <%= t('settings.experimental.warning_toast') %>++ </p>+ </div>+ </div>++ <% ::OpenProject::FeatureDecisions.all.each do |feature| %>+ <div class="form--field"><%= setting_check_box "feature_#{feature}_active", not_translated_label: feature.to_s %></div>+ <% end %>+ </fieldset>+ </section>+ <%= styled_button_tag t(:button_save),+ class: '-highlight -with-icon icon-checkmark',+ data: {+ confirm: t("settings.experimental.save_confirmation")+ } %>+<% end %>diff --git a/config/initializers/menus.rb b/config/initializers/menus.rbindex 8edf60f82fa..b87d5910f32 100644--- a/config/initializers/menus.rb+++ b/config/initializers/menus.rb@@ -319,7 +319,7 @@ Redmine::MenuManager.map :admin_menu do |menu|menu.push :"settings_#{node[:name]}",{ controller: node[:controller], action: :show },caption: node[:label],- if: Proc.new { User.current.admin? },+ if: Proc.new { User.current.admin? && node[:name] != 'experimental' },parent: :settingsenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex aeaba77092b..afbab364dfe 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1709,6 +1709,7 @@ en:label_equals: "is"label_everywhere: "everywhere"label_example: "Example"+ label_experimental: "Experimental"label_import: "Import"label_export_to: "Also available in:"label_expanded_click_to_collapse: "Expanded. Click to collapse"@@ -2726,6 +2727,10 @@ en:first_week_of_year_text: >Select the date of January that is contained in the first week of the year.This value together with first day of the week determines the total number of weeks in a year.+ experimental:+ save_confirmation: Caution! Risk of data loss! Only activate experimental features if you do not mind breaking your OpenProject installation and losing all of its data.+ warning_toast: Feature flags are settings that activate features that are still under development. They shall only be used for testing purposes. They shall never be activated on OpenProject installations holding important data. These features will very likely corrupt your data. Use them at your own risk.+ feature_flags: Feature flagsprojects:section_new_projects: "Settings for new projects"section_project_overview: "Settings for project overview list"