diff --git a/app/components/groups/show_page_header_component.html.erb b/app/components/groups/show_page_header_component.html.erb index da21c0482af..39f5d9b136c 100644 --- a/app/components/groups/show_page_header_component.html.erb +++ b/app/components/groups/show_page_header_component.html.erb @@ -35,15 +35,15 @@ See COPYRIGHT and LICENSE files for more details. header.with_action_button( tag: :a, mobile_icon: :pencil, - mobile_label: t(:button_edit), + mobile_label: edit_label, size: :medium, - href: edit_group_path(@group), - aria: { label: I18n.t(:button_edit) }, + href: edit_path, + aria: { label: edit_label }, data: { "test-selector": "groups--edit-group-button" }, - title: I18n.t(:button_edit) + title: edit_label ) do |button| button.with_leading_visual_icon(icon: :pencil) - t(:button_edit) + edit_label end header.with_action_button( diff --git a/app/components/groups/show_page_header_component.rb b/app/components/groups/show_page_header_component.rb index 14a34d03869..df4090f3986 100644 --- a/app/components/groups/show_page_header_component.rb +++ b/app/components/groups/show_page_header_component.rb @@ -40,8 +40,50 @@ module Groups end def breadcrumb_items - [{ href: groups_path, text: t(:label_group_plural) }, - @group.name] + if @current_user.admin? + admin_breadcrumb_items + else + non_admin_breadcrumb_items + end + end + + private + + def admin_breadcrumb_items + items = [{ href: admin_index_path, text: t("label_administration") }, + { href: admin_settings_users_path, text: t(:label_user_and_permission) }] + + items << if @group.organizational_unit? + { href: admin_departments_path, text: t(:label_departments) } + else + { href: groups_path, text: t(:label_group_plural) } + end + + items << @group.name + end + + def non_admin_breadcrumb_items + if @group.organizational_unit? + [t(:label_departments), @group.name] + else + [t(:label_group_plural), @group.name] + end + end + + def edit_path + if @group.organizational_unit? + edit_admin_department_path(@group) + else + edit_group_path(@group) + end + end + + def edit_label + if @group.organizational_unit? + t("departments.edit") + else + t(:button_edit) + end end end end diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 1538e00ad5f..5fbc9751a9d 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -83,12 +83,6 @@ module GroupsHelper partial: "principals/global_roles", path: edit_admin_department_path(group, tab: :global_roles), label: :label_global_roles - }, - { - name: "synchronized_groups", - partial: "groups/synchronized_groups", - path: edit_admin_department_path(group, tab: :synchronized_groups), - label: :"groups.edit.synchronized_groups" } ] end diff --git a/config/locales/en.yml b/config/locales/en.yml index 385206132ca..15a38b12b8e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -722,6 +722,7 @@ en: confirmation_live_message_unchecked: "The button to proceed is now inactive. You need to tick the checkbox to continue." departments: + edit: "Edit department" add_user: "Add user" add_department: "Add department" blankslate: