mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
@@ -22,7 +22,7 @@
|
|||||||
<label for="menuId">@T("Current Menu:")</label>
|
<label for="menuId">@T("Current Menu:")</label>
|
||||||
<select id="menuId" name="menuId">
|
<select id="menuId" name="menuId">
|
||||||
@foreach (var menu in Model.Menus) {
|
@foreach (var menu in Model.Menus) {
|
||||||
@Html.SelectOption(Model.CurrentMenu.Id, menu.Id, Convert.ToString(Html.ItemDisplayText(menu)))
|
@Html.SelectOption(Model.CurrentMenu.Id, menu.Id, Convert.ToString(Html.ItemDisplayText(menu, false)))
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
@if (hasPermission) {
|
@if (hasPermission) {
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
@Html.LabelFor(m => m.CurrentMenuId, T("For Menu"))
|
@Html.LabelFor(m => m.CurrentMenuId, T("For Menu"))
|
||||||
<select id="@Html.FieldIdFor(m => m.CurrentMenuId)" name="@Html.FieldNameFor(m => m.CurrentMenuId)">
|
<select id="@Html.FieldIdFor(m => m.CurrentMenuId)" name="@Html.FieldNameFor(m => m.CurrentMenuId)">
|
||||||
@foreach(ContentItem menu in Model.Menus) {
|
@foreach(ContentItem menu in Model.Menus) {
|
||||||
@Html.SelectOption(Model.CurrentMenuId, menu.Id, Html.ItemDisplayText(menu).ToString())
|
@Html.SelectOption(Model.CurrentMenuId, menu.Id, Html.ItemDisplayText(menu, false).ToString())
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
<span class="hint">@T("Select which menu you want to display")</span>
|
<span class="hint">@T("Select which menu you want to display")</span>
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
<div data-controllerid="@Html.FieldIdFor(m => m.OnMenu)" class="">
|
<div data-controllerid="@Html.FieldIdFor(m => m.OnMenu)" class="">
|
||||||
<select id="@Html.FieldIdFor(m => m.CurrentMenuId)" name="@Html.FieldNameFor(m => m.CurrentMenuId)">
|
<select id="@Html.FieldIdFor(m => m.CurrentMenuId)" name="@Html.FieldNameFor(m => m.CurrentMenuId)">
|
||||||
@foreach (ContentItem menu in Model.Menus) {
|
@foreach (ContentItem menu in Model.Menus) {
|
||||||
@Html.SelectOption(Model.CurrentMenuId, menu.Id, Html.ItemDisplayText(menu).ToString())
|
@Html.SelectOption(Model.CurrentMenuId, menu.Id, Html.ItemDisplayText(menu, false).ToString())
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
<span class="hint">@T("Select which menu you want the content item to be displayed on.")</span>
|
<span class="hint">@T("Select which menu you want the content item to be displayed on.")</span>
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
<div data-controllerid="@Html.FieldIdFor(m => m.AddMenuItem)">
|
<div data-controllerid="@Html.FieldIdFor(m => m.AddMenuItem)">
|
||||||
<select id="@Html.FieldIdFor(m => m.CurrentMenuId)" name="@Html.FieldNameFor(m => m.CurrentMenuId)">
|
<select id="@Html.FieldIdFor(m => m.CurrentMenuId)" name="@Html.FieldNameFor(m => m.CurrentMenuId)">
|
||||||
@foreach (ContentItem menu in Model.Menus) {
|
@foreach (ContentItem menu in Model.Menus) {
|
||||||
@Html.SelectOption(Model.CurrentMenuId, menu.Id, Html.ItemDisplayText(menu).ToString())
|
@Html.SelectOption(Model.CurrentMenuId, menu.Id, Html.ItemDisplayText(menu, false).ToString())
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
<span class="hint">@T("Select which menu you want the content item to be added on.")</span>
|
<span class="hint">@T("Select which menu you want the content item to be added on.")</span>
|
||||||
|
@@ -7,11 +7,15 @@ using Orchard.Utility.Extensions;
|
|||||||
|
|
||||||
namespace Orchard.Mvc.Html {
|
namespace Orchard.Mvc.Html {
|
||||||
public static class ContentItemExtensions {
|
public static class ContentItemExtensions {
|
||||||
public static MvcHtmlString ItemDisplayText(this HtmlHelper html, IContent content) {
|
public static MvcHtmlString ItemDisplayText(this HtmlHelper html, IContent content, bool encode = true) {
|
||||||
var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
|
var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
|
||||||
if (metadata.DisplayText == null)
|
if (metadata.DisplayText == null)
|
||||||
return null;
|
return null;
|
||||||
return MvcHtmlString.Create(html.Encode(metadata.DisplayText));
|
if (encode) {
|
||||||
|
return MvcHtmlString.Create(html.Encode(metadata.DisplayText));
|
||||||
|
} else {
|
||||||
|
return MvcHtmlString.Create(metadata.DisplayText);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, IContent content) {
|
public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, IContent content) {
|
||||||
|
Reference in New Issue
Block a user