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 PageHeader component in Time & Costs -> Cost types to harmonise it with the Time & Costs -> Settings page

Henriette Darge47b846ff72e7
diff --git a/modules/costs/app/views/cost_types/edit.html.erb b/modules/costs/app/views/cost_types/edit.html.erb
index 9457795b873..08a9cfc559c 100644
--- a/modules/costs/app/views/cost_types/edit.html.erb
+++ b/modules/costs/app/views/cost_types/edit.html.erb
@@ -29,14 +29,21 @@ See COPYRIGHT and LICENSE files for more details.
<% if(@cost_type.id) %>
<% html_title t(:label_cost_type_specific, id: @cost_type.id, name: @cost_type.name) %>
- <% local_assigns[:additional_breadcrumb] = @cost_type.name %>
+ <% title = @cost_type.name %>
<% else %>
<% html_title t(:label_administration), t(:label_cost_type_plural) %>
- <% local_assigns[:additional_breadcrumb] = t(:label_new) + ' ' + I18n.t('activerecord.models.cost_type.one') %>
+ <% title = t(:label_new) + ' ' + I18n.t('activerecord.models.cost_type.one') %>
<% end %>
-
-<%= toolbar title: CostType.model_name.human %>
+<%=
+ render(Primer::OpenProject::PageHeader.new) do |header|
+ header.with_title { title }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: url_for({ controller: "/admin/settings", action: "show_plugin", id: :costs }), text: t(:project_module_costs) },
+ { href: cost_types_path, text: t(:label_cost_type_plural) },
+ title])
+ end
+%>
<costs-subform item-count="<%= @cost_type.rates.length %>">
<%= labelled_tabular_form_for @cost_type do |f| %>
diff --git a/modules/costs/app/views/cost_types/index.html.erb b/modules/costs/app/views/cost_types/index.html.erb
index e63392fb7f8..1169c6bb375 100644
--- a/modules/costs/app/views/cost_types/index.html.erb
+++ b/modules/costs/app/views/cost_types/index.html.erb
@@ -28,48 +28,59 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_administration), t(:label_cost_type_plural) %>
-<%= toolbar title: CostType.model_name.human(count: 2) do %>
- <li class="toolbar-item">
- <a href="<%= new_cost_type_path %>" aria-label="<%= t(:button_add_cost_type) %>" title="<%= t(:button_add_cost_type) %>" class="button -primary">
- <%= op_icon('button--icon icon-add') %>
- <span class="button--text"><%= CostType.model_name.human %></span>
- </a>
- </li>
-<% end %>
-<%= styled_form_tag(cost_types_path, { method: :get, id: 'query_form' }) do %>
- <fieldset id="filters" class="simple-filters--container">
- <legend><%= t(:label_filter_plural) %></legend>
- <ul class="simple-filters--filters">
- <li class="simple-filters--filter">
- <%= styled_label_tag :fixed_date, t(:'attributes.fixed_date'), class: 'simple-filters--filter-name' %>
- <div class='simple-filters--filter-value'>
- <%= angular_component_tag 'op-basic-single-date-picker',
- inputs: {
- value: @fixed_date,
- id: :start_date,
- name: :fixed_date
- }
- %>
- </div>
- </li>
- <li class="simple-filters--filter">
- <%= styled_label_tag :include_deleted, t(:caption_show_locked), class: 'simple-filters--filter-name -small' %>
- <div class="simple-filters--filter-value">
- <%= styled_check_box_tag :include_deleted, "1", @include_deleted, autocomplete: "off" %>
- </div>
- </li>
- <li class="simple-filters--controls">
- <%= submit_tag t(:button_apply), class: 'button -primary -small' %>
- <%= link_to t(:button_clear), cost_types_path, class: 'button -small -with-icon icon-undo' %>
- </li>
- </ul>
- </fieldset>
-<% end %>
+<%=
+ render(Primer::OpenProject::PageHeader.new) do |header|
+ header.with_title { I18n.t(:label_cost_type_plural) }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: url_for({ controller: "/admin/settings", action: "show_plugin", id: :costs }), text: t(:project_module_costs) },
+ I18n.t(:label_cost_type_plural)])
+ end
+%>
+
+<%= render(Primer::OpenProject::SubHeader.new) do |subheader| %>
+ <% subheader.with_action_button(scheme: :primary,
+ aria: { label: I18n.t(:button_add_cost_type) },
+ title: I18n.t(:button_add_cost_type),
+ tag: :a,
+ href: new_cost_type_path) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ CostType.model_name.human
+ end %>
+
+ <% subheader.with_bottom_pane_component do %>
+ <%= styled_form_tag(cost_types_path, { method: :get, id: 'query_form' }) do %>
+ <fieldset id="filters" class="simple-filters--container">
+ <legend><%= t(:label_filter_plural) %></legend>
+ <ul class="simple-filters--filters">
+ <li class="simple-filters--filter">
+ <%= styled_label_tag :fixed_date, t(:'attributes.fixed_date'), class: 'simple-filters--filter-name' %>
+ <div class='simple-filters--filter-value'>
+ <%= angular_component_tag 'op-basic-single-date-picker',
+ inputs: {
+ value: @fixed_date,
+ id: :start_date,
+ name: :fixed_date
+ }
+ %>
+ </div>
+ </li>
+ <li class="simple-filters--filter">
+ <%= styled_label_tag :include_deleted, t(:caption_show_locked), class: 'simple-filters--filter-name -small' %>
+ <div class="simple-filters--filter-value">
+ <%= styled_check_box_tag :include_deleted, "1", @include_deleted, autocomplete: "off" %>
+ </div>
+ </li>
+ <li class="simple-filters--controls">
+ <%= submit_tag t(:button_apply), class: 'button -primary -small' %>
+ <%= link_to t(:button_clear), cost_types_path, class: 'button -small -with-icon icon-undo' %>
+ </li>
+ </ul>
+ </fieldset>
+ <% end %>
+ <% end %>
+ <% end %>
-<div id="cost_type_flash_notice_outer" style="display:none">
-<div class="flash notice" id="cost_type_flash_notice"><%= t(:notice_successful_update) %></div>
-</div>
<%= render partial: 'list' %>
<% if @include_deleted %>