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
disable project custom field management through custom fields UI
Jonas Jabarif7f3b2b16b10
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rbindex a9217b74da2..1c00b16886e 100644--- a/app/controllers/custom_fields_controller.rb+++ b/app/controllers/custom_fields_controller.rb@@ -27,7 +27,7 @@#++class CustomFieldsController < ApplicationController- include CustomFields::SharedActions+ include CustomFields::SharedActions # share logic with ProjectCustomFieldsControlllerlayout 'admin'before_action :require_admin@@ -37,7 +37,10 @@ class CustomFieldsController < ApplicationControllerdef index# loading wp cfs exclicity to allow for eager loading- @custom_fields_by_type = CustomField.all.where.not(type: 'WorkPackageCustomField').group_by { |f| f.class.name }+ @custom_fields_by_type = CustomField.all+ .where.not(type: 'WorkPackageCustomField')+ .where.not(type: 'ProjectCustomField') # ProjecCustomFields now managed in a different UI+ .group_by { |f| f.class.name }@custom_fields_by_type['WorkPackageCustomField'] = WorkPackageCustomField.includes(:types).all@tab = params[:tab] || 'WorkPackageCustomField'@@ -46,13 +49,12 @@ class CustomFieldsController < ApplicationControllerdef new@custom_field = new_custom_field- if @custom_field.nil?- flash[:error] = 'Invalid CF type'- redirect_to action: :index- end+ check_custom_fieldend- def edit; end+ def edit+ check_custom_field+ endprotected@@ -73,4 +75,12 @@ class CustomFieldsController < ApplicationControllerrescue ActiveRecord::RecordNotFoundrender_404end++ def check_custom_field+ if @custom_field.nil? || @custom_field.type == 'ProjectCustomField'+ # ProjecCustomFields now managed in a different UI+ flash[:error] = 'Invalid CF type'+ redirect_to action: :index+ end+ endenddiff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rbindex 09db112430e..8007f98c026 100644--- a/app/helpers/custom_fields_helper.rb+++ b/app/helpers/custom_fields_helper.rb@@ -41,12 +41,13 @@ module CustomFieldsHelperpath: custom_fields_path(tab: :TimeEntryCustomField),label: :label_spent_time},- {- name: 'ProjectCustomField',- partial: 'custom_fields/tab',- path: custom_fields_path(tab: :ProjectCustomField),- label: :label_project_plural- },+ # ProjecCustomFields now managed in a different UI+ # {+ # name: 'ProjectCustomField',+ # partial: 'custom_fields/tab',+ # path: custom_fields_path(tab: :ProjectCustomField),+ # label: :label_project_plural+ # },{name: 'VersionCustomField',partial: 'custom_fields/tab',