mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Wrapping up the initial implementation of the Container Widget
--HG-- branch : dev
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Core.Containers.Models;
|
||||
using Orchard.Data;
|
||||
|
||||
namespace Orchard.Core.Containers.Drivers {
|
||||
public class ContainerCustomPartDriver : ContentPartDriver<ContainerCustomPart> {
|
||||
protected override DriverResult Editor(ContainerCustomPart part, dynamic shapeHelper) {
|
||||
return Editor(part, null, shapeHelper);
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ContainerCustomPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
return ContentShape(
|
||||
"Parts_ContainerCustom_Edit",
|
||||
() => {
|
||||
if (updater != null)
|
||||
updater.TryUpdateModel(part, "ContainerCustom", null, null);
|
||||
|
||||
return shapeHelper.EditorTemplate(TemplateName: "ContainerCustom", Model: part, Prefix: "ContainerCustom");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class ContainerCustomPartHandler : ContentHandler {
|
||||
public ContainerCustomPartHandler(IRepository<ContainerCustomPartRecord> repository) {
|
||||
Filters.Add(StorageFilter.For(repository));
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,7 +6,9 @@ using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Containers.Extensions;
|
||||
using Orchard.Core.Containers.Models;
|
||||
using Orchard.Core.Containers.ViewModels;
|
||||
using Orchard.Data;
|
||||
using Orchard.Localization;
|
||||
|
||||
@@ -21,6 +23,31 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override DriverResult Display(ContainerWidgetPart part, string displayType, dynamic shapeHelper) {
|
||||
return ContentShape(
|
||||
"Parts_ContainerWidget",
|
||||
() => {
|
||||
var container = _contentManager.Get(part.Record.ContainerId);
|
||||
|
||||
IContentQuery<ContentItem> query = _contentManager
|
||||
.Query(VersionOptions.Published)
|
||||
.Join<CommonPartRecord>().Where(cr => cr.Container.Id == container.Id);
|
||||
|
||||
var descendingOrder = part.Record.OrderByDirection == (int)OrderByDirection.Descending;
|
||||
query = query.OrderBy(part.Record.OrderByProperty, descendingOrder);
|
||||
|
||||
if (part.Record.ApplyFilter)
|
||||
query = query.Where(part.Record.FilterByProperty, part.Record.FilterByOperator, part.Record.FilterByValue);
|
||||
|
||||
var pageOfItems = query.Slice(0, part.Record.PageSize).ToList();
|
||||
|
||||
var list = shapeHelper.List();
|
||||
list.AddRange(pageOfItems.Select(item => _contentManager.BuildDisplay(item, "Summary")));
|
||||
|
||||
return shapeHelper.Parts_ContainerWidget(ContentItems: list);
|
||||
});
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ContainerWidgetPart part, dynamic shapeHelper) {
|
||||
return Editor(part, null, shapeHelper);
|
||||
}
|
||||
@@ -29,22 +56,24 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
return ContentShape(
|
||||
"Parts_ContainerWidget_Edit",
|
||||
() => {
|
||||
if (updater != null)
|
||||
updater.TryUpdateModel(part, "ContainerSelector", null, null);
|
||||
var model = new ContainerWidgetViewModel {Part = part};
|
||||
|
||||
if (updater != null) {
|
||||
updater.TryUpdateModel(model, "ContainerWidget", null, null);
|
||||
}
|
||||
|
||||
var containers = _contentManager.Query<ContainerPart, ContainerPartRecord>(VersionOptions.Latest).List();
|
||||
|
||||
var listItems = containers.Count() < 1
|
||||
? new[] {new SelectListItem {Text = T("(None - create container enabled items first)").Text, Value = "0"}}
|
||||
: containers.Select(x => new SelectListItem {
|
||||
Value = Convert.ToString(x.Id),
|
||||
Text = x.ContentItem.TypeDefinition.DisplayName + ": " + x.As<IRoutableAspect>().Title,
|
||||
Selected = x.Id == part.Record.ContainerId,
|
||||
Selected = x.Id == model.Part.Record.ContainerId,
|
||||
});
|
||||
|
||||
part.AvailableContainers = new SelectList(listItems, "Value", "Text", part.Record.ContainerId);
|
||||
model.AvailableContainers = new SelectList(listItems, "Value", "Text", model.Part.Record.ContainerId);
|
||||
|
||||
return shapeHelper.EditorTemplate(TemplateName: "ContainerWidget", Model: part, Prefix: "ContainerWidget");
|
||||
return shapeHelper.EditorTemplate(TemplateName: "ContainerWidget", Model: model, Prefix: "ContainerWidget");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -57,6 +86,8 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
part.Record.PageSize = 5;
|
||||
part.Record.OrderByProperty = part.Is<CommonPart>() ? "CommonPart.PublishedUtc" : "";
|
||||
part.Record.OrderByDirection = (int)OrderByDirection.Descending;
|
||||
part.Record.FilterByProperty = "ContainerCustomPart.CustomOne";
|
||||
part.Record.FilterByOperator = "=";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Containers.Models;
|
||||
using Orchard.Core.Routable.Models;
|
||||
|
||||
namespace Orchard.Core.Containers.Extensions
|
||||
{
|
||||
public static class ContentQueryExtensions {
|
||||
public static IContentQuery<T> OrderBy<T>(this IContentQuery<T> query, string partAndProperty, bool descendingOrder) where T : IContent {
|
||||
//todo: (heskew) order by custom part properties
|
||||
switch (partAndProperty) {
|
||||
case "RoutePart.Title":
|
||||
query = descendingOrder
|
||||
? query.OrderByDescending<RoutePartRecord, string>(record => record.Title)
|
||||
: query.OrderBy<RoutePartRecord, string>(record => record.Title);
|
||||
break;
|
||||
case "RoutePart.Slug":
|
||||
query = descendingOrder
|
||||
? query.OrderByDescending<RoutePartRecord, string>(record => record.Slug)
|
||||
: query.OrderBy<RoutePartRecord, string>(record => record.Slug);
|
||||
break;
|
||||
case "ContainerCustomPart.CustomOne":
|
||||
query = descendingOrder
|
||||
? query.OrderByDescending<ContainerCustomPartRecord, string>(record => record.CustomOne)
|
||||
: query.OrderBy<ContainerCustomPartRecord, string>(record => record.CustomOne);
|
||||
break;
|
||||
case "ContainerCustomPart.CustomTwo":
|
||||
query = descendingOrder
|
||||
? query.OrderByDescending<ContainerCustomPartRecord, string>(record => record.CustomTwo)
|
||||
: query.OrderBy<ContainerCustomPartRecord, string>(record => record.CustomTwo);
|
||||
break;
|
||||
case "ContainerCustomPart.CustomThree":
|
||||
query = descendingOrder
|
||||
? query.OrderByDescending<ContainerCustomPartRecord, string>(record => record.CustomThree)
|
||||
: query.OrderBy<ContainerCustomPartRecord, string>(record => record.CustomThree);
|
||||
break;
|
||||
default: // "CommonPart.PublishedUtc"
|
||||
query = descendingOrder
|
||||
? query.OrderByDescending<CommonPartRecord, DateTime?>(record => record.PublishedUtc)
|
||||
: query.OrderBy<CommonPartRecord, DateTime?>(record => record.PublishedUtc);
|
||||
break;
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
public static IContentQuery<ContentItem> Where(this IContentQuery<ContentItem> query, string partAndProperty, string comparisonOperator, string comparisonValue) {
|
||||
var filterKey = string.Format("{0}|{1}", partAndProperty, comparisonOperator);
|
||||
if (!_filters.ContainsKey(filterKey))
|
||||
return query;
|
||||
|
||||
return _filters[filterKey](query, comparisonValue);
|
||||
}
|
||||
|
||||
// convoluted: yes; quick and works for now: yes; technical debt: not much
|
||||
private static readonly Dictionary<string, Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>> _filters = new Dictionary<string, Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>> {
|
||||
{"RoutePart.Title|<", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<RoutePartRecord>(r => true /* CompareTo is not implemented - r.Title.CompareTo(s) == -1*/))},
|
||||
{"RoutePart.Title|>", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<RoutePartRecord>(r => true /* CompareTo is not implemented - r.Title.CompareTo(s) == 1*/))},
|
||||
{"RoutePart.Title|=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<RoutePartRecord>(r => r.Title.Equals(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"RoutePart.Title|^=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<RoutePartRecord>(r => r.Title.StartsWith(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"RoutePart.Slug|<", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<RoutePartRecord>(r => true /* CompareTo is not implemented - r.Slug.CompareTo(s) == -1*/))},
|
||||
{"RoutePart.Slug|>", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<RoutePartRecord>(r => true /* CompareTo is not implemented - r.Slug.CompareTo(s) == 1*/))},
|
||||
{"RoutePart.Slug|=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<RoutePartRecord>(r => r.Slug.Equals(s.Trim(), StringComparison.OrdinalIgnoreCase)))},
|
||||
{"RoutePart.Slug|^=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<RoutePartRecord>(r => r.Slug.StartsWith(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"CommonPart.PublishedUtc|<", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CommonPartRecord>(r => r.PublishedUtc < DateTime.Parse(s)))},
|
||||
{"CommonPart.PublishedUtc|>", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CommonPartRecord>(r => r.PublishedUtc > DateTime.Parse(s)))},
|
||||
{"CommonPart.PublishedUtc|=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CommonPartRecord>(r => r.PublishedUtc == DateTime.Parse(s)))}, // todo: (heskew) not practical as is. needs some sense of precision....
|
||||
{"CommonPart.PublishedUtc|^=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CommonPartRecord>(r => true /* can't modified PublishedUtc for partial comparisons */))},
|
||||
// todo: (hesekw) this could benefit from a better filter implementation as this is currently very limited in functionality and I have no idea how the custom parts will be used by folks
|
||||
{"ContainerCustomPart.CustomOne|<", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<ContainerCustomPartRecord>(r => true /* CompareTo is not implemented - r.CustomOne.CompareTo(s) == -1*/))},
|
||||
{"ContainerCustomPart.CustomOne|>", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<ContainerCustomPartRecord>(r => true /* CompareTo is not implemented - r.CustomOne.CompareTo(s) == 1*/))},
|
||||
{"ContainerCustomPart.CustomOne|=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<ContainerCustomPartRecord>(r => r.CustomOne.Equals(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"ContainerCustomPart.CustomOne|^=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<ContainerCustomPartRecord>(r => r.CustomOne.StartsWith(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"ContainerCustomPart.CustomTwo|<", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<ContainerCustomPartRecord>(r => true /* CompareTo is not implemented - r.CustomTwo.CompareTo(s) == -1*/))},
|
||||
{"ContainerCustomPart.CustomTwo|>", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<ContainerCustomPartRecord>(r => true /* CompareTo is not implemented - r.CustomTwo.CompareTo(s) == 1*/))},
|
||||
{"ContainerCustomPart.CustomTwo|=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<ContainerCustomPartRecord>(r => r.CustomTwo.Equals(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"ContainerCustomPart.CustomTwo|^=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<ContainerCustomPartRecord>(r => r.CustomTwo.StartsWith(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"ContainerCustomPart.CustomThree|<", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<ContainerCustomPartRecord>(r => true /* CompareTo is not implemented - r.CustomThree.CompareTo(s) == -1*/))},
|
||||
{"ContainerCustomPart.CustomThree|>", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<ContainerCustomPartRecord>(r => true /* CompareTo is not implemented - r.CustomThree.CompareTo(s) == 1*/))},
|
||||
{"ContainerCustomPart.CustomThree|=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<ContainerCustomPartRecord>(r => r.CustomThree.Equals(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"ContainerCustomPart.CustomThree|^=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<ContainerCustomPartRecord>(r => r.CustomThree.StartsWith(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
};
|
||||
}
|
||||
}
|
@@ -13,6 +13,25 @@ namespace Orchard.Core.Containers {
|
||||
.Column<string>("OrderByProperty")
|
||||
.Column<int>("OrderByDirection"));
|
||||
|
||||
SchemaBuilder.CreateTable("ContainerWidgetPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<int>("ContainerId")
|
||||
.Column<int>("PageSize")
|
||||
.Column<string>("OrderByProperty")
|
||||
.Column<int>("OrderByDirection")
|
||||
.Column<bool>("ApplyFilter")
|
||||
.Column<string>("FilterByProperty")
|
||||
.Column<string>("FilterByOperator")
|
||||
.Column<string>("FilterByValue"));
|
||||
|
||||
SchemaBuilder.CreateTable("ContainerCustomPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("CustomOne")
|
||||
.Column<string>("CustomTwo")
|
||||
.Column<string>("CustomThree"));
|
||||
|
||||
ContentDefinitionManager.AlterTypeDefinition("ContainerWidget",
|
||||
cfg => cfg
|
||||
.WithPart("CommonPart")
|
||||
@@ -22,9 +41,9 @@ namespace Orchard.Core.Containers {
|
||||
|
||||
ContentDefinitionManager.AlterPartDefinition("ContainerPart", builder => builder.Attachable());
|
||||
ContentDefinitionManager.AlterPartDefinition("ContainablePart", builder => builder.Attachable());
|
||||
ContentDefinitionManager.AlterPartDefinition("ContainerCustomPart", builder => builder.Attachable());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Records;
|
||||
|
||||
namespace Orchard.Core.Containers.Models {
|
||||
public class ContainerCustomPart : ContentPart<ContainerCustomPartRecord> {
|
||||
}
|
||||
|
||||
public class ContainerCustomPartRecord : ContentPartRecord {
|
||||
public virtual string CustomOne { get; set; }
|
||||
public virtual string CustomTwo { get; set; }
|
||||
public virtual string CustomThree { get; set; }
|
||||
}
|
||||
}
|
@@ -1,10 +1,8 @@
|
||||
using System.Web.Mvc;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Records;
|
||||
|
||||
namespace Orchard.Core.Containers.Models {
|
||||
public class ContainerWidgetPart : ContentPart<ContainerWidgetPartRecord> {
|
||||
public SelectList AvailableContainers { get; set; }
|
||||
}
|
||||
|
||||
public class ContainerWidgetPartRecord : ContentPartRecord {
|
||||
@@ -12,5 +10,9 @@ namespace Orchard.Core.Containers.Models {
|
||||
public virtual int PageSize { get; set; }
|
||||
public virtual string OrderByProperty { get; set; }
|
||||
public virtual int OrderByDirection { get; set; }
|
||||
public virtual bool ApplyFilter { get; set; }
|
||||
public virtual string FilterByProperty { get; set; }
|
||||
public virtual string FilterByOperator { get; set; }
|
||||
public virtual string FilterByValue { get; set; }
|
||||
}
|
||||
}
|
@@ -1,6 +1,8 @@
|
||||
<Placement>
|
||||
<Place Parts_Containable_Edit="Content:before.3"/>
|
||||
<Place Parts_Container_Edit="Content:5"/>
|
||||
<Place Parts_ContainerCustom_Edit="Content:5"/>
|
||||
<Place Parts_ContainerWidget_Edit="Content:5"/>
|
||||
<Place Parts_Container_SiteSettings="Content:10"/>
|
||||
<Place Parts_ContainerWidget="Content"/>
|
||||
</Placement>
|
||||
|
@@ -0,0 +1,10 @@
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Core.Containers.Models;
|
||||
|
||||
namespace Orchard.Core.Containers.ViewModels {
|
||||
public class ContainerWidgetViewModel {
|
||||
public bool UseFilter { get; set; }
|
||||
public SelectList AvailableContainers { get; set; }
|
||||
public ContainerWidgetPart Part { get; set; }
|
||||
}
|
||||
}
|
@@ -6,9 +6,9 @@
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "CommonPart.PublishedUtc", T("Date Published").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "RoutePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "RoutePart.Slug", T("Slug").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "ContainerCustomPart.Custom1", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "ContainerCustomPart.Custom2", T("Custom 2").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "ContainerCustomPart.Custom3", T("Custom 3").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "ContainerCustomPart.CustomOne", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "ContainerCustomPart.CustomTwo", T("Custom 2").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "ContainerCustomPart.CustomThree", T("Custom 3").Text)
|
||||
</select>
|
||||
<select id="@Html.FieldIdFor(m => m.Record.OrderByDirection)" name="@Html.FieldNameFor(m => m.Record.OrderByDirection)">
|
||||
@Html.SelectOption(Model.Record.OrderByDirection, (int)OrderByDirection.Ascending, T("Ascending").Text)
|
||||
|
@@ -0,0 +1,13 @@
|
||||
@model Orchard.Core.Containers.Models.ContainerCustomPart
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.Record.CustomOne, T("Custom One"))
|
||||
@Html.EditorFor(m => m.Record.CustomOne)
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.Record.CustomTwo, T("Custom Two"))
|
||||
@Html.EditorFor(m => m.Record.CustomTwo)
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.Record.CustomThree, T("Custom Three"))
|
||||
@Html.EditorFor(m => m.Record.CustomThree)
|
||||
</fieldset>
|
@@ -1,27 +1,56 @@
|
||||
@model Orchard.Core.Containers.Models.ContainerWidgetPart
|
||||
@model Orchard.Core.Containers.ViewModels.ContainerWidgetViewModel
|
||||
@using Orchard.Core.Containers.Models;
|
||||
@{
|
||||
Script.Require("ShapesBase");
|
||||
}
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.Record.ContainerId, T("Show items from"))
|
||||
@Html.DropDownListFor(m => m.Record.ContainerId, Model.AvailableContainers)
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.Record.OrderByProperty, T("Order by"))
|
||||
<select id="@Html.FieldIdFor(m => m.Record.OrderByProperty)" name="@Html.FieldNameFor(m => m.Record.OrderByProperty)">
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "CommonPart.PublishedUtc", T("Date Published").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "RoutePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "RoutePart.Slug", T("Slug").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "ContainerCustomPart.Custom1", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "ContainerCustomPart.Custom2", T("Custom 2").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "ContainerCustomPart.Custom3", T("Custom 3").Text)
|
||||
</select>
|
||||
<select id="@Html.FieldIdFor(m => m.Record.OrderByDirection)" name="@Html.FieldNameFor(m => m.Record.OrderByDirection)">
|
||||
@Html.SelectOption(Model.Record.OrderByDirection, (int)OrderByDirection.Ascending, T("Ascending").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByDirection, (int)OrderByDirection.Descending, T("Descending").Text)
|
||||
</select>
|
||||
@Html.LabelFor(m => m.Part.Record.ContainerId, T("Show items from"))
|
||||
@Html.DropDownListFor(m => m.Part.Record.ContainerId, Model.AvailableContainers)
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<span>
|
||||
@Html.LabelFor(m => m.Record.PageSize, T("Maximum number of items to display"))
|
||||
@Html.TextBoxFor(m => m.Record.PageSize, new { @class = "text text-small" })
|
||||
@Html.LabelFor(m => m.Part.Record.PageSize, T("Maximum number of items to display"))
|
||||
@Html.TextBoxFor(m => m.Part.Record.PageSize, new { @class = "text text-small" })
|
||||
</span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.Part.Record.OrderByProperty, T("Order by"))
|
||||
<select id="@Html.FieldIdFor(m => m.Part.Record.OrderByProperty)" name="@Html.FieldNameFor(m => m.Part.Record.OrderByProperty)">
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CommonPart.PublishedUtc", T("Date Published").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "RoutePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "RoutePart.Slug", T("Slug").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "ContainerCustomPart.CustomOne", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "ContainerCustomPart.CustomTwo", T("Custom 2").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "ContainerCustomPart.CustomThree", T("Custom 3").Text)
|
||||
</select>
|
||||
<select title="@T("Order direction")" id="@Html.FieldIdFor(m => m.Part.Record.OrderByDirection)" name="@Html.FieldNameFor(m => m.Part.Record.OrderByDirection)">
|
||||
@Html.SelectOption(Model.Part.Record.OrderByDirection, (int)OrderByDirection.Ascending, T("Ascending").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByDirection, (int)OrderByDirection.Descending, T("Descending").Text)
|
||||
</select>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div>
|
||||
@Html.EditorFor(m => m.Part.Record.ApplyFilter)
|
||||
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.Part.Record.ApplyFilter)">@T("Filter items")</label>
|
||||
</div>
|
||||
<div data-controllerid="@Html.FieldIdFor(m => m.Part.Record.ApplyFilter)">
|
||||
@Html.LabelFor(m => m.Part.Record.FilterByProperty, T("Filter where"))
|
||||
<select id="@Html.FieldIdFor(m => m.Part.Record.FilterByProperty)" name="@Html.FieldNameFor(m => m.Part.Record.FilterByProperty)">
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CommonPart.PublishedUtc", T("Date Published").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "RoutePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "RoutePart.Slug", T("Slug").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "ContainerCustomPart.CustomOne", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "ContainerCustomPart.CustomTwo", T("Custom 2").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "ContainerCustomPart.CustomThree", T("Custom 3").Text)
|
||||
</select>
|
||||
<select title="@T("Filter operator")" id="@Html.FieldIdFor(m => m.Part.Record.FilterByOperator)" name="@Html.FieldNameFor(m => m.Part.Record.FilterByOperator)">
|
||||
@Html.SelectOption(Model.Part.Record.FilterByOperator, "=", T("is equal to").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByOperator, "<", T("is less than").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByOperator, ">", T("is greater than").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByOperator, "^=", T("starts with").Text)
|
||||
</select>
|
||||
<span>
|
||||
@Html.TextBoxFor(m => m.Part.Record.FilterByValue, new { @class = "text", title = T("Filter value") })
|
||||
</span>
|
||||
</div>
|
||||
</fieldset>
|
@@ -0,0 +1 @@
|
||||
@Display(Model.ContentItems)
|
@@ -79,17 +79,21 @@
|
||||
<Compile Include="Common\Drivers\TextFieldDriver.cs" />
|
||||
<Compile Include="Containers\ContainersPathConstraint.cs" />
|
||||
<Compile Include="Containers\Drivers\ContainerWidgetPartDriver.cs" />
|
||||
<Compile Include="Containers\Drivers\ContainerCustomPartDriver.cs" />
|
||||
<Compile Include="Containers\Extensions\ContentQueryExtensions.cs" />
|
||||
<Compile Include="Containers\Migrations.cs" />
|
||||
<Compile Include="Containers\Models\ContainablePart.cs" />
|
||||
<Compile Include="Containers\Models\ContainerPart.cs" />
|
||||
<Compile Include="Common\Shapes.cs" />
|
||||
<Compile Include="Common\Fields\TextField.cs" />
|
||||
<Compile Include="Containers\Models\ContainerWidgetPart.cs" />
|
||||
<Compile Include="Containers\Models\ContainerCustomPart.cs" />
|
||||
<Compile Include="Containers\Models\OrderByDirection.cs" />
|
||||
<Compile Include="Containers\Routes.cs" />
|
||||
<Compile Include="Containers\Services\ContainersPathConstraintUpdater.cs" />
|
||||
<Compile Include="Containers\Settings\ContainerSettings.cs" />
|
||||
<Compile Include="Containers\ViewModels\ContainableViewModel.cs" />
|
||||
<Compile Include="Containers\ViewModels\ContainerWidgetViewModel.cs" />
|
||||
<Compile Include="Contents\Security\AuthorizationEventHandler.cs" />
|
||||
<Compile Include="Common\Services\BbcodeFilter.cs" />
|
||||
<Compile Include="Common\Services\ICommonService.cs" />
|
||||
@@ -406,6 +410,8 @@
|
||||
<Content Include="Containers\Views\DefinitionTemplates\ContainerPartSettings.cshtml" />
|
||||
<Content Include="Containers\Views\DefinitionTemplates\ContainerTypePartSettings.cshtml" />
|
||||
<Content Include="Containers\Views\EditorTemplates\Containable.cshtml" />
|
||||
<Content Include="Containers\Views\Parts\ContainerWidget.cshtml" />
|
||||
<Content Include="Containers\Views\EditorTemplates\ContainerCustom.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
@@ -4,7 +4,6 @@
|
||||
@Display(Model)
|
||||
|
||||
<fieldset>
|
||||
<input type="submit" />
|
||||
<button type="submit" name="submit.Delete" value="@T("Delete")">@T("Delete")</button>
|
||||
</fieldset>
|
||||
}
|
@@ -1,21 +1,17 @@
|
||||
@model Orchard.Widgets.Models.WidgetPart
|
||||
|
||||
<fieldset>
|
||||
@Html.LabelFor(widget => widget.Zone, T("Zone"))
|
||||
@Html.DropDownListFor(widget => widget.Zone, new SelectList(Model.AvailableZones))
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
@Html.LabelFor(widget => widget.LayerId, T("Layer"))
|
||||
@Html.DropDownListFor(widget => widget.LayerId, new SelectList(Model.AvailableLayers, "Id", "Name"))
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
@Html.LabelFor(widget => widget.Title, T("Title"))
|
||||
@Html.TextBoxFor(widget => widget.Title)
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
@Html.LabelFor(widget => widget.Position, T("Position"))
|
||||
@Html.TextBoxFor(widget => widget.Position)
|
||||
@Html.TextBoxFor(widget => widget.Position, new { @class = "text text-small"})
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(widget => widget.Title, T("Title"))
|
||||
@Html.EditorFor(widget => widget.Title)
|
||||
</fieldset>
|
Reference in New Issue
Block a user