Correctly link to edit department when we are showing a department

This commit is contained in:
Klaus Zanders
2026-04-16 16:28:25 +02:00
parent a7d3555db2
commit 3952f2b75c
4 changed files with 50 additions and 13 deletions
@@ -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(
@@ -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
-6
View File
@@ -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
+1
View File
@@ -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: