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

use a submenu for project cf creation

ulferts1cd27a5eb855
diff --git a/app/components/settings/project_custom_fields/header_component.html.erb b/app/components/settings/project_custom_fields/header_component.html.erb
index 70056a4be03..bc0a43f64e3 100644
--- a/app/components/settings/project_custom_fields/header_component.html.erb
+++ b/app/components/settings/project_custom_fields/header_component.html.erb
@@ -28,14 +28,11 @@
content_arguments: { data: { controller: "async-dialog" } }
)
- menu.with_divider
- menu.with_group do |group|
- group.with_heading(title: t("settings.project_attributes.label_new_attribute"))
-
+ menu.with_sub_menu_item(label: t("settings.project_attributes.label_new_attribute")) do |sub_menu|
OpenProject::CustomFieldFormat.all_for_class_name("Project")
.sort_by(&:name)
.map do |format|
- group.with_item(
+ sub_menu.with_item(
label: helpers.label_for_custom_field_format(format.name),
tag: :a,
href: new_admin_settings_project_custom_field_path(field_format: format.name),
diff --git a/spec/features/admin/custom_fields/projects/edit_spec.rb b/spec/features/admin/custom_fields/projects/edit_spec.rb
index d909a3a6acc..f1fee9d9bc2 100644
--- a/spec/features/admin/custom_fields/projects/edit_spec.rb
+++ b/spec/features/admin/custom_fields/projects/edit_spec.rb
@@ -95,7 +95,7 @@ RSpec.describe "Edit project custom fields", :js do
fill_in("custom_field_name", with: "")
click_on("Save")
- expect(page).to have_field "custom_field_name", validation_message: "Please fill out this field."
+ expect(page).to have_field "custom_field_name", validation_message: /Please fill (in|out) this field./
expect(page).to have_no_text("Successful update")
diff --git a/spec/support/pages/admin/custom_fields/custom_fields_projects/index.rb b/spec/support/pages/admin/custom_fields/custom_fields_projects/index.rb
index 3684942b422..92e9e18b48e 100644
--- a/spec/support/pages/admin/custom_fields/custom_fields_projects/index.rb
+++ b/spec/support/pages/admin/custom_fields/custom_fields_projects/index.rb
@@ -44,6 +44,8 @@ module Pages
click_button "Add"
+ click_button "Project attribute"
+
click_on type
end
end