From 087dad81e3d9dc0a7dab73bb637e155ca139335b Mon Sep 17 00:00:00 2001 From: Henriette Darge Date: Mon, 25 Nov 2024 17:58:08 +0100 Subject: [PATCH] Replace some more PageHeaders with the Primer component --- app/views/account/lost_password.html.erb | 10 +++++- app/views/account/password_recovery.html.erb | 10 +++++- app/views/colors/confirm_destroy.html.erb | 11 +++++- app/views/messages/edit.html.erb | 2 +- .../app/views/budgets/destroy_info.html.erb | 10 +++++- .../app/views/hourly_rates/edit.html.erb | 18 +++++++++- .../app/views/hourly_rates/show.html.erb | 19 ++++++++-- .../two_factor_devices/new_type.html.erb | 1 - .../_two_factor_authentication_admin.html.erb | 35 ++++++++----------- 9 files changed, 85 insertions(+), 31 deletions(-) diff --git a/app/views/account/lost_password.html.erb b/app/views/account/lost_password.html.erb index 5f2859f265c4..1a5fced1d7c6 100644 --- a/app/views/account/lost_password.html.erb +++ b/app/views/account/lost_password.html.erb @@ -27,7 +27,15 @@ See COPYRIGHT and LICENSE files for more details. ++#%> <% html_title t(:label_password_lost) %> -<%= toolbar title: t(:label_password_lost) %> + +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_password_lost) } + header.with_breadcrumbs([{ href: home_path, text: organization_name }, + t(:label_password_lost)]) + end +%> +
<%= styled_form_tag({action: "lost_password"}) do %>
diff --git a/app/views/account/password_recovery.html.erb b/app/views/account/password_recovery.html.erb index 47b1f76db29f..3e33e162f621 100644 --- a/app/views/account/password_recovery.html.erb +++ b/app/views/account/password_recovery.html.erb @@ -27,7 +27,15 @@ See COPYRIGHT and LICENSE files for more details. ++#%> <% html_title t(:label_password_lost) %> -<%= toolbar title: t(:label_password_lost) %> + +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_password_lost) } + header.with_breadcrumbs([{ href: home_path, text: organization_name }, + t(:label_password_lost)]) + end +%> + <%= error_messages_for 'user' %> <%= styled_form_tag({token: @token.value}, autocomplete: 'off') do %>
diff --git a/app/views/colors/confirm_destroy.html.erb b/app/views/colors/confirm_destroy.html.erb index 878cb53b1785..a8bd724e9195 100644 --- a/app/views/colors/confirm_destroy.html.erb +++ b/app/views/colors/confirm_destroy.html.erb @@ -26,7 +26,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See COPYRIGHT and LICENSE files for more details. ++#%> -<%= toolbar title: @color.name %> + +<%= + render(Primer::OpenProject::PageHeader.new) do |header| + header.with_title { @color.name } + header.with_breadcrumbs([{ href: admin_index_path, text: t(:label_administration) }, + { href: colors_path, text: t(:label_color_plural) }, + @color.name]) + end +%> + <%= labelled_tabular_form_for @color, url: color_url(@color), html: {method: 'delete'}, diff --git a/app/views/messages/edit.html.erb b/app/views/messages/edit.html.erb index 3900b636238b..f906ee6ed300 100644 --- a/app/views/messages/edit.html.erb +++ b/app/views/messages/edit.html.erb @@ -33,7 +33,7 @@ See COPYRIGHT and LICENSE files for more details. header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, { href: project_forums_path(@project), text: t(:label_forum_plural) }, { href: project_forum_path(@project, @forum), text: @forum.name }, - "#{ @message.subject }: #{t(:label_edit)}".html_safe], selected_item_font_weight: :normal) + @message.subject]) end %> <%= labelled_tabular_form_for @message, diff --git a/modules/budgets/app/views/budgets/destroy_info.html.erb b/modules/budgets/app/views/budgets/destroy_info.html.erb index ac3a43a50ef3..2986837d0681 100644 --- a/modules/budgets/app/views/budgets/destroy_info.html.erb +++ b/modules/budgets/app/views/budgets/destroy_info.html.erb @@ -28,7 +28,15 @@ See COPYRIGHT and LICENSE files for more details. ++#%> <% html_title "#{t(:button_delete)} #{t(:label_budget_id, id: @budget.id)}: #{@budget.subject}" %> -<%= toolbar title: "#{t(:button_delete)} #{t(:label_budget_id, id: @budget.id)}: #{@budget.subject}" %> + +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { "#{t(:button_delete)} #{@budget.subject}" } + header.with_breadcrumbs([{href: project_overview_path(@project.identifier), text: @project.name}, + {href: projects_budgets_path(@project.identifier), text: I18n.t(:label_budget_plural)}, + "#{t(:button_delete)} #{@budget.subject}"]) + end +%> <%= styled_form_tag(budget_path(@budget), method: :delete) do %>
diff --git a/modules/costs/app/views/hourly_rates/edit.html.erb b/modules/costs/app/views/hourly_rates/edit.html.erb index d8a03409a7b0..96a630f690c8 100644 --- a/modules/costs/app/views/hourly_rates/edit.html.erb +++ b/modules/costs/app/views/hourly_rates/edit.html.erb @@ -29,7 +29,23 @@ See COPYRIGHT and LICENSE files for more details. <% html_title t(:label_administration), "#{t(:label_edit)} #{I18n.t((@project.nil? ? :caption_default_rate_history_for : :caption_rate_history_for), user: ' ')} #{@user.name}" %> -<%= toolbar title: (@project.nil? ? t(:caption_default_rate_history_for, user: @user.name) : t(:caption_rate_history_for_project, user: @user.name, project: @project.name) ) %> +<% + breadcrumb_items = if @project + [{href: project_overview_path(@project.identifier), text: @project.name}, + {href: projects_budgets_path(@project.identifier), text: I18n.t(:label_budget_plural)}] + else + [{ href: home_path, text: organization_name}] + end +%> + +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:caption_default_rate_history_for, user: @user.name) } + header.with_breadcrumbs([*(breadcrumb_items), + t(:caption_default_rate_history_for, user: @user.name)]) + end +%> + <%- default_rate = @user.current_default_rate -%> <% if default_rate%> diff --git a/modules/costs/app/views/hourly_rates/show.html.erb b/modules/costs/app/views/hourly_rates/show.html.erb index ed75efed51e2..58ff0dee3907 100644 --- a/modules/costs/app/views/hourly_rates/show.html.erb +++ b/modules/costs/app/views/hourly_rates/show.html.erb @@ -29,15 +29,28 @@ See COPYRIGHT and LICENSE files for more details. <% html_title t(:label_administration), t(:caption_rate_history_for, user: @user.name) %> -<%= toolbar title: t(:caption_rate_history_for, :user => @user.name) %> +<% + breadcrumb_items = if @project + [{href: project_overview_path(@project.identifier), text: @project.name}, + {href: projects_budgets_path(@project.identifier), text: I18n.t(:label_budget_plural)}] + else + [{ href: home_path, text: organization_name}] + end +%> + +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:caption_default_rate_history_for, user: @user.name) } + header.with_breadcrumbs([*(breadcrumb_items), + t(:caption_default_rate_history_for, user: @user.name)]) + end +%> <% if @project %> <% html_title t(:caption_rate_history_for, user: @user.name) %> <%= render :partial => 'list_project' %> <% else %> - <% html_title t(:label_administration), t(:caption_rate_history_for, user: @user.name) %> - <%= render :partial => 'list_default' %> <%= render :partial => 'list' %> <% end %> diff --git a/modules/two_factor_authentication/app/views/two_factor_authentication/two_factor_devices/new_type.html.erb b/modules/two_factor_authentication/app/views/two_factor_authentication/two_factor_devices/new_type.html.erb index 64dc167e2c33..d6638f100596 100644 --- a/modules/two_factor_authentication/app/views/two_factor_authentication/two_factor_devices/new_type.html.erb +++ b/modules/two_factor_authentication/app/views/two_factor_authentication/two_factor_devices/new_type.html.erb @@ -7,7 +7,6 @@ t('two_factor_authentication.devices.add_new')]) end %> -<%= toolbar title: t('two_factor_authentication.devices.add_new') %>
<% @available_devices.each do |key, device_class| %> diff --git a/modules/two_factor_authentication/app/views/users/_two_factor_authentication_admin.html.erb b/modules/two_factor_authentication/app/views/users/_two_factor_authentication_admin.html.erb index a1aa59dffc0d..de14ab84c7bd 100644 --- a/modules/two_factor_authentication/app/views/users/_two_factor_authentication_admin.html.erb +++ b/modules/two_factor_authentication/app/views/users/_two_factor_authentication_admin.html.erb @@ -25,28 +25,21 @@
- <%= toolbar title: t('two_factor_authentication.label_devices') do %> - <% unless devices.empty? %> -
  • - <%= link_to delete_all_user_2fa_devices_path(@user), - method: :post, - data: { confirm: t('two_factor_authentication.admin.delete_all_are_you_sure') }, - class: "button -danger" do %> - <%= op_icon 'button--icon icon-delete' %> - <%= t 'two_factor_authentication.admin.button_delete_all_devices' %> - <% end %> -
  • - <% end %> - <% if ::OpenProject::TwoFactorAuthentication::TokenStrategyManager.admin_register_sms_strategy.present? %> -
  • - <%= link_to new_user_2fa_device_path(@user, type: :sms), class: 'button -primary' do %> - <%= op_icon 'button--icon icon-add' %> - <%= t 'two_factor_authentication.admin.button_register_mobile_phone_for_user' %> - <% end %> -
  • - <% end %> + <% unless devices.empty? %> + <%= link_to delete_all_user_2fa_devices_path(@user), + method: :post, + data: { confirm: t('two_factor_authentication.admin.delete_all_are_you_sure') }, + class: "button -danger" do %> + <%= op_icon 'button--icon icon-delete' %> + <%= t 'two_factor_authentication.admin.button_delete_all_devices' %> + <% end %> + <% end %> + <% if ::OpenProject::TwoFactorAuthentication::TokenStrategyManager.admin_register_sms_strategy.present? %> + <%= link_to new_user_2fa_device_path(@user, type: :sms), class: 'button -primary' do %> + <%= op_icon 'button--icon icon-add' %> + <%= t 'two_factor_authentication.admin.button_register_mobile_phone_for_user' %> + <% end %> <% end %> <%= render ::TwoFactorAuthentication::Devices::TableComponent.new(rows: devices, admin_table: true || @user != User.current) %> -