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

[#65416] Show custom field format on #new

Tobias Dillmann90a7b0ed1983
diff --git a/app/components/settings/project_custom_fields/new_form_header_component.html.erb b/app/components/settings/project_custom_fields/new_form_header_component.html.erb
index 23f18628b5a..85fe507eb96 100644
--- a/app/components/settings/project_custom_fields/new_form_header_component.html.erb
+++ b/app/components/settings/project_custom_fields/new_form_header_component.html.erb
@@ -31,6 +31,6 @@ See COPYRIGHT and LICENSE files for more details.
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title { t("settings.project_attributes.new.heading") }
header.with_description { t("settings.project_attributes.new.description") }
- header.with_breadcrumbs(breadcrumb_items)
+ header.with_breadcrumbs(breadcrumb_items, selected_item_font_weight: :normal)
end
%>
diff --git a/app/components/settings/project_custom_fields/new_form_header_component.rb b/app/components/settings/project_custom_fields/new_form_header_component.rb
index 4fe97008843..a5e7514982a 100644
--- a/app/components/settings/project_custom_fields/new_form_header_component.rb
+++ b/app/components/settings/project_custom_fields/new_form_header_component.rb
@@ -30,10 +30,13 @@ module Settings
module ProjectCustomFields
class NewFormHeaderComponent < ApplicationComponent
def breadcrumb_items
- [{ href: admin_index_path, text: t("label_administration") },
- { href: admin_settings_project_custom_fields_path, text: t("label_project_plural") },
- { href: admin_settings_project_custom_fields_path, text: t("settings.project_attributes.heading") },
- t("settings.project_attributes.new.heading")]
+ [
+ { href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_project_custom_fields_path, text: t("label_project_plural") },
+ { href: admin_settings_project_custom_fields_path, text: t("settings.project_attributes.heading") },
+ helpers.nested_breadcrumb_element(helpers.label_for_custom_field_format(model.field_format),
+ t("settings.project_attributes.new.heading"))
+ ]
end
end
end
diff --git a/app/views/admin/settings/project_custom_fields/new.html.erb b/app/views/admin/settings/project_custom_fields/new.html.erb
index 70b15251716..4be11d8fcd8 100644
--- a/app/views/admin/settings/project_custom_fields/new.html.erb
+++ b/app/views/admin/settings/project_custom_fields/new.html.erb
@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), t("settings.project_attributes.heading"), t("settings.project_attributes.new.heading") %>
-<%= render(Settings::ProjectCustomFields::NewFormHeaderComponent.new) %>
+<%= render(Settings::ProjectCustomFields::NewFormHeaderComponent.new(@custom_field)) %>
<% if @custom_field.field_format_calculated_value? %>
<%= render Admin::CustomFields::CalculatedValues::DetailsComponent.new(@custom_field) %>
diff --git a/app/views/custom_fields/new.html.erb b/app/views/custom_fields/new.html.erb
index e26bae36fee..706a94d2b77 100644
--- a/app/views/custom_fields/new.html.erb
+++ b/app/views/custom_fields/new.html.erb
@@ -36,7 +36,8 @@ See COPYRIGHT and LICENSE files for more details.
[{ href: admin_index_path, text: t(:label_administration) },
{ href: custom_fields_path, text: t(:label_custom_field_plural) },
{ href: custom_fields_path(tab: @custom_field.type), text: I18n.t(@custom_field.type_name) },
- t(:label_custom_field_new)]
+ nested_breadcrumb_element(label_for_custom_field_format(@custom_field.field_format), t(:label_custom_field_new))],
+ selected_item_font_weight: :normal
)
end
%>
diff --git a/spec/features/admin/custom_fields/projects/create_in_section_spec.rb b/spec/features/admin/custom_fields/projects/create_in_section_spec.rb
index 8caa38e9316..3648529dd92 100644
--- a/spec/features/admin/custom_fields/projects/create_in_section_spec.rb
+++ b/spec/features/admin/custom_fields/projects/create_in_section_spec.rb
@@ -58,7 +58,7 @@ RSpec.describe "Create project custom fields in sections", :js do
expect(page).to have_link("Administration")
expect(page).to have_link("Projects")
expect(page).to have_link("Project attributes")
- expect(page).to have_text("New attribute")
+ expect(page).to have_text("Integer: New attribute")
end
end