mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-22 03:37:25 +08:00
Adding MenuItemLink alternates
--HG-- branch : 1.x
This commit is contained in:
@@ -8,5 +8,9 @@
|
||||
/// Used to determine if this content type supports draft versions
|
||||
/// </summary>
|
||||
public bool Draftable { get; set; }
|
||||
/// <summary>
|
||||
/// Defines the stereotype of the type
|
||||
/// </summary>
|
||||
public string Stereotype { get; set; }
|
||||
}
|
||||
}
|
@@ -60,6 +60,16 @@ namespace Orchard.Core.Navigation {
|
||||
.Column<bool>("OnAdminMenu")
|
||||
);
|
||||
|
||||
ContentDefinitionManager.AlterTypeDefinition("HtmlMenuItem", cfg => cfg
|
||||
.WithPart("MenuPart")
|
||||
.WithPart("BodyPart")
|
||||
.WithPart("CommonPart")
|
||||
.DisplayedAs("Html Menu Item")
|
||||
.WithSetting("Description", "Renders some custom HTML in the menu.")
|
||||
.WithSetting("BodyPartSettings.FlavorDefault", "html")
|
||||
.WithSetting("Stereotype", "MenuItem")
|
||||
);
|
||||
|
||||
ContentDefinitionManager.AlterPartDefinition("AdminMenuPart", builder => builder.Attachable());
|
||||
|
||||
return 3;
|
||||
@@ -112,6 +122,16 @@ namespace Orchard.Core.Navigation {
|
||||
.AlterTable("MenuPartRecord", table => table.AddColumn<int>("MenuRecord_id"))
|
||||
;
|
||||
|
||||
ContentDefinitionManager.AlterTypeDefinition("HtmlMenuItem", cfg => cfg
|
||||
.WithPart("MenuPart")
|
||||
.WithPart("BodyPart")
|
||||
.WithPart("CommonPart")
|
||||
.DisplayedAs("Html Menu Item")
|
||||
.WithSetting("Description", "Renders some custom HTML in the menu.")
|
||||
.WithSetting("BodyPartSettings.FlavorDefault", "html")
|
||||
.WithSetting("Stereotype", "MenuItem")
|
||||
);
|
||||
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
using System.Web;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Navigation;
|
||||
@@ -26,9 +24,9 @@ namespace Orchard.Core.Navigation.Services {
|
||||
var part = menuPart;
|
||||
|
||||
if (part.Is<MenuItemPart>())
|
||||
builder.Add(new LocalizedString(HttpUtility.HtmlEncode(part.MenuText)), part.MenuPosition, item => item.Url(part.As<MenuItemPart>().Url));
|
||||
builder.Add(new LocalizedString(HttpUtility.HtmlEncode(part.MenuText)), part.MenuPosition, item => item.Url(part.As<MenuItemPart>().Url).Content(part));
|
||||
else
|
||||
builder.Add(new LocalizedString(HttpUtility.HtmlEncode(part.MenuText)), part.MenuPosition, item => item.Action(_contentManager.GetItemMetadata(part.ContentItem).DisplayRouteValues));
|
||||
builder.Add(new LocalizedString(HttpUtility.HtmlEncode(part.MenuText)), part.MenuPosition, item => item.Action(_contentManager.GetItemMetadata(part.ContentItem).DisplayRouteValues).Content(part));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -107,7 +107,7 @@
|
||||
.menu-items-zone {
|
||||
background:#F3F4F5;
|
||||
border:1px solid #E4E5E6;
|
||||
padding:5px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
.menu-items-zone h2 {
|
||||
@@ -118,8 +118,9 @@
|
||||
.menu-items-zone li {
|
||||
background:#FFF;
|
||||
border:1px solid #EAEAEA;
|
||||
margin: 2px;
|
||||
padding: 5px;
|
||||
padding-right:60px;
|
||||
padding-right:65px;
|
||||
display: block;
|
||||
position:relative;
|
||||
}
|
||||
|
@@ -29,6 +29,8 @@ else {
|
||||
<label for="MenuText">@T("Menu text")</label>
|
||||
@Html.TextBoxFor(m => m.MenuText, new { @class = "textMedium", autofocus = "autofocus" })
|
||||
<span class="hint">@T("The text that should appear in the menu.")</span>
|
||||
@Html.HiddenFor(m => m.OnMenu, true)
|
||||
@Html.HiddenFor(m => m.CurrentMenuId, Request["menuId"])
|
||||
</fieldset>
|
||||
|
||||
}
|
@@ -0,0 +1 @@
|
||||
<span class="raw">@Html.Raw(Model.Content.BodyPart.Text)</span>
|
@@ -525,6 +525,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Shapes\Views\MenuItemLink.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Navigation\Views\MenuItemLink-HtmlMenuItem.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@@ -94,6 +94,18 @@ namespace Orchard.Core.Shapes {
|
||||
menuItem.Metadata.Alternates.Add("MenuItem__" + menu.MenuName);
|
||||
});
|
||||
|
||||
builder.Describe("MenuItemLink")
|
||||
.OnDisplaying(displaying => {
|
||||
var menuItem = displaying.Shape;
|
||||
var menu = menuItem.Menu;
|
||||
menuItem.Metadata.Alternates.Add("MenuItemLink__" + menu.MenuName);
|
||||
|
||||
string contentType = menuItem.Content.ContentItem.ContentType;
|
||||
if(contentType != null) {
|
||||
menuItem.Metadata.Alternates.Add("MenuItemLink__" + contentType);
|
||||
}
|
||||
});
|
||||
|
||||
builder.Describe("LocalMenu")
|
||||
.OnDisplaying(displaying => {
|
||||
var menu = displaying.Shape;
|
||||
|
Reference in New Issue
Block a user