mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-24 18:25:04 +08:00
40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using Orchard.Environment.Extensions;
|
|
using Orchard.Localization;
|
|
using Orchard.UI.Navigation;
|
|
using Orchard.Security;
|
|
using Orchard.Environment.Configuration;
|
|
|
|
namespace Orchard.Packaging {
|
|
[OrchardFeature("Gallery")]
|
|
public class AdminMenu : INavigationProvider {
|
|
public Localizer T { get; set; }
|
|
|
|
public string MenuName {
|
|
get { return "admin"; }
|
|
}
|
|
private readonly ShellSettings _shellSettings;
|
|
|
|
public AdminMenu(ShellSettings shellSettings) {
|
|
_shellSettings = shellSettings;
|
|
}
|
|
|
|
public void GetNavigation(NavigationBuilder builder) {
|
|
if (_shellSettings.Name.ToLower() == "default") {
|
|
builder
|
|
.Add(T("Modules"), menu => menu
|
|
.Add(T("Gallery"), "3", item => Describe(item, "Modules", "Gallery", true)))
|
|
.Add(T("Themes"), menu => menu
|
|
.Add(T("Gallery"), "3", item => Describe(item, "Themes", "Gallery", true)))
|
|
.Add(T("Settings"), menu => menu
|
|
.Add(T("Gallery"), "1", item => Describe(item, "Sources", "Gallery", false)));
|
|
}
|
|
}
|
|
|
|
static NavigationItemBuilder Describe(NavigationItemBuilder item, string actionName, string controllerName, bool localNav) {
|
|
item = item.Action(actionName, controllerName, new { area = "Orchard.Packaging" }).Permission(StandardPermissions.SiteOwner);
|
|
if (localNav)
|
|
item = item.LocalNav();
|
|
return item;
|
|
}
|
|
}
|
|
} |