mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +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) {
|
protected override DriverResult Editor(MenuItemPart itemPart, IUpdateModel updater, dynamic shapeHelper) {
|
||||||
//todo: (heskew) need context
|
|
||||||
var currentUser = _workContextAccessor.GetContext().CurrentUser;
|
var currentUser = _workContextAccessor.GetContext().CurrentUser;
|
||||||
|
|
||||||
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, currentUser, itemPart))
|
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, currentUser, itemPart))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
updater.TryUpdateModel(itemPart, Prefix, null, null);
|
updater.TryUpdateModel(itemPart, Prefix, null, null);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using JetBrains.Annotations;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.ContentManagement.Drivers;
|
using Orchard.ContentManagement.Drivers;
|
||||||
using Orchard.Core.Navigation.Models;
|
using Orchard.Core.Navigation.Models;
|
||||||
@@ -27,27 +26,23 @@ namespace Orchard.Core.Navigation.Drivers {
|
|||||||
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part))
|
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// TODO: andrerod convert to new shape API. Location code kept for reference.
|
return ContentShape("Parts_Navigation_Menu_Edit",
|
||||||
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart"); //.Location(part.GetLocation("Editor"));
|
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Navigation.Menu.Edit", Model: part, Prefix: Prefix));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DriverResult Editor(MenuPart part, IUpdateModel updater, dynamic shapeHelper) {
|
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;
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(part.MenuPosition)) {
|
if (string.IsNullOrEmpty(part.MenuPosition))
|
||||||
part.MenuPosition = Position.GetNext(_navigationManager.BuildMenu("main"));
|
part.MenuPosition = Position.GetNext(_navigationManager.BuildMenu("main"));
|
||||||
}
|
|
||||||
|
|
||||||
updater.TryUpdateModel(part, Prefix, null, null);
|
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"));
|
updater.AddModelError("MenuText", T("The MenuText field is required"));
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: andrerod convert to new shape API. Location code kept for reference.
|
return Editor(part, shapeHelper);
|
||||||
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart"); //.Location(part.GetLocation("Editor"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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
|
@model MenuPart
|
||||||
@using Orchard.Core.Navigation.Models;
|
@using Orchard.Core.Navigation.Models;
|
||||||
@using Orchard.Core.Navigation.ViewModels;
|
|
||||||
@{
|
@{
|
||||||
Script.Require("ShapesBase");
|
Script.Require("ShapesBase");
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@
|
|||||||
<Content Include="Dashboard\Views\Admin\Index.cshtml" />
|
<Content Include="Dashboard\Views\Admin\Index.cshtml" />
|
||||||
<Content Include="HomePage\Module.txt" />
|
<Content Include="HomePage\Module.txt" />
|
||||||
<Content Include="Navigation\Views\Admin\Index.cshtml" />
|
<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" />
|
<Content Include="Navigation\Views\Web.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -373,11 +373,13 @@
|
|||||||
<None Include="Contents\Placement.info" />
|
<None Include="Contents\Placement.info" />
|
||||||
<Content Include="Contents\Views\Content.ControlWrapper.cshtml" />
|
<Content Include="Contents\Views\Content.ControlWrapper.cshtml" />
|
||||||
<Content Include="Contents\Views\Item\Display.cshtml" />
|
<Content Include="Contents\Views\Item\Display.cshtml" />
|
||||||
<None Include="Contents\Views\Items\Content.Edit.cshtml" />
|
|
||||||
<None Include="Localization\Placement.info" />
|
<None Include="Localization\Placement.info" />
|
||||||
<Content Include="Messaging\Placement.info">
|
<Content Include="Messaging\Placement.info">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
|
<None Include="Navigation\Placement.info">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
<None Include="PublishLater\Placement.info">
|
<None Include="PublishLater\Placement.info">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Orchard.UI {
|
|||||||
var xParts = x.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
|
var xParts = x.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
var yParts = y.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
|
var yParts = y.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
for (var i = 0; i < xParts.Count(); i++) {
|
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;
|
return 1;
|
||||||
|
|
||||||
int xPos;
|
int xPos;
|
||||||
|
|||||||
Reference in New Issue
Block a user