mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixing #5281
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
<label for="menuId">@T("Current Menu:")</label>
|
||||
<select id="menuId" name="menuId">
|
||||
@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>
|
||||
@if (hasPermission) {
|
||||
|
@@ -6,7 +6,7 @@
|
||||
@Html.LabelFor(m => m.CurrentMenuId, T("For Menu"))
|
||||
<select id="@Html.FieldIdFor(m => m.CurrentMenuId)" name="@Html.FieldNameFor(m => m.CurrentMenuId)">
|
||||
@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>
|
||||
<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="">
|
||||
<select id="@Html.FieldIdFor(m => m.CurrentMenuId)" name="@Html.FieldNameFor(m => m.CurrentMenuId)">
|
||||
@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>
|
||||
<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)">
|
||||
<select id="@Html.FieldIdFor(m => m.CurrentMenuId)" name="@Html.FieldNameFor(m => m.CurrentMenuId)">
|
||||
@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>
|
||||
<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 {
|
||||
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);
|
||||
if (metadata.DisplayText == 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) {
|
||||
|
Reference in New Issue
Block a user