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 Administration -> User settings -> Groups

Henriette Darge5af5c71a7186
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 85384f3b0ca..7f929d28bb3 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -160,16 +160,8 @@ class GroupsController < ApplicationController
Group.in_project(Project.allowed_to(current_user, :view_members)).exists?
end
- def default_breadcrumb
- if action_name == "index" || !current_user.admin?
- t("label_group_plural")
- else
- ActionController::Base.helpers.link_to(t("label_group_plural"), groups_path)
- end
- end
-
def show_local_breadcrumb
- true
+ false
end
def respond_membership_altered(service_call)
diff --git a/app/views/groups/edit.html.erb b/app/views/groups/edit.html.erb
index 2b3c27cd14c..6277a00b3e4 100644
--- a/app/views/groups/edit.html.erb
+++ b/app/views/groups/edit.html.erb
@@ -29,25 +29,53 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), "#{t(:label_edit)} #{Group.model_name.human} #{h @group.name}" %>
-<% local_assigns[:additional_breadcrumb] = @group.name %>
-
-<%= breadcrumb_toolbar @group.name do %>
- <li class="toolbar-item">
- <%= link_to show_group_path(@group), class: 'button' do %>
- <%= op_icon('button--icon icon-user') %>
- <span class="button--text"><%= t(:label_profile) %></span>
- <% end %>
- </li>
- <% if current_user.admin? %>
- <li class="toolbar-item">
- <%= link_to group_path(@group),
- data: { confirm: t(:text_are_you_sure) },
- class: 'button -danger',
- method: :delete do %>
- <%= op_icon('button--icon icon-delete') %>
- <span class="button--text"><%= t(:button_delete) %></span>
- <% end %>
- </li>
- <% end %>
-<% end %>
-<%= render_tabs group_settings_tabs(@group) %>
+<% tabs = group_settings_tabs(@group) %>
+
+<%=
+ render(Primer::OpenProject::PageHeader.new) do |header|
+ header.with_title { @group.name }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_users_path, text: t(:label_user_and_permission) },
+ { href: groups_path, text: t(:label_group_plural) },
+ @group.name])
+
+ header.with_action_button(tag: :a,
+ mobile_icon: :person,
+ mobile_label: t(:label_profile),
+ size: :medium,
+ href: show_group_path(@group),
+ aria: { label: I18n.t(:label_profile) },
+ title: I18n.t(:label_profile)) do |button|
+ button.with_leading_visual_icon(icon: :person)
+ t(:label_profile)
+ end
+
+ if current_user.admin?
+ header.with_action_button(tag: :a,
+ scheme: :danger,
+ mobile_icon: :trash,
+ mobile_label: t(:button_delete),
+ size: :medium,
+ href: group_path(@group),
+ aria: { label: I18n.t(:button_delete) },
+ data: {
+ confirm: t(:text_are_you_sure),
+ method: :delete,
+ },
+ title: I18n.t(:button_delete)) do |button|
+ button.with_leading_visual_icon(icon: :trash)
+ t(:button_delete)
+ end
+ end
+
+ 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
+%>
+
+<%= render_tabs tabs, with_tab_nav: false %>
diff --git a/app/views/groups/index.html.erb b/app/views/groups/index.html.erb
index e0894b0a991..bf0fe1ceae6 100644
--- a/app/views/groups/index.html.erb
+++ b/app/views/groups/index.html.erb
@@ -28,17 +28,29 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_administration), t("label_group_plural") %>
-<%= toolbar title: t(:label_group_plural) do %>
- <li class="toolbar-item">
- <%= link_to new_group_path,
- { class: 'button -primary',
- aria: {label: t(:label_group_new)},
- title: t(:label_group_new)} do %>
- <%= op_icon('button--icon icon-add') %>
- <span class="button--text"><%= t('activerecord.models.group') %></span>
- <% end %>
- </li>
-<% end %>
+
+<%=
+ render(Primer::OpenProject::PageHeader.new) do |header|
+ header.with_title { t(:label_group_plural) }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_users_path, text: t(:label_user_and_permission) },
+ t(:label_group_plural)])
+ end
+%>
+
+<%=
+ render(Primer::OpenProject::SubHeader.new) do |subheader|
+ subheader.with_action_button(scheme: :primary,
+ aria: { label: I18n.t(:label_group_new) },
+ title: I18n.t(:label_group_new),
+ tag: :a,
+ href: new_group_path) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ t('activerecord.models.group')
+ end
+ end
+%>
+
<% if @groups.any? %>
<div class="generic-table--container">
<div class="generic-table--results-container">
diff --git a/app/views/groups/new.html.erb b/app/views/groups/new.html.erb
index ef6c1e256e0..91988f40cca 100644
--- a/app/views/groups/new.html.erb
+++ b/app/views/groups/new.html.erb
@@ -28,8 +28,18 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_administration), t("label_group_new") %>
-<% local_assigns[:additional_breadcrumb] = t(:label_group_new) %>
-<%= breadcrumb_toolbar t(:label_group_new) %>
+
+
+<%=
+ render(Primer::OpenProject::PageHeader.new) do |header|
+ header.with_title { t(:label_group_new) }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_users_path, text: t(:label_user_and_permission) },
+ { href: groups_path, text: t(:label_group_plural) },
+ t(:label_group_new)])
+ end
+%>
+
<%= labelled_tabular_form_for(@group) do |f| %>
<%= render partial: 'form', locals: { f: f } %>
diff --git a/app/views/groups/show.html.erb b/app/views/groups/show.html.erb
index 751eb896651..369ad1d9d3a 100644
--- a/app/views/groups/show.html.erb
+++ b/app/views/groups/show.html.erb
@@ -26,26 +26,47 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= breadcrumb_toolbar @group.name do %>
- <% if current_user.admin? %>
- <li class="toolbar-item">
- <%= link_to edit_group_path(@group),
- class: 'button' do %>
- <%= op_icon('button--icon icon-edit') %>
- <span class="button--text"><%= t(:button_edit) %></span>
- <% end %>
- </li>
- <li class="toolbar-item">
- <%= link_to @group,
- data: { confirm: t(:text_are_you_sure) },
- class: 'button -danger',
- method: :delete do %>
- <%= op_icon('button--icon icon-delete') %>
- <span class="button--text"><%= t(:button_delete) %></span>
- <% end %>
- </li>
- <% end %>
-<% end %>
+<% html_title h(@group.name), t(:label_group_plural) -%>
+
+<%=
+ render(Primer::OpenProject::PageHeader.new) do |header|
+ header.with_title { @group.name }
+ header.with_breadcrumbs(
+ [
+ { href: groups_path, text: t(:label_group_plural) },
+ @group.name
+ ])
+
+ if current_user.admin?
+ header.with_action_button(tag: :a,
+ mobile_icon: :pencil,
+ mobile_label: t(:button_edit),
+ size: :medium,
+ href: edit_group_path(@group),
+ aria: { label: I18n.t(:button_edit) },
+ title: I18n.t(:button_edit)) do |button|
+ button.with_leading_visual_icon(icon: :pencil)
+ t(:button_edit)
+ end
+
+ header.with_action_button(tag: :a,
+ scheme: :danger,
+ mobile_icon: :trash,
+ mobile_label: t(:button_delete),
+ size: :medium,
+ href: group_path(@group),
+ aria: { label: I18n.t(:button_delete) },
+ data: {
+ confirm: t(:text_are_you_sure),
+ method: :delete,
+ },
+ title: I18n.t(:button_delete)) do |button|
+ button.with_leading_visual_icon(icon: :trash)
+ t(:button_delete)
+ end
+ end
+ end
+%>
<% if @group_users.any? %>
<ul>