mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-21 18:49:41 +08:00
- Admin menu not appearing on Admin/Navigation - Dependencies where not resolved correctly --HG-- branch : dev
This commit is contained in:
@@ -43,7 +43,7 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
if (model.MenuItemEntries == null || model.MenuItemEntries.Count() < 1)
|
||||
model.MenuItemEntries = _menuService.Get().Select(CreateMenuItemEntries).OrderBy(menuPartEntry => menuPartEntry.MenuItem.Position, new PositionComparer()).ToList();
|
||||
|
||||
return View("Index", model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Index")]
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Navigation;
|
||||
|
||||
namespace Orchard.Core.Navigation.Services {
|
||||
[UsedImplicitly]
|
||||
public class MainMenuNavigationProvider : INavigationProvider {
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
public MainMenuNavigationProvider(IContentManager contentManager) {
|
||||
_contentManager = contentManager;
|
||||
}
|
||||
|
||||
public string MenuName { get { return "main"; } }
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
var menuParts = _contentManager.Query<MenuPart, MenuPartRecord>().Where(x => x.OnMainMenu).List();
|
||||
foreach (var menuPart in menuParts) {
|
||||
if (menuPart != null ) {
|
||||
var part = menuPart;
|
||||
|
||||
if (part.Is<MenuItemPart>())
|
||||
builder.Add(
|
||||
menu => menu.Add(new LocalizedString(part.MenuText), part.MenuPosition, nib => nib.Url(part.As<MenuItemPart>().Url)));
|
||||
else
|
||||
builder.Add(
|
||||
menu =>
|
||||
menu.Add(new LocalizedString(part.MenuText), part.MenuPosition,
|
||||
nib =>
|
||||
nib.Action(_contentManager.GetItemMetadata(part.ContentItem).DisplayRouteValues)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,20 +2,16 @@
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Navigation;
|
||||
|
||||
namespace Orchard.Core.Navigation.Services {
|
||||
[UsedImplicitly]
|
||||
public class MainMenuService : INavigationProvider, IMenuService {
|
||||
public class MainMenuService : IMenuService {
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
public MainMenuService(IContentManager contentManager) {
|
||||
_contentManager = contentManager;
|
||||
}
|
||||
|
||||
public string MenuName { get { return "main"; } }
|
||||
|
||||
public IEnumerable<MenuPart> Get() {
|
||||
return _contentManager.Query<MenuPart, MenuPartRecord>().Where(x => x.OnMainMenu).List();
|
||||
}
|
||||
@@ -27,24 +23,5 @@ namespace Orchard.Core.Navigation.Services {
|
||||
public void Delete(MenuPart menuPart) {
|
||||
_contentManager.Remove(menuPart.ContentItem);
|
||||
}
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
var menuParts = _contentManager.Query<MenuPart, MenuPartRecord>().Where(x => x.OnMainMenu).List();
|
||||
foreach (var menuPart in menuParts) {
|
||||
if (menuPart != null ) {
|
||||
var part = menuPart;
|
||||
|
||||
if (part.Is<MenuItemPart>())
|
||||
builder.Add(
|
||||
menu => menu.Add(new LocalizedString(part.MenuText), part.MenuPosition, nib => nib.Url(part.As<MenuItemPart>().Url)));
|
||||
else
|
||||
builder.Add(
|
||||
menu =>
|
||||
menu.Add(new LocalizedString(part.MenuText), part.MenuPosition,
|
||||
nib =>
|
||||
nib.Action(_contentManager.GetItemMetadata(part.ContentItem).DisplayRouteValues)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,7 @@
|
||||
<Compile Include="Messaging\Models\MessageSettingsPartRecord.cs" />
|
||||
<Compile Include="Messaging\Services\DefaultMessageManager.cs" />
|
||||
<Compile Include="Messaging\ViewModels\MessageSettingsPartViewModel.cs" />
|
||||
<Compile Include="Navigation\Services\MainMenuNavigationProvider.cs" />
|
||||
<Compile Include="PublishLater\ResourceManifest.cs" />
|
||||
<Compile Include="PublishLater\DataMigrations\PublishLaterDataMigration.cs" />
|
||||
<Compile Include="PublishLater\Drivers\PublishLaterPartDriver.cs" />
|
||||
|
||||
Reference in New Issue
Block a user