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

hiding more parts of the new concept behind the feature flag

Jonas Jabarid529ee818a5d
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb
index 55c6898d45e..c229492a5db 100644
--- a/app/controllers/custom_fields_controller.rb
+++ b/app/controllers/custom_fields_controller.rb
@@ -39,8 +39,10 @@ class CustomFieldsController < ApplicationController
# loading wp cfs exclicity to allow for eager loading
@custom_fields_by_type = CustomField.all
.where.not(type: 'WorkPackageCustomField')
- .where.not(type: 'ProjectCustomField') # ProjecCustomFields now managed in a different UI
+ # ProjectCustomFields now managed in a different UI
+ .tap { |query| query.where.not(type: 'ProjectCustomField') unless OpenProject::FeatureDecisions.project_attributes_active? }
.group_by { |f| f.class.name }
+
@custom_fields_by_type['WorkPackageCustomField'] = WorkPackageCustomField.includes(:types).all
@tab = params[:tab] || 'WorkPackageCustomField'
@@ -77,8 +79,10 @@ class CustomFieldsController < ApplicationController
end
def check_custom_field
- if @custom_field.nil? || @custom_field.type == 'ProjectCustomField'
- # ProjecCustomFields now managed in a different UI
+ # ProjecCustomFields now managed in a different UI
+ if
+ OpenProject::FeatureDecisions.project_attributes_active? &&
+ (@custom_field.nil? || @custom_field.type == 'ProjectCustomField')
flash[:error] = 'Invalid CF type'
redirect_to action: :index
end
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 49cc14532a8..873052d234a 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -28,7 +28,7 @@
module CustomFieldsHelper
def custom_fields_tabs
- [
+ tabs = [
{
name: 'WorkPackageCustomField',
partial: 'custom_fields/tab',
@@ -41,13 +41,13 @@ module CustomFieldsHelper
path: custom_fields_path(tab: :TimeEntryCustomField),
label: :label_spent_time
},
- # ProjecCustomFields now managed in a different UI
- # {
- # name: 'ProjectCustomField',
- # partial: 'custom_fields/tab',
- # path: custom_fields_path(tab: :ProjectCustomField),
- # label: :label_project_plural
- # },
+
+ {
+ name: 'ProjectCustomField',
+ partial: 'custom_fields/tab',
+ path: custom_fields_path(tab: :ProjectCustomField),
+ label: :label_project_plural
+ },
{
name: 'VersionCustomField',
partial: 'custom_fields/tab',
@@ -67,6 +67,11 @@ module CustomFieldsHelper
label: :label_group_plural
}
]
+
+ # ProjecCustomFields now managed in a different UI
+ tabs.delete_if { |tab| tab[:name] == 'ProjectCustomField' && OpenProject::FeatureDecisions.project_attributes_active? }
+
+ tabs
end
# Return custom field html tag corresponding to its format
diff --git a/app/views/custom_fields/_form.html.erb b/app/views/custom_fields/_form.html.erb
index c8d6cd1a10a..c9033425b5f 100644
--- a/app/views/custom_fields/_form.html.erb
+++ b/app/views/custom_fields/_form.html.erb
@@ -30,7 +30,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="form--field -required" id="custom_field_name_attributes">
<%= f.text_field :name, required: true, container_class: '-middle' %>
</div>
- <% if @custom_field.type == 'ProjectCustomField' %>
+ <% if @custom_field.type == 'ProjectCustomField' && OpenProject::FeatureDecisions.project_attributes_active? %>
<div class="form--field">
<%= f.select :custom_field_section_id,
ProjectCustomFieldSection.all.collect { |s| [s.name, s.id] },