UX: display link to groups in admin sidebar (#30291)

Add groups link to admin and moderator sidebar for easy access.
Currently, the admin needs to go to `users` first.
This commit is contained in:
Krzysztof Kotlarek 2024-12-17 10:07:24 +11:00 committed by GitHub
parent 2827ca992f
commit a8bdc5f7c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 8 deletions

View File

@ -202,6 +202,13 @@ export function useAdminNavConfig(navMap) {
icon: "users", icon: "users",
moderator: true, moderator: true,
}, },
{
name: "admin_groups",
route: "groups",
label: "admin.community.sidebar_link.groups",
icon: "user-group",
moderator: true,
},
{ {
name: "admin_all_site_settings", name: "admin_all_site_settings",
route: "adminSiteSettings", route: "adminSiteSettings",

View File

@ -5588,6 +5588,7 @@ en:
permalinks: "Permalinks" permalinks: "Permalinks"
trust_levels: "Trust Levels" trust_levels: "Trust Levels"
users: "Users" users: "Users"
groups: "Groups"
user_fields: "User Fields" user_fields: "User Fields"
watched_words: "Watched Words" watched_words: "Watched Words"
legal: "Legal" legal: "Legal"

View File

@ -50,8 +50,10 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
it "collapses sections by default" do it "collapses sections by default" do
visit("/admin") visit("/admin")
links = page.all(".sidebar-section-link-content-text") links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(4) expect(links.count).to eq(5)
expect(links.map(&:text)).to eq(["Dashboard", "Users", "All Site Settings", "What's New"]) expect(links.map(&:text)).to eq(
["Dashboard", "Users", "Groups", "All Site Settings", "What's New"],
)
end end
context "when on mobile" do context "when on mobile" do
@ -173,8 +175,10 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
it "temporarily expands section when filter" do it "temporarily expands section when filter" do
visit("/admin") visit("/admin")
links = page.all(".sidebar-section-link-content-text") links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(4) expect(links.count).to eq(5)
expect(links.map(&:text)).to eq(["Dashboard", "Users", "All Site Settings", "What's New"]) expect(links.map(&:text)).to eq(
["Dashboard", "Users", "Groups", "All Site Settings", "What's New"],
)
filter.filter("ie") filter.filter("ie")
links = page.all(".sidebar-section-link-content-text") links = page.all(".sidebar-section-link-content-text")
@ -183,8 +187,10 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
filter.filter("") filter.filter("")
links = page.all(".sidebar-section-link-content-text") links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(4) expect(links.count).to eq(5)
expect(links.map(&:text)).to eq(["Dashboard", "Users", "All Site Settings", "What's New"]) expect(links.map(&:text)).to eq(
["Dashboard", "Users", "Groups", "All Site Settings", "What's New"],
)
end end
it "allows further filtering of site settings or users if links do not show results" do it "allows further filtering of site settings or users if links do not show results" do
@ -223,9 +229,9 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
expect(page).to have_selector(".sidebar-section-link-content-text", minimum: 50) expect(page).to have_selector(".sidebar-section-link-content-text", minimum: 50)
sidebar.toggle_all_sections sidebar.toggle_all_sections
expect(page).to have_selector(".sidebar-section-link-content-text", count: 4) expect(page).to have_selector(".sidebar-section-link-content-text", count: 5)
expect(all(".sidebar-section-link-content-text").map(&:text)).to eq( expect(all(".sidebar-section-link-content-text").map(&:text)).to eq(
["Dashboard", "Users", "All Site Settings", "What's New"], ["Dashboard", "Users", "Groups", "All Site Settings", "What's New"],
) )
sidebar.toggle_all_sections sidebar.toggle_all_sections
@ -282,6 +288,7 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
[ [
"Dashboard", "Dashboard",
"Users", "Users",
"Groups",
"What's New", "What's New",
"All", "All",
"Watched Words", "Watched Words",