mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Renaming ContainerCustomPart to CustomProperties
--HG-- branch : dev
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
@@ -86,7 +86,7 @@ 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.FilterByProperty = "CustomPropertiesPart.CustomOne";
|
||||
part.Record.FilterByOperator = "=";
|
||||
});
|
||||
}
|
||||
|
@@ -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 CustomPropertiesPartDriver : ContentPartDriver<CustomPropertiesPart> {
|
||||
protected override DriverResult Editor(CustomPropertiesPart part, dynamic shapeHelper) {
|
||||
return Editor(part, null, shapeHelper);
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(CustomPropertiesPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
return ContentShape(
|
||||
"Parts_CustomProperties_Edit",
|
||||
() => {
|
||||
if (updater != null)
|
||||
updater.TryUpdateModel(part, "CustomProperties", null, null);
|
||||
|
||||
return shapeHelper.EditorTemplate(TemplateName: "CustomProperties", Model: part, Prefix: "CustomProperties");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class CustomPropertiesPartHandler : ContentHandler {
|
||||
public CustomPropertiesPartHandler(IRepository<CustomPropertiesPartRecord> repository) {
|
||||
Filters.Add(StorageFilter.For(repository));
|
||||
}
|
||||
}
|
||||
}
|
@@ -21,20 +21,20 @@ namespace Orchard.Core.Containers.Extensions
|
||||
? query.OrderByDescending<RoutePartRecord, string>(record => record.Slug)
|
||||
: query.OrderBy<RoutePartRecord, string>(record => record.Slug);
|
||||
break;
|
||||
case "ContainerCustomPart.CustomOne":
|
||||
case "CustomPropertiesPart.CustomOne":
|
||||
query = descendingOrder
|
||||
? query.OrderByDescending<ContainerCustomPartRecord, string>(record => record.CustomOne)
|
||||
: query.OrderBy<ContainerCustomPartRecord, string>(record => record.CustomOne);
|
||||
? query.OrderByDescending<CustomPropertiesPartRecord, string>(record => record.CustomOne)
|
||||
: query.OrderBy<CustomPropertiesPartRecord, string>(record => record.CustomOne);
|
||||
break;
|
||||
case "ContainerCustomPart.CustomTwo":
|
||||
case "CustomPropertiesPart.CustomTwo":
|
||||
query = descendingOrder
|
||||
? query.OrderByDescending<ContainerCustomPartRecord, string>(record => record.CustomTwo)
|
||||
: query.OrderBy<ContainerCustomPartRecord, string>(record => record.CustomTwo);
|
||||
? query.OrderByDescending<CustomPropertiesPartRecord, string>(record => record.CustomTwo)
|
||||
: query.OrderBy<CustomPropertiesPartRecord, string>(record => record.CustomTwo);
|
||||
break;
|
||||
case "ContainerCustomPart.CustomThree":
|
||||
case "CustomPropertiesPart.CustomThree":
|
||||
query = descendingOrder
|
||||
? query.OrderByDescending<ContainerCustomPartRecord, string>(record => record.CustomThree)
|
||||
: query.OrderBy<ContainerCustomPartRecord, string>(record => record.CustomThree);
|
||||
? query.OrderByDescending<CustomPropertiesPartRecord, string>(record => record.CustomThree)
|
||||
: query.OrderBy<CustomPropertiesPartRecord, string>(record => record.CustomThree);
|
||||
break;
|
||||
default: // "CommonPart.PublishedUtc"
|
||||
query = descendingOrder
|
||||
@@ -69,18 +69,18 @@ namespace Orchard.Core.Containers.Extensions
|
||||
{"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)))},
|
||||
{"CustomPropertiesPart.CustomOne|<", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CustomPropertiesPartRecord>(r => true /* CompareTo is not implemented - r.CustomOne.CompareTo(s) == -1*/))},
|
||||
{"CustomPropertiesPart.CustomOne|>", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CustomPropertiesPartRecord>(r => true /* CompareTo is not implemented - r.CustomOne.CompareTo(s) == 1*/))},
|
||||
{"CustomPropertiesPart.CustomOne|=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CustomPropertiesPartRecord>(r => r.CustomOne.Equals(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"CustomPropertiesPart.CustomOne|^=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CustomPropertiesPartRecord>(r => r.CustomOne.StartsWith(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"CustomPropertiesPart.CustomTwo|<", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CustomPropertiesPartRecord>(r => true /* CompareTo is not implemented - r.CustomTwo.CompareTo(s) == -1*/))},
|
||||
{"CustomPropertiesPart.CustomTwo|>", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CustomPropertiesPartRecord>(r => true /* CompareTo is not implemented - r.CustomTwo.CompareTo(s) == 1*/))},
|
||||
{"CustomPropertiesPart.CustomTwo|=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CustomPropertiesPartRecord>(r => r.CustomTwo.Equals(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"CustomPropertiesPart.CustomTwo|^=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CustomPropertiesPartRecord>(r => r.CustomTwo.StartsWith(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"CustomPropertiesPart.CustomThree|<", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CustomPropertiesPartRecord>(r => true /* CompareTo is not implemented - r.CustomThree.CompareTo(s) == -1*/))},
|
||||
{"CustomPropertiesPart.CustomThree|>", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CustomPropertiesPartRecord>(r => true /* CompareTo is not implemented - r.CustomThree.CompareTo(s) == 1*/))},
|
||||
{"CustomPropertiesPart.CustomThree|=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CustomPropertiesPartRecord>(r => r.CustomThree.Equals(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"CustomPropertiesPart.CustomThree|^=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<CustomPropertiesPartRecord>(r => r.CustomThree.StartsWith(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
};
|
||||
}
|
||||
}
|
@@ -25,7 +25,7 @@ namespace Orchard.Core.Containers {
|
||||
.Column<string>("FilterByOperator")
|
||||
.Column<string>("FilterByValue"));
|
||||
|
||||
SchemaBuilder.CreateTable("ContainerCustomPartRecord",
|
||||
SchemaBuilder.CreateTable("CustomPropertiesPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("CustomOne")
|
||||
@@ -41,7 +41,7 @@ namespace Orchard.Core.Containers {
|
||||
|
||||
ContentDefinitionManager.AlterPartDefinition("ContainerPart", builder => builder.Attachable());
|
||||
ContentDefinitionManager.AlterPartDefinition("ContainablePart", builder => builder.Attachable());
|
||||
ContentDefinitionManager.AlterPartDefinition("ContainerCustomPart", builder => builder.Attachable());
|
||||
ContentDefinitionManager.AlterPartDefinition("CustomPropertiesPart", builder => builder.Attachable());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@@ -2,10 +2,10 @@
|
||||
using Orchard.ContentManagement.Records;
|
||||
|
||||
namespace Orchard.Core.Containers.Models {
|
||||
public class ContainerCustomPart : ContentPart<ContainerCustomPartRecord> {
|
||||
public class CustomPropertiesPart : ContentPart<CustomPropertiesPartRecord> {
|
||||
}
|
||||
|
||||
public class ContainerCustomPartRecord : ContentPartRecord {
|
||||
public class CustomPropertiesPartRecord : ContentPartRecord {
|
||||
public virtual string CustomOne { get; set; }
|
||||
public virtual string CustomTwo { get; set; }
|
||||
public virtual string CustomThree { get; set; }
|
@@ -7,7 +7,7 @@
|
||||
-->
|
||||
<Place Parts_Containable_Edit="Content:before.3"/>
|
||||
<Place Parts_Container_Edit="Content:5"/>
|
||||
<Place Parts_ContainerCustom_Edit="Content:5"/>
|
||||
<Place Parts_CustomProperties_Edit="Content:5"/>
|
||||
<Place Parts_ContainerWidget_Edit="Content:5"/>
|
||||
<Place Parts_Container_SiteSettings="Content:10"/>
|
||||
<Place Parts_ContainerWidget="Content"/>
|
||||
|
@@ -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.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)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "CustomPropertiesPart.CustomOne", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "CustomPropertiesPart.CustomTwo", T("Custom 2").Text)
|
||||
@Html.SelectOption(Model.Record.OrderByProperty, "CustomPropertiesPart.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)
|
||||
|
@@ -19,9 +19,9 @@
|
||||
@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)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CustomPropertiesPart.CustomOne", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CustomPropertiesPart.CustomTwo", T("Custom 2").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CustomPropertiesPart.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)
|
||||
@@ -39,9 +39,9 @@
|
||||
@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)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CustomPropertiesPart.CustomOne", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CustomPropertiesPart.CustomTwo", T("Custom 2").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CustomPropertiesPart.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)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
@model Orchard.Core.Containers.Models.ContainerCustomPart
|
||||
@model Orchard.Core.Containers.Models.CustomPropertiesPart
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.Record.CustomOne, T("Custom One"))
|
||||
@Html.EditorFor(m => m.Record.CustomOne)
|
@@ -71,7 +71,7 @@
|
||||
<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\Drivers\CustomPropertiesDriver.cs" />
|
||||
<Compile Include="Containers\Extensions\ContentQueryExtensions.cs" />
|
||||
<Compile Include="Containers\Migrations.cs" />
|
||||
<Compile Include="Containers\Models\ContainablePart.cs" />
|
||||
@@ -79,7 +79,7 @@
|
||||
<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\CustomPropertiesPart.cs" />
|
||||
<Compile Include="Containers\Models\OrderByDirection.cs" />
|
||||
<Compile Include="Containers\Routes.cs" />
|
||||
<Compile Include="Containers\Services\ContainersPathConstraintUpdater.cs" />
|
||||
@@ -366,7 +366,7 @@
|
||||
<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" />
|
||||
<Content Include="Containers\Views\EditorTemplates\CustomProperties.cshtml" />
|
||||
<Content Include="Routable\Views\Parts\RoutableTitle_Summary.cshtml" />
|
||||
<Content Include="Routable\Views\Parts\RoutableTitle_SummaryAdmin.cshtml" />
|
||||
</ItemGroup>
|
||||
|
Reference in New Issue
Block a user