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 SubHeader component in admin/settings/project_custom_fields

Henriette Darge6ccb9ba2aa77
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 d256f4bbed2..a9fe5181caf 100644
--- a/app/components/settings/project_custom_fields/header_component.html.erb
+++ b/app/components/settings/project_custom_fields/header_component.html.erb
@@ -1,32 +1,34 @@
-<% button_block = lambda do |button|
- button.with_leading_visual_icon(icon: :plus)
- t('settings.project_attributes.label_new_section')
-end %>
-
<%=
- component_wrapper do
- 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_breadcrumbs(breadcrumbs_items)
- header.with_action_button(tag: :a,
- href: new_admin_settings_project_custom_field_path(type: "ProjectCustomField"),
- scheme: :primary,
- data: { turbo: "false", test_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
+ 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_breadcrumbs(breadcrumbs_items)
+ end
+%>
- header.with_action_dialog(mobile_icon: :plus,
- mobile_label: t('settings.project_attributes.label_new_section'),
- dialog_arguments: {id: "project-custom-field-section-dialog", title: t('settings.project_attributes.label_new_section', size: :medium_portrait), size: :medium_portrait},
- button_arguments: {'aria-label': t('settings.project_attributes.label_new_section'), button_block: button_block}) do |dialog|
+<%=
+ render Primer::OpenProject::SubHeader.new do |subheader|
+ subheader.with_action_component 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')) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ t('settings.project_attributes.label_new_section')
+ end
dialog.with_body do
render(Settings::ProjectCustomFieldSections::DialogBodyFormComponent.new)
end
end
end
+
+ subheader.with_action_button(tag: :a,
+ href: new_admin_settings_project_custom_field_path(type: "ProjectCustomField"),
+ scheme: :primary,
+ data: { turbo: "false", test_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
+
end
%>
diff --git a/app/views/admin/settings/project_custom_fields/index.html.erb b/app/views/admin/settings/project_custom_fields/index.html.erb
index 71c74dbe15b..28a58287d6c 100644
--- a/app/views/admin/settings/project_custom_fields/index.html.erb
+++ b/app/views/admin/settings/project_custom_fields/index.html.erb
@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), t("settings.project_attributes.heading") %>
<div data-turbo="true">
- <%= render(Settings::ProjectCustomFields::HeaderComponent.new()) %>
+ <%= render(Settings::ProjectCustomFields::HeaderComponent.new) %>
<%= render(Settings::ProjectCustomFieldSections::IndexComponent.new(
project_custom_field_sections: @project_custom_field_sections
)) %>