mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -16,14 +16,11 @@ namespace Orchard.Core.Navigation.Drivers {
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(MenuItemPart itemPart, IUpdateModel updater, dynamic shapeHelper) {
|
||||
//todo: (heskew) need context
|
||||
var currentUser = _workContextAccessor.GetContext().CurrentUser;
|
||||
|
||||
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, currentUser, itemPart))
|
||||
return null;
|
||||
|
||||
updater.TryUpdateModel(itemPart, Prefix, null, null);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
@@ -27,27 +26,23 @@ namespace Orchard.Core.Navigation.Drivers {
|
||||
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part))
|
||||
return null;
|
||||
|
||||
// TODO: andrerod convert to new shape API. Location code kept for reference.
|
||||
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart"); //.Location(part.GetLocation("Editor"));
|
||||
return ContentShape("Parts_Navigation_Menu_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Navigation.Menu.Edit", Model: part, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(MenuPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part)) {
|
||||
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part))
|
||||
return null;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(part.MenuPosition)) {
|
||||
if (string.IsNullOrEmpty(part.MenuPosition))
|
||||
part.MenuPosition = Position.GetNext(_navigationManager.BuildMenu("main"));
|
||||
}
|
||||
|
||||
updater.TryUpdateModel(part, Prefix, null, null);
|
||||
|
||||
if (part.OnMainMenu && string.IsNullOrEmpty(part.MenuText)) {
|
||||
if (part.OnMainMenu && string.IsNullOrEmpty(part.MenuText))
|
||||
updater.AddModelError("MenuText", T("The MenuText field is required"));
|
||||
}
|
||||
|
||||
// TODO: andrerod convert to new shape API. Location code kept for reference.
|
||||
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart"); //.Location(part.GetLocation("Editor"));
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
}
|
||||
}
|
3
src/Orchard.Web/Core/Navigation/Placement.info
Normal file
3
src/Orchard.Web/Core/Navigation/Placement.info
Normal file
@@ -0,0 +1,3 @@
|
||||
<Placement>
|
||||
<Place Parts_Navigation_Menu_Edit="Primary:9"/>
|
||||
</Placement>
|
@@ -1,6 +1,5 @@
|
||||
@model MenuPart
|
||||
@using Orchard.Core.Navigation.Models;
|
||||
@using Orchard.Core.Navigation.ViewModels;
|
||||
@{
|
||||
Script.Require("ShapesBase");
|
||||
}
|
@@ -341,7 +341,7 @@
|
||||
<Content Include="Dashboard\Views\Admin\Index.cshtml" />
|
||||
<Content Include="HomePage\Module.txt" />
|
||||
<Content Include="Navigation\Views\Admin\Index.cshtml" />
|
||||
<Content Include="Navigation\Views\EditorTemplates\Parts\Navigation.EditMenuPart.cshtml" />
|
||||
<Content Include="Navigation\Views\EditorTemplates\Parts\Navigation.Menu.Edit.cshtml" />
|
||||
<Content Include="Navigation\Views\Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -373,11 +373,13 @@
|
||||
<None Include="Contents\Placement.info" />
|
||||
<Content Include="Contents\Views\Content.ControlWrapper.cshtml" />
|
||||
<Content Include="Contents\Views\Item\Display.cshtml" />
|
||||
<None Include="Contents\Views\Items\Content.Edit.cshtml" />
|
||||
<None Include="Localization\Placement.info" />
|
||||
<Content Include="Messaging\Placement.info">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<None Include="Navigation\Placement.info">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="PublishLater\Placement.info">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
|
@@ -15,7 +15,7 @@ namespace Orchard.UI {
|
||||
var xParts = x.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var yParts = y.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
for (var i = 0; i < xParts.Count(); i++) {
|
||||
if (yParts.Length < i - 1) // x is further defined meaning it comes after y (e.g. x == 1.2.3 and y == 1.2)
|
||||
if (yParts.Length < i+1) // x is further defined meaning it comes after y (e.g. x == 1.2.3 and y == 1.2)
|
||||
return 1;
|
||||
|
||||
int xPos;
|
||||
|
Reference in New Issue
Block a user