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

show breadcrumb in header component of project attributes page

Behrokh Satarnejade1529563e7bc
diff --git a/app/components/settings/project_custom_fields/edit_form_header_component.rb b/app/components/settings/project_custom_fields/edit_form_header_component.rb
index 932bd6d5c12..85aad8e8457 100644
--- a/app/components/settings/project_custom_fields/edit_form_header_component.rb
+++ b/app/components/settings/project_custom_fields/edit_form_header_component.rb
@@ -34,6 +34,11 @@ module Settings
@custom_field = custom_field
end
+
+ def breadcrumbs_items
+ [{ href: project_overview_path(@project.id), text: @project.name },
+ t("settings.project_attributes.heading")]
+ end
end
end
end
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 0b1d0169aa7..fdf0ceee914 100644
--- a/app/components/settings/project_custom_fields/header_component.html.erb
+++ b/app/components/settings/project_custom_fields/header_component.html.erb
@@ -4,30 +4,29 @@
render Primer::OpenProject::PageHeader.new do |header|
header.with_title(variant: :default) { t('settings.project_attributes.heading') }
header.with_description { t('settings.project_attributes.heading_description') }
- header.with_actions do
- flex_layout(justify_content: :space_between, align_items: :center) do |action_buttons_container|
- action_buttons_container.with_column(mr: 2) do
- render(Primer::Beta::Button.new(
- tag: :a,
- href: new_admin_settings_project_custom_field_path(type: "ProjectCustomField"),
- scheme: :primary,
- data: { turbo: "false", qa_selector: "new-project-custom-field-button" }
- )) do |button|
- button.with_leading_visual_icon(icon: :plus)
- t('settings.project_attributes.label_new_attribute')
- end
+ header.with_breadcrumbs(breadcrumbs_items)
+ flex_layout(justify_content: :space_between, align_items: :center) do |action_buttons_container|
+ action_buttons_container.with_column(mr: 2) do
+ header.with_action_button(tag: :a,
+ href: new_admin_settings_project_custom_field_path(type: "ProjectCustomField"),
+ scheme: :primary,
+ data: { turbo: "false", qa_selector: "new-project-custom-field-button" },
+ mobile_icon: 'plus',
+ mobile_label: t('settings.project_attributes.label_new_attribute')) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ t('settings.project_attributes.label_new_attribute')
end
- action_buttons_container.with_column do
- render(Primer::Alpha::Dialog.new(
- id: "project-custom-field-section-dialog", title: t('settings.project_attributes.label_new_section'),
- size: :medium_portrait
- )) do |dialog|
- dialog.with_show_button('aria-label': t('settings.project_attributes.label_new_section'), scheme: :default) do |button|
- button.with_leading_visual_icon(icon: :plus)
- t('settings.project_attributes.label_new_section')
- end
- render(Settings::ProjectCustomFieldSections::DialogBodyFormComponent.new())
+ end
+ action_buttons_container.with_column do
+ render(Primer::Alpha::Dialog.new(
+ id: "project-custom-field-section-dialog", title: t('settings.project_attributes.label_new_section'),
+ size: :medium_portrait
+ )) do |dialog|
+ dialog.with_show_button('aria-label': t('settings.project_attributes.label_new_section'), scheme: :default) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ t('settings.project_attributes.label_new_section')
end
+ render(Settings::ProjectCustomFieldSections::DialogBodyFormComponent.new())
end
end
end
diff --git a/app/components/settings/project_custom_fields/header_component.rb b/app/components/settings/project_custom_fields/header_component.rb
index 5970978e532..cf0b3e54cce 100644
--- a/app/components/settings/project_custom_fields/header_component.rb
+++ b/app/components/settings/project_custom_fields/header_component.rb
@@ -32,6 +32,10 @@ module Settings
include ApplicationHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable
+ def breadcrumbs_items
+ [{ href: admin_index_path, text: t("label_administration") },
+ t("settings.project_attributes.heading")]
+ end
end
end
end