Skip to content

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

Allow feature flag to have descriptions and show them in admin

Christophe Bliard9bfb7be07072
diff --git a/app/views/admin/settings/experimental_settings/show.html.erb b/app/views/admin/settings/experimental_settings/show.html.erb
index 99fb53c6018..3145a8299f3 100644
--- a/app/views/admin/settings/experimental_settings/show.html.erb
+++ b/app/views/admin/settings/experimental_settings/show.html.erb
@@ -42,8 +42,13 @@ See COPYRIGHT and LICENSE files for more details.
</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>
+ <% OpenProject::FeatureDecisions.all.each do |feature| %>
+ <div class="form--field">
+ <%= setting_check_box "feature_#{feature}_active", not_translated_label: feature.to_s.humanize %>
+ <div class="form--field-instructions">
+ <p><%= Settings::Definition["feature_#{feature}_active"].description %></p>
+ </div>
+ </div>
<% end %>
</fieldset>
</section>
diff --git a/lib_static/open_project/feature_decisions.rb b/lib_static/open_project/feature_decisions.rb
index 9e0e5506782..f5c13a0a47b 100644
--- a/lib_static/open_project/feature_decisions.rb
+++ b/lib_static/open_project/feature_decisions.rb
@@ -58,10 +58,10 @@ module OpenProject
module FeatureDecisions
module_function
- def add(flag_name)
+ def add(flag_name, description: nil)
all << flag_name
define_flag_methods(flag_name)
- define_setting_definition(flag_name)
+ define_setting_definition(flag_name, description:)
end
def active
@@ -78,8 +78,9 @@ module OpenProject
end
end
- def define_setting_definition(flag_name)
+ def define_setting_definition(flag_name, description: nil)
Settings::Definition.add :"feature_#{flag_name}_active",
+ description:,
default: Rails.env.development?
end
end