Files
Orchard/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/ContentPicker.Edit.cshtml
Sipke Schoorstra a88d68ee7a Added missing *Types* property to ContentPicker shape.
This fixes an issue where you could not configure the content picker shape to filter the available content items by types or types with certain parts.
2015-04-27 14:05:50 +02:00

66 lines
2.8 KiB
Plaintext

@using Orchard.ContentManagement
@using Orchard.Environment.Configuration
@{
Script.Require("ContentPicker").AtFoot();
Script.Require("jQueryUI_Sortable").AtFoot();
Style.Include("content-picker-admin.css");
var required = ((bool?)Model.Required) ?? false;
var multiple = ((bool?)Model.Multiple) ?? false;
var displayName = (string)Model.DisplayName ?? "";
var idsFieldId = (string)Model.IdsFieldId ?? "";
var selectedItemsFieldName = (string)Model.SelectedItemsFieldName ?? "";
var contentItems = (IEnumerable<ContentItem>)Model.ContentItems;
var hint = (string) Model.Hint;
var partName = Model.PartName;
var fieldName = Model.FieldName;
var baseUrl = Url.Content("~/") + WorkContext.Resolve<ShellSettings>().RequestUrlPrefix;
var types = String.Join(",", (IEnumerable<string>)Model.Types ?? Enumerable.Empty<string>());
}
<fieldset class="content-picker-field"
data-required="@required.ToString().ToLower()"
data-multiple="@multiple.ToString().ToLower()"
data-selected-items-fieldname="@selectedItemsFieldName"
data-base-url="@baseUrl"
data-part-name="@HttpUtility.JavaScriptStringEncode(partName)"
data-field-name="@HttpUtility.JavaScriptStringEncode(fieldName)"
data-remove-text="@T("Remove")"
data-not-published-text="@T("Not Published")"
data-types="@types">
@if (!String.IsNullOrWhiteSpace(displayName)) {
<label @if (required) { <text> class="required" </text> }>@displayName</label>
}
<div class="message message-Warning content-picker-message">@T("You need to save your changes.")</div>
<table class="items content-picker" summary="@displayName">
<colgroup>
<col id="Col1" style="width:20px" />
<col id="Col2" />
<col id="Col3" />
</colgroup>
<thead>
<tr>
<th scope="col">&nbsp;&darr;</th>
<th scope="col">@T("Content Item")</th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
<tbody>
@foreach (var contentItem in contentItems) {
<tr>
<td>&nbsp;</td>
<td>
<span data-id="@contentItem.Id" data-fieldid="@idsFieldId" class="content-picker-item">@Html.ItemEditLink(contentItem) @if (!contentItem.HasPublished()){<text> - </text>@T("Not Published")}</span>
</td>
<td>
<span data-id="@contentItem.Id" class="content-picker-remove button grey">@T("Remove")</span>
</td>
</tr>
}
</tbody>
</table>
<span class="button add">@T("Add")</span>
<input type="hidden" name="@selectedItemsFieldName" />
<span class="hint">@hint</span>
</fieldset>