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

Introduce Primer::OpenProject::PageHeader in Admin/workPackages to harmonize the breadcrumb structure

Henriette Dargea7676bab78a0
diff --git a/app/views/workflows/_toolbar.html.erb b/app/components/types/edit_page_header_component.html.erb
similarity index 69%
rename from app/views/workflows/_toolbar.html.erb
rename to app/components/types/edit_page_header_component.html.erb
index aae1f2430f3..c698b4a6f38 100644
--- a/app/views/workflows/_toolbar.html.erb
+++ b/app/components/types/edit_page_header_component.html.erb
@@ -27,17 +27,17 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= toolbar title: title do %>
- <li class="toolbar-item hidden-for-tablet">
- <%= link_to({ action: 'copy' }, class: 'button') do %>
- <%= op_icon('button--icon icon-copy') %>
- <span class="button--text"><%= t(:button_copy) %></span>
- <% end %>
- </li>
- <li class="toolbar-item">
- <%= link_to({ action: 'show' }, class: 'button') do %>
- <%= op_icon('button--icon icon-info1') %>
- <span class="button--text"><%= t(:label_workflow_summary) %></span>
- <% end %>
- </li>
-<% end %>
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { @type.name }
+ header.with_breadcrumbs(breadcrumb_items)
+
+ header.with_tab_nav(label: nil) do |tab_nav|
+ @tabs.each do |tab|
+ tab_nav.with_tab(selected: selected_tab(@tabs) == tab, href: tab[:path]) do |t|
+ t.with_text { I18n.t("js.#{tab[:label]}") }
+ end
+ end
+ end if @tabs.present?
+ end
+%>
diff --git a/app/components/types/edit_page_header_component.rb b/app/components/types/edit_page_header_component.rb
new file mode 100644
index 00000000000..ea1a72818f6
--- /dev/null
+++ b/app/components/types/edit_page_header_component.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2010-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+# ++
+
+module Types
+ class EditPageHeaderComponent < ApplicationComponent
+ include OpPrimer::ComponentHelpers
+ include ApplicationHelper
+ include TabsHelper
+
+ def initialize(type:, tabs: nil)
+ super
+ @type = type
+ @tabs = tabs
+ end
+
+ def breadcrumb_items
+ [{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_work_package_tracking_path, text: t(:label_work_package_plural) },
+ { href: types_path, text: t(:label_type_plural) },
+ @type.name]
+ end
+ end
+end
diff --git a/app/components/workflows/page_header_component.html.erb b/app/components/workflows/page_header_component.html.erb
new file mode 100644
index 00000000000..14fa09c9355
--- /dev/null
+++ b/app/components/workflows/page_header_component.html.erb
@@ -0,0 +1,57 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2024 the OpenProject GmbH
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License version 3.
+
+OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+Copyright (C) 2006-2013 Jean-Philippe Lang
+Copyright (C) 2010-2013 the ChiliProject Team
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+See COPYRIGHT and LICENSE files for more details.
+
+++#%>
+
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { title }
+ header.with_breadcrumbs(breadcrumb_items)
+
+ header.with_action_button(tag: :a,
+ mobile_icon: :copy,
+ mobile_label: t(:button_copy),
+ size: :medium,
+ href: copy_workflows_path,
+ aria: { label: I18n.t(:button_copy) },
+ title: I18n.t(:button_copy)) do |button|
+ button.with_leading_visual_icon(icon: :copy)
+ t(:button_copy)
+ end
+
+ header.with_action_button(tag: :a,
+ mobile_icon: :info,
+ mobile_label: t(:label_workflow_summary),
+ size: :medium,
+ href: workflows_path,
+ aria: { label: I18n.t(:label_workflow_summary) },
+ title: I18n.t(:label_workflow_summary)) do |button|
+ button.with_leading_visual_icon(icon: :info)
+ t(:label_workflow_summary)
+ end
+ end
+%>
diff --git a/app/components/workflows/page_header_component.rb b/app/components/workflows/page_header_component.rb
new file mode 100644
index 00000000000..18c8e926cd7
--- /dev/null
+++ b/app/components/workflows/page_header_component.rb
@@ -0,0 +1,66 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2010-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+# ++
+
+module Workflows
+ class PageHeaderComponent < ApplicationComponent
+ include OpPrimer::ComponentHelpers
+ include ApplicationHelper
+
+ def initialize(state:)
+ super
+ @state = state
+ end
+
+ def breadcrumb_items
+ base_items = [{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_work_package_tracking_path, text: t(:label_work_package_plural) },
+ title]
+
+ if @state == :edit
+ base_items
+ else
+ base_items.insert(2, { href: edit_workflows_path, text: t(:label_workflow) })
+ end
+ end
+
+ def title
+ case @state
+ when :show
+ t(:label_workflow_summary)
+ when :copy
+ t(:label_workflow_copy)
+ when :edit
+ Workflow.model_name.human
+ else
+ t(:label_workflow_plural)
+ end
+ end
+ end
+end
diff --git a/app/controllers/admin/settings/work_packages_settings_controller.rb b/app/controllers/admin/settings/work_packages_settings_controller.rb
index 6d7134d0b48..9522f2ccb15 100644
--- a/app/controllers/admin/settings/work_packages_settings_controller.rb
+++ b/app/controllers/admin/settings/work_packages_settings_controller.rb
@@ -31,13 +31,5 @@ module Admin::Settings
current_menu_item :show do
:work_packages_setting
end
-
- def default_breadcrumb
- t(:label_work_package_tracking)
- end
-
- def show_local_breadcrumb
- true
- end
end
end
diff --git a/app/controllers/custom_actions_controller.rb b/app/controllers/custom_actions_controller.rb
index a676ef0410f..c55fa66ed1d 100644
--- a/app/controllers/custom_actions_controller.rb
+++ b/app/controllers/custom_actions_controller.rb
@@ -109,15 +109,9 @@ class CustomActionsController < ApplicationController
params[:custom_action][:actions] ||= {}
end
- def default_breadcrumb
- if action_name == "index"
- t("custom_actions.plural")
- else
- ActionController::Base.helpers.link_to(t("custom_actions.plural"), custom_actions_path)
- end
- end
-
def show_local_breadcrumb
- true
+ false
end
+
+ def default_breadcrumb; end
end
diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb
index c3b0e10784f..ab61b83be13 100644
--- a/app/controllers/statuses_controller.rb
+++ b/app/controllers/statuses_controller.rb
@@ -85,16 +85,8 @@ class StatusesController < ApplicationController
protected
- def default_breadcrumb
- if action_name == "index"
- t(:label_work_package_status_plural)
- else
- ActionController::Base.helpers.link_to(t(:label_work_package_status_plural), statuses_path)
- end
- end
-
def show_local_breadcrumb
- true
+ false
end
def recompute_progress_values
diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb
index 224593c207b..37b1a4c78a8 100644
--- a/app/controllers/types_controller.rb
+++ b/app/controllers/types_controller.rb
@@ -139,14 +139,6 @@ class TypesController < ApplicationController
notice:)
end
- def default_breadcrumb
- if action_name == "index"
- t(:label_work_package_types)
- else
- ActionController::Base.helpers.link_to(t(:label_work_package_types), types_path)
- end
- end
-
def render_edit_tab(type)
@tab = params[:tab]
@projects = Project.all
@@ -156,7 +148,7 @@ class TypesController < ApplicationController
end
def show_local_breadcrumb
- true
+ false
end
def update_success_message
diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb
index 26f94fb71b3..e17d054420e 100644
--- a/app/controllers/workflows_controller.rb
+++ b/app/controllers/workflows_controller.rb
@@ -93,16 +93,8 @@ class WorkflowsController < ApplicationController
end
end
- def default_breadcrumb
- if action_name == "edit"
- t("label_workflow")
- else
- ActionController::Base.helpers.link_to(t("label_workflow"), url_for(controller: "/workflows", action: "edit"))
- end
- end
-
def show_local_breadcrumb
- true
+ false
end
private
diff --git a/app/views/admin/settings/work_packages_settings/show.html.erb b/app/views/admin/settings/work_packages_settings/show.html.erb
index 9c8031bba8e..e4ae35b477d 100644
--- a/app/views/admin/settings/work_packages_settings/show.html.erb
+++ b/app/views/admin/settings/work_packages_settings/show.html.erb
@@ -27,9 +27,18 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<% html_title t(:label_administration), t(:label_work_package_tracking) -%>
+<% html_title t(:label_administration), t(:label_work_packages_settings) -%>
+
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { t(:label_work_packages_settings) }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_work_package_tracking_path, text: t(:label_work_package_plural) },
+ t(:label_work_packages_settings)])
+ end
+%>
+
-<%= toolbar title: t(:label_work_package_tracking) %>
<%= styled_form_tag({ action: :update }, method: :patch) do %>
<section class="form--section"
diff --git a/app/views/custom_actions/edit.html.erb b/app/views/custom_actions/edit.html.erb
index 8497d6473bb..a6eb1764136 100644
--- a/app/views/custom_actions/edit.html.erb
+++ b/app/views/custom_actions/edit.html.erb
@@ -29,8 +29,15 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), t('custom_actions.edit', name: @custom_action.name) %>
-<% local_assigns[:additional_breadcrumb] = t('custom_actions.edit', name: @custom_action.name) %>
-<%= breadcrumb_toolbar t('custom_actions.edit', name: @custom_action.name) %>
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { @custom_action.name }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_work_package_tracking_path, text: t(:label_work_package_plural) },
+ { href: custom_actions_path, text: t("custom_actions.plural") },
+ @custom_action.name ])
+ end
+%>
<%= error_messages_for @custom_action %>
diff --git a/app/views/custom_actions/index.html.erb b/app/views/custom_actions/index.html.erb
index 198a980abfd..7b56c168457 100644
--- a/app/views/custom_actions/index.html.erb
+++ b/app/views/custom_actions/index.html.erb
@@ -1,16 +1,26 @@
<% html_title t(:label_administration), t('custom_actions.plural') -%>
-<%= toolbar title: t('custom_actions.plural') do %>
- <li class="toolbar-item">
- <%= link_to new_custom_action_path,
- { class: 'button -primary',
- aria: { label: t('custom_actions.new') },
- title: t('custom_actions.new') } do %>
- <%= op_icon('button--icon icon-add') %>
- <span class="button--text"><%= CustomAction.model_name.human %></span>
- <% end %>
- </li>
-<% end %>
-<section class="admin--edit-section">
- <%= render(::CustomActions::TableComponent.new(rows: @custom_actions)) %>
-</section>
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { t("custom_actions.plural") }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_work_package_tracking_path, text: t(:label_work_package_plural) },
+ t("custom_actions.plural") ])
+ end
+%>
+
+<%=
+ render(Primer::OpenProject::SubHeader.new) do |subheader|
+ subheader.with_action_button(scheme: :primary,
+ aria: { label: I18n.t("custom_actions.new") },
+ title: I18n.t("custom_actions.new"),
+ test_selector: "op-admin-custom-actions--button-new",
+ tag: :a,
+ href: new_custom_action_path) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ CustomAction.model_name.human
+ end
+ end
+%>
+
+<%= render(::CustomActions::TableComponent.new(rows: @custom_actions)) %>
diff --git a/app/views/custom_actions/new.html.erb b/app/views/custom_actions/new.html.erb
index a836500870e..ecaba4c5508 100644
--- a/app/views/custom_actions/new.html.erb
+++ b/app/views/custom_actions/new.html.erb
@@ -29,8 +29,15 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), t('custom_actions.new') %>
-<% local_assigns[:additional_breadcrumb] = t('custom_actions.new') %>
-<%= breadcrumb_toolbar t('custom_actions.new') %>
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { t("custom_actions.new") }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_work_package_tracking_path, text: t(:label_work_package_plural) },
+ { href: custom_actions_path, text: t("custom_actions.plural") },
+ t("custom_actions.new") ])
+ end
+%>
<%= error_messages_for @custom_action %>
diff --git a/app/views/statuses/edit.html.erb b/app/views/statuses/edit.html.erb
index cfcdca7a027..50aa5d22be7 100644
--- a/app/views/statuses/edit.html.erb
+++ b/app/views/statuses/edit.html.erb
@@ -28,8 +28,16 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_administration), "#{t(:label_edit)} #{Status.model_name.human} #{h @status.name}" %>
-<% local_assigns[:additional_breadcrumb] = @status.name %>
-<%= breadcrumb_toolbar @status.name %>
+
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { @status.name }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_work_package_tracking_path, text: t(:label_work_package_plural) },
+ { href: statuses_path, text: t(:label_status) },
+ @status.name])
+ end
+%>
<%= labelled_tabular_form_for(@status) do |f| %>
<%= render partial: 'form', locals: { f: f } %>
diff --git a/app/views/statuses/index.html.erb b/app/views/statuses/index.html.erb
index f86e4a91d1e..b8b6996ad0a 100644
--- a/app/views/statuses/index.html.erb
+++ b/app/views/statuses/index.html.erb
@@ -27,17 +27,27 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<% html_title t(:label_administration), t(:label_work_package_status_plural) -%>
-<%= toolbar title: t(:label_work_package_status_plural) do %>
- <li class="toolbar-item">
- <%= link_to new_status_path,
- { class: 'button -primary',
- aria: {label: t(:label_work_package_status_new)},
- title: t(:label_work_package_status_new)} do %>
- <%= op_icon('button--icon icon-add') %>
- <span class="button--text"><%= t(:label_status) %></span>
- <% end %>
- </li>
-<% end %>
+<% html_title t(:label_administration), t(:label_work_package_plural), I18n.t(:label_status) -%>
+
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { I18n.t(:label_status) }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_work_package_tracking_path, text: t(:label_work_package_plural) },
+ I18n.t(:label_status)])
+ end
+%>
+<%=
+ render(Primer::OpenProject::SubHeader.new) do |subheader|
+ subheader.with_action_button(scheme: :primary,
+ aria: { label: I18n.t(:label_work_package_status_new) },
+ title: I18n.t(:label_work_package_status_new),
+ tag: :a,
+ href: new_status_path) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ t(:label_status)
+ end
+ end
+%>
<%= render ::Statuses::TableComponent.new(rows: @statuses) %>
diff --git a/app/views/statuses/new.html.erb b/app/views/statuses/new.html.erb
index a33c1274f87..e7a84b6fa4b 100644
--- a/app/views/statuses/new.html.erb
+++ b/app/views/statuses/new.html.erb
@@ -28,8 +28,16 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_administration), t(:label_work_package_status_new) %>
-<% local_assigns[:additional_breadcrumb] = t(:label_work_package_status_new) %>
-<%= breadcrumb_toolbar t(:label_work_package_status_new) %>
+
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { t(:label_work_package_status_new) }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_work_package_tracking_path, text: t(:label_work_package_plural) },
+ { href: statuses_path, text: t(:label_status) },
+ t(:label_work_package_status_new)])
+ end
+%>
<%= labelled_tabular_form_for(@status) do |f| %>
<%= render partial: 'form', locals: { f: f } %>
diff --git a/app/views/types/edit.html.erb b/app/views/types/edit.html.erb
index 8fa0b5f8858..b0a1212868f 100644
--- a/app/views/types/edit.html.erb
+++ b/app/views/types/edit.html.erb
@@ -29,19 +29,16 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @type.name}" %>
+<% tabs = types_tabs %>
-<% local_assigns[:additional_breadcrumb] = @type.name %>
-
-<div class="grid-content">
- <%= breadcrumb_toolbar @type.name %>
-</div>
+<%= render ::Types::EditPageHeaderComponent.new(type: @type, tabs: tabs) %>
<%= form_for @type,
url: update_type_tab_path(id: @type.id, tab: @tab),
builder: TabularFormBuilder,
lang: current_language do |f| %>
- <%= render_tabs types_tabs, f %>
+ <%= render_tabs tabs, f, with_tab_nav: false %>
<% end %>
<%= error_messages_for 'type' %>
diff --git a/app/views/types/index.html.erb b/app/views/types/index.html.erb
index d54eef893a9..12d520ed14e 100644
--- a/app/views/types/index.html.erb
+++ b/app/views/types/index.html.erb
@@ -28,19 +28,28 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_administration), t("label_type_plural") %>
-<%= toolbar title: t(:label_work_package_types) do %>
- <li class="toolbar-item">
- <%= link_to new_type_path,
- { class: 'button -primary',
- aria: { label: t(:label_type_new) },
- title: t(:label_type_new)} do %>
- <%= op_icon('button--icon icon-add') %>
- <span class="button--text">
- <%= t('activerecord.attributes.work_package.type') %>
- </button>
- <% end %>
- </li>
-<% end %>
+
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { t(:label_type_plural) }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_work_package_tracking_path, text: t(:label_work_package_plural) },
+ t(:label_type_plural)])
+ end
+%>
+<%=
+ render(Primer::OpenProject::SubHeader.new) do |subheader|
+ subheader.with_action_button(scheme: :primary,
+ aria: { label: I18n.t(:label_type_new) },
+ title: I18n.t(:label_type_new),
+ test_selector: "op-admin-types--button-new",
+ tag: :a,
+ href: new_type_path) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ t('activerecord.attributes.work_package.type')
+ end
+ end
+%>
<% if @types.any? %>
<div class="generic-table--container">
diff --git a/app/views/types/new.html.erb b/app/views/types/new.html.erb
index 22a92737ee2..27d24a354ca 100644
--- a/app/views/types/new.html.erb
+++ b/app/views/types/new.html.erb
@@ -29,9 +29,15 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), t(:label_type_new) %>
-
-<% local_assigns[:additional_breadcrumb] = t(:label_type_new) %>
-<%= breadcrumb_toolbar t(:label_type_new) %>
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { t(:label_type_new) }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_work_package_tracking_path, text: t(:label_work_package_plural) },
+ { href: types_path, text: t(:label_type_plural) },
+ t(:label_type_new)])
+ end
+%>
<%= error_messages_for 'type' %>
diff --git a/app/views/workflows/copy.html.erb b/app/views/workflows/copy.html.erb
index 8c549e6b68b..caa3c029cae 100644
--- a/app/views/workflows/copy.html.erb
+++ b/app/views/workflows/copy.html.erb
@@ -26,9 +26,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
-<% html_title t(:label_administration), t(:label_workflow_plural) -%>
-<%= render partial: 'toolbar', locals: { title: Workflow.model_name.human } %>
-<% local_assigns[:additional_breadcrumb] = t(:button_copy) %>
+<% html_title t(:label_administration), t(:label_workflow_plural), t(:label_workflow_copy) -%>
+
+<%= render Workflows::PageHeaderComponent.new(state: :copy) %>
<%= styled_form_tag({}, id: 'workflow_copy_form') do %>
<section class="form--section">
@@ -75,5 +75,6 @@ See COPYRIGHT and LICENSE files for more details.
</div>
</div>
</section>
- <%= styled_submit_tag t(:button_copy), class: '-primary' %>
+
+ <%= styled_submit_tag t(:button_copy), class: '-primary', data: { "test-selector": "op-admin-workflows--button-copy" } %>
<% end %>
diff --git a/app/views/workflows/edit.html.erb b/app/views/workflows/edit.html.erb
index 973380bac30..96ded6de11c 100644
--- a/app/views/workflows/edit.html.erb
+++ b/app/views/workflows/edit.html.erb
@@ -27,7 +27,8 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_administration), t(:label_workflow_plural) -%>
-<%= render partial: 'toolbar', locals: {title: Workflow.model_name.human } %>
+
+<%= render Workflows::PageHeaderComponent.new(state: :edit) %>
<%= styled_form_tag({}, method: 'get') do %>
<fieldset class="simple-filters--container">
diff --git a/app/views/workflows/show.html.erb b/app/views/workflows/show.html.erb
index a9abdae8509..0b4d39269b8 100644
--- a/app/views/workflows/show.html.erb
+++ b/app/views/workflows/show.html.erb
@@ -26,9 +26,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= render partial: 'toolbar', locals: {title: t(:label_workflow_plural) } %>
-<% html_title t(:label_administration), t(:label_workflow_plural) -%>
-<% local_assigns[:additional_breadcrumb] = t(:label_workflow_summary) %>
+<% html_title t(:label_administration), t(:label_workflow_plural), t(:label_workflow_summary) -%>
+
+<%= render Workflows::PageHeaderComponent.new(state: :show) %>
<% if @workflow_counts.any? %>
<div class="autoscroll">
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index cc613ebbecf..b443573e5bf 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -308,7 +308,7 @@ Redmine::MenuManager.map :admin_menu do |menu|
menu.push :work_packages_setting,
{ controller: "/admin/settings/work_packages_settings", action: :show },
if: Proc.new { User.current.admin? },
- caption: :label_setting_plural,
+ caption: :label_work_packages_settings,
parent: :admin_work_packages
menu.push :types,
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 435ec205bc7..d513a2460af 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2508,6 +2508,7 @@ en:
label_work_package_new: "New work package"
label_work_package_edit: "Edit work package %{name}"
label_work_package_plural: "Work packages"
+ label_work_packages_settings: "Work packages settings"
label_work_package_status: "Work package status"
label_work_package_status_new: "New status"
label_work_package_status_plural: "Work package statuses"
@@ -2515,6 +2516,7 @@ en:
label_work_package_tracking: "Work package tracking"
label_work_package_view_all: "View all work packages"
label_workflow: "Workflow"
+ label_workflow_copy: "Copy workflow"
label_workflow_plural: "Workflows"
label_workflow_summary: "Summary"
label_working_days_and_hours: "Working days and hours"
diff --git a/spec/features/workflows/missing_for_sharing_wp_spec.rb b/spec/features/workflows/missing_for_sharing_wp_spec.rb
index 31ccec8d340..547a5ddeab7 100644
--- a/spec/features/workflows/missing_for_sharing_wp_spec.rb
+++ b/spec/features/workflows/missing_for_sharing_wp_spec.rb
@@ -68,7 +68,7 @@ RSpec.describe "Configuring the workflow for work package sharing",
select type.name, from: "target_type_ids"
select work_package_role.name, from: "target_role_ids"
- click_button "Copy"
+ page.find_test_selector("op-admin-workflows--button-copy").click
# Copying succeeds which results in the edit role having a workflow and the warning disappearing.
expect(page)
diff --git a/spec/support/pages/admin/custom_actions/index.rb b/spec/support/pages/admin/custom_actions/index.rb
index 6b15fd0505a..137a54fc53d 100644
--- a/spec/support/pages/admin/custom_actions/index.rb
+++ b/spec/support/pages/admin/custom_actions/index.rb
@@ -33,9 +33,7 @@ module Pages
module CustomActions
class Index < ::Pages::Page
def new
- within ".toolbar-items" do
- click_link "Custom action"
- end
+ page.find_test_selector("op-admin-custom-actions--button-new", text: "Custom action").click
wait_for_reload
diff --git a/spec/support/pages/types/index.rb b/spec/support/pages/types/index.rb
index 140bcf1f748..1717c6f37b1 100644
--- a/spec/support/pages/types/index.rb
+++ b/spec/support/pages/types/index.rb
@@ -52,9 +52,7 @@ module Pages
end
def click_new
- within ".toolbar-items" do
- click_link "Type"
- end
+ page.find_test_selector("op-admin-types--button-new", text: "Type").click
end
def click_edit(type)