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
Display error messages for missing custom field section on creating project custom fields.
Dombi Attila4d93ce97f98d
diff --git a/app/models/project_custom_field.rb b/app/models/project_custom_field.rbindex bb3775efaa9..d1aa6fe6077 100644--- a/app/models/project_custom_field.rb+++ b/app/models/project_custom_field.rb@@ -36,7 +36,7 @@ class ProjectCustomField < CustomFieldafter_save :activate_required_field_in_all_projects- validates :project_custom_field_section, presence: true+ validates :custom_field_section_id, presence: truedef type_name:label_project_pluraldiff --git a/app/views/custom_fields/_form.html.erb b/app/views/custom_fields/_form.html.erbindex c8d6cd1a10a..16dc232c5ac 100644--- a/app/views/custom_fields/_form.html.erb+++ b/app/views/custom_fields/_form.html.erb@@ -31,10 +31,11 @@ See COPYRIGHT and LICENSE files for more details.<%= f.text_field :name, required: true, container_class: '-middle' %></div><% if @custom_field.type == 'ProjectCustomField' %>- <div class="form--field">+ <div class="form--field -required"><%= f.select :custom_field_section_id,ProjectCustomFieldSection.all.collect { |s| [s.name, s.id] },- { container_class: '-slim' }+ { container_class: '-slim' },+ required: true%></div><% end %>diff --git a/spec/contracts/custom_fields/create_contract_spec.rb b/spec/contracts/custom_fields/create_contract_spec.rbindex 61702e115ad..1675b253e1e 100644--- a/spec/contracts/custom_fields/create_contract_spec.rb+++ b/spec/contracts/custom_fields/create_contract_spec.rb@@ -32,7 +32,7 @@ require 'contracts/shared/model_contract_shared_context'RSpec.describe CustomFields::CreateContract doinclude_context 'ModelContract shared context'- let(:cf) { build(:project_custom_field) }+ let(:cf) { build_stubbed(:project_custom_field) }let(:contract) dodescribed_class.new(cf, current_user, options: {})enddiff --git a/spec/contracts/custom_fields/update_contract_spec.rb b/spec/contracts/custom_fields/update_contract_spec.rbindex 9ff30cdb571..9f872d6ffb2 100644--- a/spec/contracts/custom_fields/update_contract_spec.rb+++ b/spec/contracts/custom_fields/update_contract_spec.rb@@ -32,7 +32,7 @@ require 'contracts/shared/model_contract_shared_context'RSpec.describe CustomFields::UpdateContract doinclude_context 'ModelContract shared context'- let(:cf) { build(:project_custom_field) }+ let(:cf) { build_stubbed(:project_custom_field) }let(:contract) dodescribed_class.new(cf, current_user)end