-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b91812
commit f563585
Showing
4 changed files
with
34 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 12 additions & 11 deletions
23
src/Modules/CrestApps.OrchardCore.Users/AvatarAdminMenu.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,40 @@ | ||
using CrestApps.OrchardCore.Users.Drivers; | ||
using Microsoft.AspNetCore.Routing; | ||
using Microsoft.Extensions.Localization; | ||
using OrchardCore.Navigation; | ||
|
||
namespace CrestApps.OrchardCore.Users; | ||
|
||
public class AvatarAdminMenu : INavigationProvider | ||
public sealed class AvatarAdminMenu : AdminNavigationProvider | ||
{ | ||
protected readonly IStringLocalizer S; | ||
private static readonly RouteValueDictionary _routeValues = new() | ||
{ | ||
{ "area", "OrchardCore.Settings" }, | ||
{ "groupId", UserAvatarOptionsDisplayDriver.GroupId }, | ||
}; | ||
|
||
internal readonly IStringLocalizer S; | ||
|
||
public AvatarAdminMenu(IStringLocalizer<UserDisplayNameAdminMenu> stringLocalizer) | ||
{ | ||
S = stringLocalizer; | ||
} | ||
|
||
public Task BuildNavigationAsync(string name, NavigationBuilder builder) | ||
protected override ValueTask BuildAsync(NavigationBuilder builder) | ||
{ | ||
if (!NavigationHelper.IsAdminMenu(name)) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
builder | ||
.Add(S["Configuration"], configuration => configuration | ||
.Add(S["Settings"], settings => settings | ||
.Add(S["User Avatars"], S["User Avatars"].PrefixPosition(), userAvatars => userAvatars | ||
.AddClass("user-avatars") | ||
.Id("userAvatars") | ||
.Action("Index", "Admin", new { area = "OrchardCore.Settings", groupId = UserAvatarOptionsDisplayDriver.GroupId }) | ||
.Action("Index", "Admin", _routeValues) | ||
.Permission(UserPermissions.ManageAvatarSettings) | ||
.LocalNav() | ||
) | ||
) | ||
); | ||
|
||
|
||
return Task.CompletedTask; | ||
return ValueTask.CompletedTask; | ||
} | ||
} |
22 changes: 12 additions & 10 deletions
22
src/Modules/CrestApps.OrchardCore.Users/UserDisplayNameAdminMenu.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,41 @@ | ||
using CrestApps.OrchardCore.Users.Drivers; | ||
using Microsoft.AspNetCore.Routing; | ||
using Microsoft.Extensions.Localization; | ||
using OrchardCore.Navigation; | ||
|
||
namespace CrestApps.OrchardCore.Users; | ||
|
||
public sealed class UserDisplayNameAdminMenu : INavigationProvider | ||
public sealed class UserDisplayNameAdminMenu : AdminNavigationProvider | ||
{ | ||
private static readonly RouteValueDictionary _routeValues = new() | ||
{ | ||
{ "area", "OrchardCore.Settings" }, | ||
{ "groupId", DisplayNameSettingsDisplayDriver.GroupId }, | ||
}; | ||
|
||
|
||
internal readonly IStringLocalizer S; | ||
|
||
public UserDisplayNameAdminMenu(IStringLocalizer<UserDisplayNameAdminMenu> stringLocalizer) | ||
{ | ||
S = stringLocalizer; | ||
} | ||
|
||
public Task BuildNavigationAsync(string name, NavigationBuilder builder) | ||
protected override ValueTask BuildAsync(NavigationBuilder builder) | ||
{ | ||
if (!NavigationHelper.IsAdminMenu(name)) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
builder | ||
.Add(S["Configuration"], configuration => configuration | ||
.Add(S["Settings"], settings => settings | ||
.Add(S["User Display Name"], S["User Display Name"].PrefixPosition(), userDisplayName => userDisplayName | ||
.AddClass("user-display-name") | ||
.Id("userDisplayName") | ||
.Action("Index", "Admin", new { area = "OrchardCore.Settings", groupId = DisplayNameSettingsDisplayDriver.GroupId }) | ||
.Action("Index", "Admin", _routeValues) | ||
.Permission(UserPermissions.ManageDisplaySettings) | ||
.LocalNav() | ||
) | ||
) | ||
); | ||
|
||
|
||
return Task.CompletedTask; | ||
return ValueTask.CompletedTask; | ||
} | ||
} |