-
Notifications
You must be signed in to change notification settings - Fork 0
/
AdminMenu.cs
33 lines (29 loc) · 1.11 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
using Microsoft.Extensions.Localization;
using OrchardCore.Navigation;
using System;
using System.Threading.Tasks;
namespace Etch.OrchardCore.TinyPNG
{
public class AdminMenu : INavigationProvider
{
private readonly IStringLocalizer S;
public AdminMenu(IStringLocalizer<AdminMenu> localizer)
{
S = localizer;
}
public Task BuildNavigationAsync(string name, NavigationBuilder builder)
{
if (string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase))
{
builder.Add(S["Configuration"], configuration => configuration
.Add(S["Tiny PNG"], S["Tiny PNG"].PrefixPosition(), settings => settings
.AddClass("tinyPNG").Id("tinyPNG")
.Action("Index", "Admin", new { area = "OrchardCore.Settings", groupId = Constants.GroupId })
.Permission(TinyPngPermissions.ManageTinyPng)
.LocalNav())
);
}
return Task.CompletedTask;
}
}
}