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

Update the last page headers to use the new Primer::OpenProject::PageHeader component

Henriette Darge8788b34dbfef
diff --git a/app/assets/images/enterprise/attribute-help-texts.png b/app/assets/images/enterprise/attribute-help-texts.png
deleted file mode 100644
index 58fa216c7a9..00000000000
Binary files a/app/assets/images/enterprise/attribute-help-texts.png and /dev/null differ
diff --git a/app/components/admin/backups/show_page_header_component.html.erb b/app/components/admin/backups/show_page_header_component.html.erb
new file mode 100644
index 00000000000..4b1ddcd8bca
--- /dev/null
+++ b/app/components/admin/backups/show_page_header_component.html.erb
@@ -0,0 +1,65 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 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 { t(:label_backup) }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t(:label_administration) },
+ t(:label_backup)])
+
+ header.with_action_button(tag: :a,
+ scheme: button_scheme,
+ mobile_label: button_title,
+ mobile_icon: button_icon,
+ size: :medium,
+ href: reset_token_admin_backups_path,
+ aria: { label: button_title },
+ title: button_title) do |button|
+ button.with_leading_visual_icon(icon: button_icon)
+ button_title
+ end
+
+ if @backup_token.present?
+ header.with_action_button(tag: :a,
+ scheme: :danger,
+ mobile_icon: :trash,
+ mobile_label: t("backup.label_delete_token"),
+ size: :medium,
+ href: delete_token_admin_backups_path,
+ aria: { label: I18n.t("backup.label_delete_token") },
+ data: {
+ confirm: I18n.t(:text_are_you_sure),
+ method: :post
+ },
+ title: I18n.t(:button_delete)) do |button|
+ button.with_leading_visual_icon(icon: :trash)
+ t("backup.label_delete_token")
+ end
+ end
+ end
+%>
diff --git a/app/components/admin/backups/show_page_header_component.rb b/app/components/admin/backups/show_page_header_component.rb
new file mode 100644
index 00000000000..3b7dc6f70b9
--- /dev/null
+++ b/app/components/admin/backups/show_page_header_component.rb
@@ -0,0 +1,61 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 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 Admin
+ module Backups
+ class ShowPageHeaderComponent < ApplicationComponent
+ include OpPrimer::ComponentHelpers
+ include ApplicationHelper
+
+ def initialize(backup_token:)
+ super
+ @backup_token = backup_token
+ end
+
+ def breadcrumb_items
+ [{ href: admin_index_path, text: t(:label_administration) },
+ t(:label_backup)]
+ end
+
+ def button_title
+ button_action = @backup_token.present? ? "reset" : "create"
+ t("backup.label_#{button_action}_token")
+ end
+
+ def button_icon
+ @backup_token.present? ? :"op-reload" : :plus
+ end
+
+ def button_scheme
+ @backup_token.present? ? :default : :primary
+ end
+ end
+ end
+end
diff --git a/app/views/attribute_help_texts/upsale.html.erb b/app/components/attribute_help_texts/index_page_header_component.html.erb
similarity index 70%
rename from app/views/attribute_help_texts/upsale.html.erb
rename to app/components/attribute_help_texts/index_page_header_component.html.erb
index bba919c1ee1..602390526de 100644
--- a/app/views/attribute_help_texts/upsale.html.erb
+++ b/app/components/attribute_help_texts/index_page_header_component.html.erb
@@ -26,13 +26,17 @@ 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(:'attribute_help_texts.label_plural') %>
-
-<%= render template: 'common/upsale',
- locals: {
- feature_title: t(:'attribute_help_texts.label_plural'),
- feature_description: t('attribute_help_texts.enterprise.description'),
- feature_reference: 'enterprise-attribute-help-texts',
- feature_image: 'enterprise/attribute-help-texts.png'
- } %>
+<%=
+ render(Primer::OpenProject::PageHeader.new) do |header|
+ header.with_title { I18n.t(:"attribute_help_texts.label_plural") }
+ header.with_breadcrumbs(breadcrumb_items, selected_item_font_weight: :normal)
+
+ header.with_tab_nav(label: nil) do |tab_nav|
+ @tabs.each do |tab|
+ tab_nav.with_tab(selected: currently_selected_tab == tab, href: tab[:path]) do |t|
+ t.with_text { I18n.t(tab[:label]) }
+ end
+ end
+ end if @tabs.present?
+ end
+%>
diff --git a/app/components/attribute_help_texts/index_page_header_component.rb b/app/components/attribute_help_texts/index_page_header_component.rb
new file mode 100644
index 00000000000..0e0637a472e
--- /dev/null
+++ b/app/components/attribute_help_texts/index_page_header_component.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 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.
+# ++
+
+class AttributeHelpTexts::IndexPageHeaderComponent < ApplicationComponent
+ include OpPrimer::ComponentHelpers
+ include ApplicationHelper
+ include TabsHelper
+
+ def initialize(tabs: nil)
+ super
+ @tabs = tabs
+ end
+
+ def breadcrumb_items
+ [{ href: admin_index_path, text: t("label_administration") },
+ I18n.t("menus.breadcrumb.nested_element", section_header: t(:"attribute_help_texts.label_plural"),
+ title: I18n.t(currently_selected_tab[:label].to_s)).html_safe]
+ end
+
+ def currently_selected_tab
+ @currently_selected_tab ||= selected_tab(@tabs)
+ end
+end
diff --git a/app/components/custom_fields/index_page_header_component.html.erb b/app/components/custom_fields/index_page_header_component.html.erb
new file mode 100644
index 00000000000..f91e3f13d79
--- /dev/null
+++ b/app/components/custom_fields/index_page_header_component.html.erb
@@ -0,0 +1,42 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 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 { I18n.t(:label_custom_field_plural) }
+ header.with_breadcrumbs(breadcrumb_items, selected_item_font_weight: :normal)
+
+ header.with_tab_nav(label: nil, test_selector: "custom-fields--tab-nav") do |tab_nav|
+ @tabs.each do |tab|
+ tab_nav.with_tab(selected: currently_selected_tab == tab, href: tab[:path]) do |t|
+ t.with_text { I18n.t(tab[:label]) }
+ end
+ end
+ end if @tabs.present?
+ end
+%>
diff --git a/app/components/custom_fields/index_page_header_component.rb b/app/components/custom_fields/index_page_header_component.rb
new file mode 100644
index 00000000000..bfefb5b22ec
--- /dev/null
+++ b/app/components/custom_fields/index_page_header_component.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 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.
+# ++
+
+class CustomFields::IndexPageHeaderComponent < ApplicationComponent
+ include OpPrimer::ComponentHelpers
+ include ApplicationHelper
+ include TabsHelper
+
+ def initialize(tabs: nil)
+ super
+ @tabs = tabs
+ end
+
+ def breadcrumb_items
+ [{ href: admin_index_path, text: t("label_administration") },
+ I18n.t("menus.breadcrumb.nested_element", section_header: t(:label_custom_field_plural),
+ title: I18n.t(currently_selected_tab[:label].to_s)).html_safe]
+ end
+
+ def currently_selected_tab
+ @currently_selected_tab ||= selected_tab(@tabs)
+ end
+end
diff --git a/app/controllers/admin/backups_controller.rb b/app/controllers/admin/backups_controller.rb
index fb50e597c75..0be5ebdff8a 100644
--- a/app/controllers/admin/backups_controller.rb
+++ b/app/controllers/admin/backups_controller.rb
@@ -76,12 +76,10 @@ class Admin::BackupsController < ApplicationController
redirect_to action: "show"
end
- def default_breadcrumb
- t(:label_backup)
- end
+ def default_breadcrumb; end
def show_local_breadcrumb
- true
+ false
end
def check_enabled
diff --git a/app/controllers/attribute_help_texts_controller.rb b/app/controllers/attribute_help_texts_controller.rb
index 737002a40f7..44aa15e6085 100644
--- a/app/controllers/attribute_help_texts_controller.rb
+++ b/app/controllers/attribute_help_texts_controller.rb
@@ -44,8 +44,6 @@ class AttributeHelpTextsController < ApplicationController
def edit; end
- def upsale; end
-
def create
call = ::AttributeHelpTexts::CreateService
.new(user: current_user)
@@ -87,16 +85,10 @@ class AttributeHelpTextsController < ApplicationController
protected
- def default_breadcrumb
- if action_name == "index"
- t("attribute_help_texts.label_plural")
- else
- ActionController::Base.helpers.link_to(t("attribute_help_texts.label_plural"), attribute_help_texts_path)
- end
- end
+ def default_breadcrumb; end
def show_local_breadcrumb
- true
+ false
end
private
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb
index 644a489ec76..de3a72af308 100644
--- a/app/controllers/custom_fields_controller.rb
+++ b/app/controllers/custom_fields_controller.rb
@@ -58,16 +58,10 @@ class CustomFieldsController < ApplicationController
protected
- def default_breadcrumb
- if action_name == "index"
- t("label_custom_field_plural")
- else
- ActionController::Base.helpers.link_to(t("label_custom_field_plural"), custom_fields_path)
- end
- end
+ def default_breadcrumb; end
def show_local_breadcrumb
- true
+ false
end
def find_custom_field
diff --git a/app/controllers/custom_styles_controller.rb b/app/controllers/custom_styles_controller.rb
index 884d8a87548..e2e70eb61df 100644
--- a/app/controllers/custom_styles_controller.rb
+++ b/app/controllers/custom_styles_controller.rb
@@ -153,7 +153,7 @@ class CustomStylesController < ApplicationController
end
def show_local_breadcrumb
- true
+ false
end
private
diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb
index 85bc3e8eb9c..a011ec00375 100644
--- a/app/controllers/enterprises_controller.rb
+++ b/app/controllers/enterprises_controller.rb
@@ -98,12 +98,10 @@ class EnterprisesController < ApplicationController
helpers.write_augur_to_gon
end
- def default_breadcrumb
- t(:label_enterprise_edition)
- end
+ def default_breadcrumb; end
def show_local_breadcrumb
- true
+ false
end
def check_user_limit
diff --git a/app/views/admin/backups/show.html.erb b/app/views/admin/backups/show.html.erb
index 1b6f6fa64d1..b1bcd6f8846 100644
--- a/app/views/admin/backups/show.html.erb
+++ b/app/views/admin/backups/show.html.erb
@@ -29,40 +29,7 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), t(:label_backup) -%>
-<%= toolbar title: t('label_backup') do %>
- <li class="toolbar-item">
- <% label_action = @backup_token.present? ? 'reset' : 'create' %>
- <% label = t("backup.label_#{label_action}_token") %>
- <%=
- link_to(
- { action: 'reset_token' },
- class: 'button -primary',
- aria: {label: label},
- title: label
- ) do
- %>
- <%= op_icon("button--icon icon-#{@backup_token.present? ? 'reload' : 'add'}") %>
- <span class="button--text"><%= t('backup.label_backup_token') %></span>
- <% end %>
- </li>
- <% if @backup_token.present? %>
- <li class="toolbar-item">
- <% label = t("backup.label_delete_token") %>
- <%=
- link_to(
- { action: 'delete_token' },
- method: :post,
- class: 'button -primary',
- aria: {label: label},
- title: label
- ) do
- %>
- <%= op_icon("button--icon icon-delete") %>
- <span class="button--text"><%= t('backup.label_backup_token') %></span>
- <% end %>
- </li>
- <% end %>
-<% end %>
+<%= render Admin::Backups::ShowPageHeaderComponent.new(backup_token: @backup_token) %>
<p>
<%= t("backup.reset_token.info") %>
diff --git a/app/views/attribute_help_texts/edit.html.erb b/app/views/attribute_help_texts/edit.html.erb
index 6cbdd2bb55d..245d90699bf 100644
--- a/app/views/attribute_help_texts/edit.html.erb
+++ b/app/views/attribute_help_texts/edit.html.erb
@@ -28,10 +28,18 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_administration), t(:'attribute_help_texts.edit', attribute_caption: @attribute_help_text.attribute_caption) %>
-<% local_assigns[:additional_breadcrumb] = t(:'attribute_help_texts.edit', attribute_caption: @attribute_help_text.attribute_caption) %>
-<%= breadcrumb_toolbar t(:'attribute_help_texts.edit', attribute_caption: @attribute_help_text.attribute_caption)
+
+<%=
+ render(Primer::OpenProject::PageHeader.new) do |header|
+ header.with_title { @attribute_help_text.attribute_caption }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t(:label_administration) },
+ { href: attribute_help_texts_path, text: t(:"attribute_help_texts.label_plural") },
+ { href: attribute_help_texts_path(tab: @attribute_help_text.attribute_scope), text: @attribute_help_text.type_caption },
+ @attribute_help_text.attribute_caption])
+ end
%>
+
<%= labelled_tabular_form_for @attribute_help_text,
as: 'attribute_help_text',
url: { action: :update },
diff --git a/app/views/attribute_help_texts/index.html.erb b/app/views/attribute_help_texts/index.html.erb
index 6db28e5a33c..44fbccd6807 100644
--- a/app/views/attribute_help_texts/index.html.erb
+++ b/app/views/attribute_help_texts/index.html.erb
@@ -38,21 +38,24 @@ See COPYRIGHT and LICENSE files for more details.
name: 'Project',
partial: 'attribute_help_texts/tab',
path: attribute_help_texts_path(tab: 'Project'),
- label: Project.model_name.human
+ label: :label_project
}
] %>
-
-<%= toolbar title: t(:'attribute_help_texts.label_plural') do %>
- <li class="toolbar-item">
- <%= link_to new_attribute_help_text_path(name: selected_tab(tabs)[:name]),
- { class: 'attribute-help-texts--create-button button -primary',
- aria: {label: t(:'attribute_help_texts.add_new')},
- title: t(:'attribute_help_texts.add_new')} do %>
- <%= op_icon('button--icon icon-add') %>
- <span class="button--text"><%= t('activerecord.models.attribute_help_text') %></span>
- <% end %>
- </li>
-<% end %>
-
-<%= render_tabs tabs %>
+<%= render AttributeHelpTexts::IndexPageHeaderComponent.new(tabs: tabs) %>
+
+<%=
+ render(Primer::OpenProject::SubHeader.new) do |subheader|
+ subheader.with_action_button(scheme: :primary,
+ aria: { label: I18n.t("attribute_help_texts.add_new") },
+ title: I18n.t("attribute_help_texts.add_new"),
+ tag: :a,
+ href: new_attribute_help_text_path(name: selected_tab(tabs)[:name]),
+ test_selector: "attribute-help-texts--create-button") do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ t("activerecord.models.attribute_help_text")
+ end
+ end
+%>
+
+<%= render_tabs tabs, with_tab_nav: false %>
diff --git a/app/views/attribute_help_texts/new.html.erb b/app/views/attribute_help_texts/new.html.erb
index 467da146dcb..f7176e9d3c8 100644
--- a/app/views/attribute_help_texts/new.html.erb
+++ b/app/views/attribute_help_texts/new.html.erb
@@ -28,8 +28,15 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_administration), t(:'attribute_help_texts.add_new') %>
-<% local_assigns[:additional_breadcrumb] = t(:'attribute_help_texts.add_new') %>
-<%= breadcrumb_toolbar t(:'attribute_help_texts.add_new')
+
+<%=
+ render(Primer::OpenProject::PageHeader.new) do |header|
+ header.with_title { t(:"attribute_help_texts.add_new") }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t(:label_administration) },
+ { href: attribute_help_texts_path, text: t(:"attribute_help_texts.label_plural") },
+ { href: attribute_help_texts_path(tab: @attribute_help_text.attribute_scope), text: @attribute_help_text.type_caption },
+ t(:"attribute_help_texts.add_new")])
+ end
%>
<%= labelled_tabular_form_for @attribute_help_text,
diff --git a/app/views/custom_fields/edit.html.erb b/app/views/custom_fields/edit.html.erb
index 079d30862ef..ccebc45111d 100644
--- a/app/views/custom_fields/edit.html.erb
+++ b/app/views/custom_fields/edit.html.erb
@@ -28,11 +28,15 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_administration), "#{t(:label_edit)} #{CustomField.model_name.human} #{h @custom_field.name}" %>
-<% local_assigns[:additional_breadcrumb] = [
- link_to(I18n.t(@custom_field.type_name), custom_fields_path(tab: @custom_field.type)),
- @custom_field.name
-] %>
-<%= breadcrumb_toolbar @custom_field.name %>
+<%=
+ render(Primer::OpenProject::PageHeader.new(test_selector: "custom-fields--page-header")) do |header|
+ header.with_title { @custom_field.name }
+ header.with_breadcrumbs([{ 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) },
+ @custom_field.name])
+ end
+%>
<%= error_messages_for 'custom_field' %>
diff --git a/app/views/custom_fields/index.html.erb b/app/views/custom_fields/index.html.erb
index c1553454551..4f1e8509605 100644
--- a/app/views/custom_fields/index.html.erb
+++ b/app/views/custom_fields/index.html.erb
@@ -26,18 +26,23 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= toolbar title: t(:label_custom_field_plural) do %>
- <li class="toolbar-item">
- <%= link_to new_custom_field_path(type: selected_tab(custom_fields_tabs)[:name]),
- { class: 'button -primary',
- aria: {label: t(:label_custom_field_new)},
- title: t(:label_custom_field_new)} do %>
- <%= op_icon('button--icon icon-add') %>
- <span class="button--text"><%= t('activerecord.models.custom_field') %></span>
- <% end %>
- </li>
-<% end %>
-
-<%= render_tabs custom_fields_tabs %>
+
<% html_title(t(:label_administration), t(:label_custom_field_plural)) -%>
+
+<%= render CustomFields::IndexPageHeaderComponent.new(tabs: custom_fields_tabs) %>
+
+<%=
+ render(Primer::OpenProject::SubHeader.new) do |subheader|
+ subheader.with_action_button(scheme: :primary,
+ aria: { label: I18n.t(:label_custom_field_new) },
+ title: I18n.t(:label_custom_field_new),
+ tag: :a,
+ href: new_custom_field_path(type: selected_tab(custom_fields_tabs)[:name])) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ t("activerecord.models.custom_field")
+ end
+ end
+%>
+
+<%= render_tabs custom_fields_tabs, with_tab_nav: false %>
diff --git a/app/views/custom_fields/new.html.erb b/app/views/custom_fields/new.html.erb
index 2be43d2e23d..eeae3a50da0 100644
--- a/app/views/custom_fields/new.html.erb
+++ b/app/views/custom_fields/new.html.erb
@@ -28,11 +28,17 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_administration), t(:label_custom_field_new) %>
-<% local_assigns[:additional_breadcrumb] = [
- link_to(I18n.t(@custom_field.type_name), custom_fields_path(tab: @custom_field.type)),
- t(:label_custom_field_new)
-] %>
-<%= breadcrumb_toolbar t(:label_custom_field_new) %>
+
+<%=
+ render(Primer::OpenProject::PageHeader.new(test_selector: "custom-fields--page-header")) do |header|
+ header.with_title { t(:label_custom_field_new) }
+ header.with_breadcrumbs([{ 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)])
+ end
+%>
+
<%= error_messages_for 'custom_field' %>
diff --git a/app/views/custom_styles/show.html.erb b/app/views/custom_styles/show.html.erb
index 9ffedb2176f..eec81989d04 100644
--- a/app/views/custom_styles/show.html.erb
+++ b/app/views/custom_styles/show.html.erb
@@ -29,7 +29,13 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), t(:label_custom_style) %>
-<%= toolbar title: t(:label_custom_style) %>
+<%=
+ render(Primer::OpenProject::PageHeader.new) do |header|
+ header.with_title { t(:label_custom_style) }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t(:label_administration) },
+ t(:label_custom_style)])
+ end
+%>
<%= error_messages_for 'custom_style' %>
diff --git a/app/views/enterprises/show.html.erb b/app/views/enterprises/show.html.erb
index ca07e2f73d9..646c9a1e3fc 100644
--- a/app/views/enterprises/show.html.erb
+++ b/app/views/enterprises/show.html.erb
@@ -1,6 +1,12 @@
<% html_title t(:label_administration), t("admin.enterprise.upgrade_to_ee") %>
-<%= toolbar title: t("admin.enterprise.upgrade_to_ee") %>
+<%=
+ render(Primer::OpenProject::PageHeader.new) do |header|
+ header.with_title { t(:label_enterprise_edition) }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t(:label_administration) },
+ t(:label_enterprise_edition)])
+ end
+%>
<%= error_messages_for 'token' %>
diff --git a/config/routes.rb b/config/routes.rb
index 2e4978cc90a..5f9ead35b7f 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -425,9 +425,7 @@ Rails.application.routes.draw do
resource :custom_style, only: %i[update show create], path: "design"
- resources :attribute_help_texts, only: %i(index new create edit update destroy) do
- get :upsale, to: "attribute_help_texts#upsale", on: :collection, as: :upsale
- end
+ resources :attribute_help_texts, only: %i(index new create edit update destroy)
resources :groups, except: %i[show] do
member do
diff --git a/spec/features/admin/attribute_help_texts_spec.rb b/spec/features/admin/attribute_help_texts_spec.rb
index 43f48331190..f9b0e0b08aa 100644
--- a/spec/features/admin/attribute_help_texts_spec.rb
+++ b/spec/features/admin/attribute_help_texts_spec.rb
@@ -50,7 +50,7 @@ RSpec.describe "Attribute help texts", :js, :with_cuprite do
end
it "can upload an image" do
- find(".attribute-help-texts--create-button").click
+ page.find_test_selector("attribute-help-texts--create-button").click
select "Status", from: "attribute_help_text_attribute_name"
editor.set_markdown("My attribute help text")
@@ -72,7 +72,7 @@ RSpec.describe "Attribute help texts", :js, :with_cuprite do
# Create help text
# -> new
- find(".attribute-help-texts--create-button").click
+ page.find_test_selector("attribute-help-texts--create-button").click
# Set attributes
# -> create
@@ -138,7 +138,7 @@ RSpec.describe "Attribute help texts", :js, :with_cuprite do
visit attribute_help_texts_path
# Create new, status is now blocked
- find(".attribute-help-texts--create-button").click
+ page.find_test_selector("attribute-help-texts--create-button").click
expect(page).to have_css("#attribute_help_text_attribute_name option", text: "Assignee")
expect(page).to have_no_css("#attribute_help_text_attribute_name option", text: "Status")
visit attribute_help_texts_path
diff --git a/spec/features/admin/backup_spec.rb b/spec/features/admin/backup_spec.rb
index 0426566ebda..081b6bc51e6 100644
--- a/spec/features/admin/backup_spec.rb
+++ b/spec/features/admin/backup_spec.rb
@@ -117,6 +117,8 @@ RSpec.describe "backup", :js do
click_on I18n.t("backup.label_delete_token")
+ page.driver.browser.switch_to.alert.accept
+
expect(page).to have_content I18n.t("backup.text_token_deleted")
token = Token::Backup.find_by(user: current_user)
diff --git a/spec/features/custom_fields/custom_fields_spec.rb b/spec/features/custom_fields/custom_fields_spec.rb
index d661cbce936..32eafe20792 100644
--- a/spec/features/custom_fields/custom_fields_spec.rb
+++ b/spec/features/custom_fields/custom_fields_spec.rb
@@ -176,7 +176,7 @@ RSpec.describe "custom fields", :js, :with_cuprite do
click_on "Create a new custom field"
wait_for_reload
- page.within_test_selector("op-breadcrumb") do
+ page.within_test_selector("custom-fields--page-header") do
expect(page).to have_css(".breadcrumb-item", text: type)
expect(page).to have_css(".breadcrumb-item.breadcrumb-item-selected", text: "New custom field")
end
@@ -273,7 +273,7 @@ RSpec.describe "custom fields", :js, :with_cuprite do
end
it "shows the correct breadcrumbs" do
- page.within_test_selector("op-breadcrumb") do
+ page.within_test_selector("custom-fields--page-header") do
expect(page).to have_css(".breadcrumb-item", text: "Work packages")
expect(page).to have_css(".breadcrumb-item.breadcrumb-item-selected", text: "Platform")
end
diff --git a/spec/support/pages/custom_fields.rb b/spec/support/pages/custom_fields.rb
index 593f859d0b9..cb4501bf371 100644
--- a/spec/support/pages/custom_fields.rb
+++ b/spec/support/pages/custom_fields.rb
@@ -36,7 +36,7 @@ module Pages
def visit_tab(name)
visit!
- within("opce-content-tabs") do
+ within_test_selector("custom-fields--tab-nav") do
click_link name.to_s
end
end