mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Store default location for MenuPart part in initial settings
--HG-- branch : dev
This commit is contained in:
parent
7811c4b5f1
commit
a444c093a9
@ -1,4 +1,8 @@
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.Core.Navigation.DataMigrations {
|
||||
@ -30,5 +34,13 @@ namespace Orchard.Core.Navigation.DataMigrations {
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
public int UpdateFrom2() {
|
||||
ContentDefinitionManager.AlterPartDefinition(typeof(MenuPart).Name, cfg => cfg
|
||||
.WithLocation(new Dictionary<string, ContentLocation> {
|
||||
{"Editor", new ContentLocation { Zone = "primary", Position = "9" }}
|
||||
}));
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
@ -28,8 +28,7 @@ namespace Orchard.Core.Navigation.Drivers {
|
||||
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part))
|
||||
return null;
|
||||
|
||||
var location = part.GetLocation("Editor", "primary", "9");
|
||||
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart").Location(location);
|
||||
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart").Location(part.GetLocation("Editor"));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(MenuPart part, IUpdateModel updater) {
|
||||
@ -43,8 +42,7 @@ namespace Orchard.Core.Navigation.Drivers {
|
||||
if (part.OnMainMenu && String.IsNullOrEmpty(part.MenuText)) {
|
||||
updater.AddModelError("MenuText", T("The MenuText field is required"));
|
||||
}
|
||||
var location = part.GetLocation("Editor", "primary", "9");
|
||||
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart").Location(location);
|
||||
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart").Location(part.GetLocation("Editor"));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user