-
Notifications
You must be signed in to change notification settings - Fork 0
/
AdminMenu.cs
40 lines (35 loc) · 1.43 KB
/
AdminMenu.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using BCS.AdminSearch.Drivers;
using Microsoft.Extensions.Localization;
using OrchardCore.Navigation;
using System;
using System.Threading.Tasks;
namespace BCS.AdminSearch
{
public class AdminMenu : INavigationProvider
{
private readonly IStringLocalizer<AdminMenu> T;
public AdminMenu(IStringLocalizer<AdminMenu> localizer)
{
T = localizer;
}
public Task BuildNavigationAsync(string name, NavigationBuilder builder)
{
if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase))
return Task.CompletedTask;
builder
.Add(T["Configuration"], configuration => configuration
.Add(T["Settings"], settings => settings
.Add(T["Admin Search"], T["Admin Search"], entry => entry
.Action("Index", "Admin", new { area = "OrchardCore.Settings", groupId = AdminSearchSettingsDisplayDriver.GroupId })
.Permission(Permissions.ManageAdminSearchSettings)
.LocalNav()
)))
.Add(T["Content"], content => content
.Add(T["Search"], T["Search"], search => search
.Action("Search", "Admin", new { area = "BCS.AdminSearch" })
.LocalNav()
));
return Task.CompletedTask;
}
}
}