Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize the Admin Menu #17112

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
803216e
Move all settings under "Settings" menu item and add "Tools" in place…
MikeAlhayek Dec 3, 2024
5c63ae5
Merge branch 'main' into ma/admin-menu-settings
MikeAlhayek Dec 3, 2024
d505ad1
more organization
MikeAlhayek Dec 4, 2024
2da1ea0
Merge branch 'main' into ma/admin-menu-settings
MikeAlhayek Dec 4, 2024
70f7cce
use PrefixPosition
MikeAlhayek Dec 4, 2024
779e7fc
update NavigationConstants
MikeAlhayek Dec 4, 2024
77dc434
ensure tools come before settings at the end of the menu
MikeAlhayek Dec 4, 2024
f27202d
placement
MikeAlhayek Dec 4, 2024
6c0065c
Merge branch 'main' into ma/admin-menu-settings
MikeAlhayek Dec 5, 2024
042d83b
Add a swich for legacy format
MikeAlhayek Dec 5, 2024
94fbe43
fix missed menus
MikeAlhayek Dec 5, 2024
a0d7962
group settings
MikeAlhayek Dec 6, 2024
6e753b9
Use Model.Text in the templates
MikeAlhayek Dec 6, 2024
9962424
shorten the switch key
MikeAlhayek Dec 6, 2024
8869d23
don't use icons
MikeAlhayek Dec 6, 2024
a0ae2e0
Merge branch 'main' into ma/admin-menu-settings
MikeAlhayek Dec 6, 2024
b5fa299
Merge branch 'main' into ma/admin-menu-settings
MikeAlhayek Dec 11, 2024
6e6cdb0
Merge branch 'main' into ma/admin-menu-settings
MikeAlhayek Dec 13, 2024
7c9cd3c
move Content definitions into Design menu
MikeAlhayek Dec 13, 2024
dbdd7ff
fix placement of content definitions
MikeAlhayek Dec 13, 2024
e514594
move media to root level
MikeAlhayek Dec 13, 2024
adde19b
Merge branch 'main' into ma/admin-menu-settings
MikeAlhayek Dec 13, 2024
9a00fc3
update blog theme
MikeAlhayek Dec 15, 2024
9aa6120
Merge branch 'main' into ma/admin-menu-settings
MikeAlhayek Dec 15, 2024
ab9b7d4
adding content
MikeAlhayek Dec 15, 2024
e8f3514
Merge branch 'main' into ma/admin-menu-settings
MikeAlhayek Dec 17, 2024
995ed06
Use title case
MikeAlhayek Dec 17, 2024
ff19ab9
move media options under settings
MikeAlhayek Dec 17, 2024
8960ba7
Merge branch 'main' into ma/admin-menu-settings
MikeAlhayek Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/OrchardCore.Modules/OrchardCore.Admin/AdminMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,34 @@ public AdminMenu(IStringLocalizer<AdminMenu> stringLocalizer)

protected override ValueTask BuildAsync(NavigationBuilder builder)
{
builder
if (NavigationHelper.UseLegacyFormat())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add to the release notes about this PR, as well as how to opt back to the legacy format. The documentation also needs to be combed through for any references to the menu structure, either in written instructions, or images.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Planning to update the docs before merging. Just need to finalize the PR first.

{
builder
.Add(S["Configuration"], configuration => configuration
.Add(S["Settings"], settings => settings
.Add(S["Admin"], S["Admin"].PrefixPosition(), admin => admin
.AddClass("admin").Id("admin")
.AddClass("admin")
.Id("admin")
.Action("Index", "Admin", _routeValues)
.Permission(PermissionsAdminSettings.ManageAdminSettings)
.LocalNav()
)
)
);

return ValueTask.CompletedTask;
}

builder
.Add(S["Settings"], settings => settings
.Add(S["Admin"], S["Admin"].PrefixPosition(), admin => admin
.AddClass("admin").Id("admin")
.Action("Index", "Admin", _routeValues)
.Permission(PermissionsAdminSettings.ManageAdminSettings)
.LocalNav()
)
);

return ValueTask.CompletedTask;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
<span class="icon">
<i class="fa-solid fa-tachometer" aria-hidden="true"></i>
@using OrchardCore.Navigation

@if (NavigationHelper.UseLegacyFormat())
{
<span class="icon">
<i class="fa-solid fa-tachometer" aria-hidden="true"></i>
</span>
<span class="title">@Model.Text</span>

return;
}

<span class="icon icon-none">
</span>
<span class="title">@T["Admin"]</span>
<span class="title">@Model.Text</span>
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<span class="icon"><i class="fa-solid fa-tachometer-alt" aria-hidden="true"></i></span><span class="title">@T["Dashboard"]</span>
<span class="icon">
<i class="fa-solid fa-tachometer-alt" aria-hidden="true"></i>
</span>
<span class="title">@Model.Text</span>
33 changes: 24 additions & 9 deletions src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,30 @@ public AdminMenu(

protected override ValueTask BuildAsync(NavigationBuilder builder)
{
// Configuration and settings menus for the AdminMenu module.
builder
.Add(S["Configuration"], configuration => configuration
.Add(S["Admin Menus"], S["Admin Menus"].PrefixPosition(), adminMenu => adminMenu
.Permission(Permissions.ManageAdminMenu)
.Action("List", "Menu", "OrchardCore.AdminMenu")
.LocalNav()
)
);
if (NavigationHelper.UseLegacyFormat())
{
// Configuration and settings menus for the AdminMenu module.
builder
.Add(S["Configuration"], configuration => configuration
.Add(S["Admin menus"], S["Admin menus"].PrefixPosition(), adminMenu => adminMenu
gvkries marked this conversation as resolved.
Show resolved Hide resolved
.Permission(Permissions.ManageAdminMenu)
.Action("List", "Menu", "OrchardCore.AdminMenu")
.LocalNav()
)
);
}
else
{
// Configuration and settings menus for the AdminMenu module.
builder
.Add(S["Tools"], tools => tools
.Add(S["Admin Menus"], S["Admin Menus"].PrefixPosition(), adminMenu => adminMenu
.Permission(Permissions.ManageAdminMenu)
.Action("List", "Menu", "OrchardCore.AdminMenu")
.LocalNav()
)
);
}

// This is the entry point for the adminMenu: dynamically generated custom admin menus.
return _adminMenuNavigationProviderCoordinator.BuildNavigationAsync(NavigationConstants.AdminMenuId, builder);
Expand Down
16 changes: 15 additions & 1 deletion src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/AdminMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,22 @@ public AdminMenu(IStringLocalizer<AdminMenu> stringLocalizer)

protected override ValueTask BuildAsync(NavigationBuilder builder)
{
if (NavigationHelper.UseLegacyFormat())
{
builder
.Add(S["Configuration"], configuration => configuration
.Add(S["GraphiQL"], S["GraphiQL"].PrefixPosition(), graphiQL => graphiQL
.Action("Index", "Admin", "OrchardCore.Apis.GraphQL")
.Permission(CommonPermissions.ExecuteGraphQL)
.LocalNav()
)
);

return ValueTask.CompletedTask;
}

builder
.Add(S["Configuration"], configuration => configuration
.Add(S["Tools"], tools => tools
.Add(S["GraphiQL"], S["GraphiQL"].PrefixPosition(), graphiQL => graphiQL
.Action("Index", "Admin", "OrchardCore.Apis.GraphQL")
.Permission(CommonPermissions.ExecuteGraphQL)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Localization;
using OrchardCore.AuditTrail.Controllers;
using OrchardCore.AuditTrail.Settings;
using OrchardCore.Navigation;

namespace OrchardCore.AuditTrail.Navigation;
Expand All @@ -13,6 +14,12 @@ public sealed class AuditTrailAdminMenu : AdminNavigationProvider
{ "correlationId", string.Empty },
};

private static readonly RouteValueDictionary _settingsRouteValues = new()
{
{ "area", "OrchardCore.Settings" },
{ "groupId", AuditTrailSettingsGroup.Id },
};

internal readonly IStringLocalizer S;

public AuditTrailAdminMenu(IStringLocalizer<AuditTrailAdminMenu> stringLocalizer)
Expand All @@ -22,13 +29,49 @@ public AuditTrailAdminMenu(IStringLocalizer<AuditTrailAdminMenu> stringLocalizer

protected override ValueTask BuildAsync(NavigationBuilder builder)
{
if (NavigationHelper.UseLegacyFormat())
{
builder
.Add(S["Audit Trail"], NavigationConstants.AdminMenuAuditTrailPosition, configuration => configuration
.AddClass("audittrail")
.Id("audittrail")
.Action(nameof(AdminController.Index), "Admin", _routeValues)
.Permission(AuditTrailPermissions.ViewAuditTrail)
.LocalNav()
, priority: 1)
.Add(S["Configuration"], configuration => configuration
.Add(S["Settings"], settings => settings
.Add(S["Audit Trail"], S["Audit Trail"].PrefixPosition(), auditTrail => auditTrail
.AddClass("audittrail")
.Id("audittrailSettings")
.Action("Index", "Admin", _routeValues)
.Permission(AuditTrailPermissions.ManageAuditTrailSettings)
.LocalNav()
)
)
);

return ValueTask.CompletedTask;
}

builder
.Add(S["Audit Trail"], NavigationConstants.AdminMenuAuditTrailPosition, configuration => configuration
.AddClass("audittrail")
.Id("audittrail")
.Action(nameof(AdminController.Index), "Admin", _routeValues)
.Permission(AuditTrailPermissions.ViewAuditTrail)
.LocalNav()
.Add(S["Tools"], tools => tools
.Add(S["Audit Trail"], S["Audit Trail"].PrefixPosition(), configuration => configuration
.AddClass("audittrail")
.Id("audittrail")
.Action(nameof(AdminController.Index), "Admin", _routeValues)
.Permission(AuditTrailPermissions.ViewAuditTrail)
.LocalNav()
)
)
.Add(S["Settings"], settings => settings
.Add(S["Audit Trail"], S["Audit Trail"].PrefixPosition(), auditTrail => auditTrail
.AddClass("audittrail")
.Id("audittrailSettings")
.Action("Index", "Admin", _settingsRouteValues)
.Permission(AuditTrailPermissions.ManageAuditTrailSettings)
.LocalNav()
)
);

return ValueTask.CompletedTask;
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public override void ConfigureServices(IServiceCollection services)

services.AddPermissionProvider<Permissions>();
services.AddNavigationProvider<AuditTrailAdminMenu>();
services.AddNavigationProvider<AuditTrailSettingsAdminMenu>();

services.AddSiteDisplayDriver<AuditTrailSettingsDisplayDriver>();
services.AddSiteDisplayDriver<AuditTrailTrimmingSettingsDisplayDriver>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
<span class="icon"><i class="fa-solid fa-history" aria-hidden="true"></i></span><span class="title">@Model.Text</span>
@using OrchardCore.Navigation

@if (NavigationHelper.UseLegacyFormat())
{
<span class="icon">
<i class="fa-solid fa-history" aria-hidden="true"></i>
</span>
<span class="title">@Model.Text</span>

return;
}

<span class="icon icon-none"></span>
<span class="title">@Model.Text</span>
28 changes: 21 additions & 7 deletions src/OrchardCore.Modules/OrchardCore.BackgroundTasks/AdminMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,28 @@ public AdminMenu(IStringLocalizer<AdminMenu> stringLocalizer)

protected override ValueTask BuildAsync(NavigationBuilder builder)
{
builder
.Add(S["Configuration"], configuration => configuration
.Add(S["Tasks"], S["Tasks"].PrefixPosition(), tasks => tasks
.Add(S["Background Tasks"], S["Background Tasks"].PrefixPosition(), backgroundTasks => backgroundTasks
.Action("Index", "BackgroundTask", "OrchardCore.BackgroundTasks")
.Permission(Permissions.ManageBackgroundTasks)
.LocalNav()
if (NavigationHelper.UseLegacyFormat())
{
builder
.Add(S["Configuration"], configuration => configuration
.Add(S["Tasks"], S["Tasks"].PrefixPosition(), tasks => tasks
.Add(S["Background Tasks"], S["Background Tasks"].PrefixPosition(), backgroundTasks => backgroundTasks
.Action("Index", "BackgroundTask", "OrchardCore.BackgroundTasks")
.Permission(Permissions.ManageBackgroundTasks)
.LocalNav()
)
)
);

return ValueTask.CompletedTask;
}

builder
.Add(S["Tools"], tools => tools
.Add(S["Background Tasks"], S["Background Tasks"].PrefixPosition(), backgroundTasks => backgroundTasks
.Action("Index", "BackgroundTask", "OrchardCore.BackgroundTasks")
.Permission(Permissions.ManageBackgroundTasks)
.LocalNav()
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public AdminMenu(IStringLocalizer<AdminMenu> stringLocalizer)

protected override ValueTask BuildAsync(NavigationBuilder builder)
{
builder
if (NavigationHelper.UseLegacyFormat())
{
builder
.Add(S["Configuration"], configuration => configuration
.Add(S["Settings"], settings => settings
.Add(S["Localization"], localization => localization
Expand All @@ -50,6 +52,29 @@ protected override ValueTask BuildAsync(NavigationBuilder builder)
)
);

return ValueTask.CompletedTask;
}

builder
.Add(S["Settings"], settings => settings
.Add(S["Localization"], S["Localization"].PrefixPosition(), localization => localization
.Add(S["Content Culture"], S["Content Culture"].PrefixPosition(), provider => provider
.AddClass("contentrequestcultureprovider")
.Id("contentrequestcultureprovider")
.Action("Index", "Admin", _providersRouteValues)
.Permission(Permissions.ManageContentCulturePicker)
.LocalNav()
)
.Add(S["Content Culture Picker"], S["Content Culture Picker"].PrefixPosition(), picker => picker
.AddClass("contentculturepicker")
.Id("contentculturepicker")
.Action("Index", "Admin", _pickerRouteValues)
.Permission(Permissions.ManageContentCulturePicker)
.LocalNav()
)
)
);

return ValueTask.CompletedTask;
}
}
23 changes: 21 additions & 2 deletions src/OrchardCore.Modules/OrchardCore.ContentTypes/AdminMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,28 @@ public AdminMenu(IStringLocalizer<AdminMenu> stringLocalizer)

protected override ValueTask BuildAsync(NavigationBuilder builder)
{
if (NavigationHelper.UseLegacyFormat())
{
builder
.Add(S["Content"], content => content
.Add(S["Content Definition"], S["Content Definition"].PrefixPosition("9"), contentDefinition => contentDefinition
.Add(S["Content Types"], S["Content Types"].PrefixPosition("1"), contentTypes => contentTypes
.Action(nameof(AdminController.List), _adminControllerName, "OrchardCore.ContentTypes")
.Permission(Permissions.ViewContentTypes)
.LocalNav()
)
.Add(S["Content Parts"], S["Content Parts"].PrefixPosition("2"), contentParts => contentParts
.Action(nameof(AdminController.ListParts), _adminControllerName, "OrchardCore.ContentTypes")
.Permission(Permissions.ViewContentTypes)
.LocalNav()
)
)
);
}

builder
.Add(S["Content"], content => content
.Add(S["Content Definition"], S["Content Definition"].PrefixPosition("9"), contentDefinition => contentDefinition
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
.Add(S["Design"], content => content
.Add(S["Content Definition"], S["Content Definition"].PrefixPosition(), contentDefinition => contentDefinition
.Add(S["Content Types"], S["Content Types"].PrefixPosition("1"), contentTypes => contentTypes
.Action(nameof(AdminController.List), _adminControllerName, "OrchardCore.ContentTypes")
.Permission(Permissions.ViewContentTypes)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<span class="icon"><i class="fa-solid fa-cube" aria-hidden="true"></i></span><span class="title">@T["Content Definition"]</span>
<span class="icon">
<i class="fa-solid fa-cube" aria-hidden="true"></i>
</span>
<span class="title">@Model.Text</span>
Loading
Loading