diff --git a/src/Orchard.Web/Core/Common/Drivers/BodyPartDriver.cs b/src/Orchard.Web/Core/Common/Drivers/BodyPartDriver.cs index 4f52efb0a..fd0726094 100644 --- a/src/Orchard.Web/Core/Common/Drivers/BodyPartDriver.cs +++ b/src/Orchard.Web/Core/Common/Drivers/BodyPartDriver.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Web; using JetBrains.Annotations; @@ -9,7 +8,6 @@ using Orchard.ContentManagement.Drivers; using Orchard.Core.Common.Models; using Orchard.Core.Common.Settings; using Orchard.Core.Common.ViewModels; -using Orchard.Core.ContentsLocation.Models; using Orchard.Core.Routable.Models; using Orchard.Services; @@ -49,10 +47,6 @@ namespace Orchard.Core.Common.Drivers { ); } - private string IfThen(bool predicate, string value) { - return predicate ? value : null; - } - protected override DriverResult Editor(BodyPart part, dynamic shapeHelper) { var model = BuildEditorViewModel(part); return ContentShape("Parts_Common_Body_Edit", diff --git a/src/Orchard.Web/Core/Common/Drivers/CommonPartDriver.cs b/src/Orchard.Web/Core/Common/Drivers/CommonPartDriver.cs index ceb9377e9..cf735b2bd 100644 --- a/src/Orchard.Web/Core/Common/Drivers/CommonPartDriver.cs +++ b/src/Orchard.Web/Core/Common/Drivers/CommonPartDriver.cs @@ -2,7 +2,6 @@ using Orchard.ContentManagement.Drivers; using Orchard.Core.Common.Models; using Orchard.Core.Common.ViewModels; -using Orchard.Core.ContentsLocation.Models; using Orchard.Localization; using Orchard.Security; using Orchard.Services; @@ -48,8 +47,8 @@ namespace Orchard.Core.Common.Drivers { protected override DriverResult Editor(CommonPart part, dynamic shapeHelper) { return Combined( - OwnerEditor(part, null), - ContainerEditor(part, null)); + OwnerEditor(part, null, shapeHelper), + ContainerEditor(part, null, shapeHelper)); } protected override DriverResult Editor(CommonPart instance, IUpdateModel updater, dynamic shapeHelper) { @@ -58,11 +57,11 @@ namespace Orchard.Core.Common.Drivers { instance.VersionModifiedUtc = _clock.UtcNow; return Combined( - OwnerEditor(instance, updater), - ContainerEditor(instance, updater)); + OwnerEditor(instance, updater, shapeHelper), + ContainerEditor(instance, updater, shapeHelper)); } - DriverResult OwnerEditor(CommonPart part, IUpdateModel updater) { + DriverResult OwnerEditor(CommonPart part, IUpdateModel updater, dynamic shapeHelper) { var currentUser = _authenticationService.GetAuthenticatedUser(); if (!_authorizationService.TryCheckAccess(Permissions.ChangeOwner, currentUser, part)) { return null; @@ -87,10 +86,11 @@ namespace Orchard.Core.Common.Drivers { } } - return ContentPartTemplate(model, "Parts/Common.Owner", TemplatePrefix).Location(part.GetLocation("Editor")); + return ContentShape("Parts_Common_Owner_Edit", + () => shapeHelper.EditorTemplate(TemplateName: "Parts/Common.Owner", Model: model, Prefix: Prefix)); } - DriverResult ContainerEditor(CommonPart part, IUpdateModel updater) { + DriverResult ContainerEditor(CommonPart part, IUpdateModel updater, dynamic shapeHelper) { var currentUser = _authenticationService.GetAuthenticatedUser(); if (!_authorizationService.TryCheckAccess(Permissions.ChangeOwner, currentUser, part)) { return null; @@ -115,7 +115,8 @@ namespace Orchard.Core.Common.Drivers { } } - return ContentPartTemplate(model, "Parts/Common.Container", TemplatePrefix).Location(part.GetLocation("Editor")); + return ContentShape("Parts_Common_Container_Edit", + () => shapeHelper.EditorTemplate(TemplateName: "Parts/Common.Container", Model: model, Prefix: Prefix)); } } } \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs b/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs index 128379d55..d697728f5 100644 --- a/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs +++ b/src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs @@ -2,39 +2,32 @@ using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; using Orchard.Core.Common.Fields; -using Orchard.Core.ContentsLocation.Models; namespace Orchard.Core.Common.Drivers { [UsedImplicitly] public class TextFieldDriver : ContentFieldDriver { - public IOrchardServices Services { get; set; } - private const string TemplateName = "Fields/Common.TextField"; - public TextFieldDriver(IOrchardServices services) { Services = services; } + public IOrchardServices Services { get; set; } + private static string GetPrefix(TextField field, ContentPart part) { return part.PartDefinition.Name + "." + field.Name; } - protected override DriverResult Display(ContentPart part, TextField field, string displayType) { - var location = field.GetLocation(displayType, "Primary", "1"); - - return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part)) - .Location(location); + protected override DriverResult Display(ContentPart part, TextField field, string displayType, dynamic shapeHelper) { + return ContentShape("Fields_Common_Text", () => shapeHelper.Fields_Common_Text(ContentField: field, Name: field.Name, Value: field.Value)); } - protected override DriverResult Editor(ContentPart part, TextField field) { - var location = field.GetLocation("Editor", "Primary", "1"); - - return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part)) - .Location(location); + protected override DriverResult Editor(ContentPart part, TextField field, dynamic shapeHelper) { + return ContentShape("Fields_Common_Text_Edit", + () => shapeHelper.EditorTemplate(TemplateName: "Fields/Common.Text.Edit", Model: field, Prefix: GetPrefix(field, part))); } - protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater) { + protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater, dynamic shapeHelper) { updater.TryUpdateModel(field, GetPrefix(field, part), null, null); - return Editor(part, field); + return Editor(part, field, shapeHelper); } } -} +} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Extensions/HtmlHelperExtensions.cs b/src/Orchard.Web/Core/Common/Extensions/HtmlHelperExtensions.cs index 4deaccb9f..3961b92a3 100644 --- a/src/Orchard.Web/Core/Common/Extensions/HtmlHelperExtensions.cs +++ b/src/Orchard.Web/Core/Common/Extensions/HtmlHelperExtensions.cs @@ -1,23 +1,13 @@ using System; using System.Web.Mvc; -using Orchard.Core.Common.ViewModels; using Orchard.Localization; using Orchard.Mvc.Html; namespace Orchard.Core.Common.Extensions { public static class HtmlHelperExtensions { - public static LocalizedString PublishedStateForModel(this HtmlHelper htmlHelper, Localizer T) { - return htmlHelper.PublishedState(htmlHelper.ViewData.Model, T); + public static LocalizedString PublishedState(this HtmlHelper htmlHelper, DateTime? versionPublishedUtc, Localizer T) { + return htmlHelper.DateTime(versionPublishedUtc, T("Draft")); } - - public static LocalizedString PublishedState(this HtmlHelper htmlHelper, CommonMetadataViewModel metadata, Localizer T) { - return htmlHelper.DateTime(metadata.VersionPublishedUtc, T("Draft")); - } - - public static LocalizedString PublishedWhenForModel(this HtmlHelper htmlHelper, Localizer T) { - return htmlHelper.PublishedWhen(htmlHelper.ViewData.Model.VersionPublishedUtc, T); - } - public static LocalizedString PublishedWhen(this HtmlHelper htmlHelper, DateTime? versionPublishedUtc, Localizer T) { return htmlHelper.DateTimeRelative(versionPublishedUtc, T("as a Draft"), T); } diff --git a/src/Orchard.Web/Core/Common/Placement.info b/src/Orchard.Web/Core/Common/Placement.info index 08f8a7883..c9796ff46 100644 --- a/src/Orchard.Web/Core/Common/Placement.info +++ b/src/Orchard.Web/Core/Common/Placement.info @@ -1,15 +1,32 @@  - - - + + + + + + + + + + + + + diff --git a/src/Orchard.Web/Core/Common/ViewModels/BodyDisplayViewModel.cs b/src/Orchard.Web/Core/Common/ViewModels/BodyDisplayViewModel.cs deleted file mode 100644 index 12c8162aa..000000000 --- a/src/Orchard.Web/Core/Common/ViewModels/BodyDisplayViewModel.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Web; -using Orchard.Core.Common.Models; - -namespace Orchard.Core.Common.ViewModels { - public class BodyDisplayViewModel { - public BodyPart BodyPart { get; set; } - public IHtmlString Html { get; set; } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/ViewModels/CommonMetadataViewModel.cs b/src/Orchard.Web/Core/Common/ViewModels/CommonMetadataViewModel.cs deleted file mode 100644 index 9af444559..000000000 --- a/src/Orchard.Web/Core/Common/ViewModels/CommonMetadataViewModel.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using Orchard.Core.Common.Models; -using Orchard.Security; - -namespace Orchard.Core.Common.ViewModels { - public class CommonMetadataViewModel { - private readonly CommonPart _commonPart; - - public CommonMetadataViewModel(CommonPart commonPart) { - _commonPart = commonPart; - } - - public IUser Creator { get { return _commonPart.Owner; } } - - public DateTime? CreatedUtc { get { return _commonPart.CreatedUtc; } } - public DateTime? PublishedUtc { get { return _commonPart.PublishedUtc; } } - public DateTime? ModifiedUtc { get { return _commonPart.ModifiedUtc; } } - - public DateTime? VersionCreatedUtc { get { return _commonPart.VersionCreatedUtc; } } - public DateTime? VersionPublishedUtc { get { return _commonPart.VersionPublishedUtc; } } - public DateTime? VersionModifiedUtc { get { return _commonPart.VersionModifiedUtc; } } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Fields/Common.TextField.cshtml b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Fields/Common.TextField.cshtml deleted file mode 100644 index cf10b0d50..000000000 --- a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Fields/Common.TextField.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@model Orchard.Core.Common.Fields.TextField -@using Orchard.Utility.Extensions; -

@Model.Name.CamelFriendly(): @Model.Value

\ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.Manage.SummaryAdmin.cshtml b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.Manage.SummaryAdmin.cshtml deleted file mode 100644 index 55250529b..000000000 --- a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.Manage.SummaryAdmin.cshtml +++ /dev/null @@ -1 +0,0 @@ -@model Orchard.Core.Common.ViewModels.BodyDisplayViewModel \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.Manage.cshtml b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.Manage.cshtml deleted file mode 100644 index 7340291dc..000000000 --- a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.Manage.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@model BodyDisplayViewModel -@using Orchard.Core.Common.ViewModels; -
- @Html.ItemEditLinkWithReturnUrl(T("Edit").ToString(), Model.BodyPart.ContentItem) -
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.ManageWrapperPost.SummaryAdmin.cshtml b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.ManageWrapperPost.SummaryAdmin.cshtml deleted file mode 100644 index 55250529b..000000000 --- a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.ManageWrapperPost.SummaryAdmin.cshtml +++ /dev/null @@ -1 +0,0 @@ -@model Orchard.Core.Common.ViewModels.BodyDisplayViewModel \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.ManageWrapperPost.cshtml b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.ManageWrapperPost.cshtml deleted file mode 100644 index a24a87b20..000000000 --- a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.ManageWrapperPost.cshtml +++ /dev/null @@ -1,7 +0,0 @@ -@model BodyDisplayViewModel -@using Orchard.Core.Common.ViewModels; -@* begin: knowingly broken HTML (hence the ManageWrapperPre and ManageWrapperPost templates) -we need "wrapper templates" (among other functionality) in the future of UI composition -please do not delete or the front end will be broken when the user is authenticated. *@ - -@* begin: knowingly broken HTML *@ \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.ManageWrapperPre.SummaryAdmin.cshtml b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.ManageWrapperPre.SummaryAdmin.cshtml deleted file mode 100644 index 55250529b..000000000 --- a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.ManageWrapperPre.SummaryAdmin.cshtml +++ /dev/null @@ -1 +0,0 @@ -@model Orchard.Core.Common.ViewModels.BodyDisplayViewModel \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.ManageWrapperPre.cshtml b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.ManageWrapperPre.cshtml deleted file mode 100644 index 930523ad4..000000000 --- a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Body.ManageWrapperPre.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@model BodyDisplayViewModel -@using Orchard.Core.Common.ViewModels; -
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields/Common.TextField.cshtml b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields/Common.Text.Edit.cshtml similarity index 100% rename from src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields/Common.TextField.cshtml rename to src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields/Common.Text.Edit.cshtml diff --git a/src/Orchard.Web/Core/Common/Views/Fields/Common.Text.cshtml b/src/Orchard.Web/Core/Common/Views/Fields/Common.Text.cshtml new file mode 100644 index 000000000..4cf10f9d6 --- /dev/null +++ b/src/Orchard.Web/Core/Common/Views/Fields/Common.Text.cshtml @@ -0,0 +1,8 @@ +@using Orchard.Utility.Extensions; +@{ + string name = Model.Name; + string value = Model.Value; +} +@if (HasText(name) && HasText(value)) { +

@name.CamelFriendly(): @value

+} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/Parts/Common.Metadata.Summary.cshtml b/src/Orchard.Web/Core/Common/Views/Parts/Common.Metadata.Summary.cshtml new file mode 100644 index 000000000..e5ca1cad4 --- /dev/null +++ b/src/Orchard.Web/Core/Common/Views/Parts/Common.Metadata.Summary.cshtml @@ -0,0 +1,2 @@ +@using Orchard.Core.Common.Extensions; +
@Html.PublishedState((DateTime?)Model.ContentPart.VersionPublishedUtc, T)
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/Parts/Common.Metadata.cshtml b/src/Orchard.Web/Core/Common/Views/Parts/Common.Metadata.cshtml index fa8036d7e..e5ca1cad4 100644 --- a/src/Orchard.Web/Core/Common/Views/Parts/Common.Metadata.cshtml +++ b/src/Orchard.Web/Core/Common/Views/Parts/Common.Metadata.cshtml @@ -1,6 +1,2 @@ -@model Orchard.Core.Common.ViewModels.CommonMetadataViewModel -@using Orchard.Core.Common.Extensions; -@if (Model.Creator != null) { -} \ No newline at end of file +@using Orchard.Core.Common.Extensions; +
@Html.PublishedState((DateTime?)Model.ContentPart.VersionPublishedUtc, T)
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Contents/Views/Item/Display.cshtml b/src/Orchard.Web/Core/Contents/Views/Item/Display.cshtml new file mode 100644 index 000000000..631e9eb0f --- /dev/null +++ b/src/Orchard.Web/Core/Contents/Views/Item/Display.cshtml @@ -0,0 +1 @@ +@Display(Model) \ No newline at end of file diff --git a/src/Orchard.Web/Core/Contents/Views/Items/Content.Edit.cshtml b/src/Orchard.Web/Core/Contents/Views/Items/Content.Edit.cshtml index 170021de6..b6351b3cc 100644 --- a/src/Orchard.Web/Core/Contents/Views/Items/Content.Edit.cshtml +++ b/src/Orchard.Web/Core/Contents/Views/Items/Content.Edit.cshtml @@ -5,7 +5,7 @@
@Display(Model.Secondary)
- +
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Contents/Views/Items/Content.Editor.cshtml b/src/Orchard.Web/Core/Contents/Views/Items/Content.Editor.cshtml deleted file mode 100644 index 170021de6..000000000 --- a/src/Orchard.Web/Core/Contents/Views/Items/Content.Editor.cshtml +++ /dev/null @@ -1,11 +0,0 @@ -
-
- @Display(Model.Primary) -
-
- @Display(Model.Secondary) -
- -
-
-
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Contents/Views/Items/Content.Summary.cshtml b/src/Orchard.Web/Core/Contents/Views/Items/Content.Summary.cshtml deleted file mode 100644 index 252acbcf1..000000000 --- a/src/Orchard.Web/Core/Contents/Views/Items/Content.Summary.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -content item -> @Model.ContentItem.ContentType - -@Display(Model.Primary) diff --git a/src/Orchard.Web/Core/Contents/Views/Items/Content.cshtml b/src/Orchard.Web/Core/Contents/Views/Items/Content.cshtml index 46e4e50b9..d2a451e87 100644 --- a/src/Orchard.Web/Core/Contents/Views/Items/Content.cshtml +++ b/src/Orchard.Web/Core/Contents/Views/Items/Content.cshtml @@ -1,8 +1,21 @@ -
+@using Orchard.Utility.Extensions; +@{ + Layout.Title = Model.Title; + var contentTypeClassName = ((string)Model.ContentItem.ContentType).HtmlClassify(); +} +
-@Display(Model.Header) + @Display(Model.Header) + @if (Model.Meta != null) { + + }
-
-@Display(Model.Content) -
+ @Display(Model.Content) + @if(Model.Footer != null) { +
+ @Display(Model.Footer) +
+ }
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj index d4b16b48f..c3693cfad 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -82,7 +82,6 @@ - @@ -148,7 +147,6 @@ - @@ -255,11 +253,8 @@ - + - - - @@ -281,7 +276,7 @@ - + @@ -328,7 +323,6 @@ - @@ -360,9 +354,6 @@ - - - @@ -377,8 +368,6 @@ - - @@ -389,11 +378,16 @@ + + + + + diff --git a/src/Orchard.Web/Core/PublishLater/Placement.info b/src/Orchard.Web/Core/PublishLater/Placement.info index e7e177112..98d424a6e 100644 --- a/src/Orchard.Web/Core/PublishLater/Placement.info +++ b/src/Orchard.Web/Core/PublishLater/Placement.info @@ -1,14 +1,14 @@  - - - + + + + - - - - - - + diff --git a/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs b/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs index 4827bb8c9..4d7940b50 100644 --- a/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs +++ b/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs @@ -45,7 +45,7 @@ namespace Orchard.Core.Routable.Drivers { } protected override DriverResult Display(RoutePart part, string displayType, dynamic shapeHelper) { - return ContentShape("Parts_RoutableTitle", "Header:5", () => shapeHelper.Parts_RoutableTitle(ContentPart: part, Title: part.Title)); + return ContentShape("Parts_RoutableTitle", "Header:5", () => shapeHelper.Parts_RoutableTitle(ContentPart: part, Title: part.Title, Path: part.Path)); } protected override DriverResult Editor(RoutePart part, dynamic shapeHelper) { diff --git a/src/Orchard.Web/Core/Routable/Services/RoutableHomePageProvider.cs b/src/Orchard.Web/Core/Routable/Services/RoutableHomePageProvider.cs index 60e39a828..18bd86f49 100644 --- a/src/Orchard.Web/Core/Routable/Services/RoutableHomePageProvider.cs +++ b/src/Orchard.Web/Core/Routable/Services/RoutableHomePageProvider.cs @@ -42,7 +42,7 @@ namespace Orchard.Core.Routable.Services { var model = _contentManager.BuildDisplay(contentItem); return new ViewResult { - ViewName = "Display", + ViewName = "Routable.HomePage", ViewData = new ViewDataDictionary(model) }; } diff --git a/src/Orchard.Web/Core/Routable/Views/Item/Display.cshtml b/src/Orchard.Web/Core/Routable/Views/Item/Display.cshtml new file mode 100644 index 000000000..631e9eb0f --- /dev/null +++ b/src/Orchard.Web/Core/Routable/Views/Item/Display.cshtml @@ -0,0 +1 @@ +@Display(Model) \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Views/Parts/RoutableTitle.cshtml b/src/Orchard.Web/Core/Routable/Views/Parts/RoutableTitle.cshtml index 6024082e2..925e62123 100644 --- a/src/Orchard.Web/Core/Routable/Views/Parts/RoutableTitle.cshtml +++ b/src/Orchard.Web/Core/Routable/Views/Parts/RoutableTitle.cshtml @@ -1 +1 @@ -

@Model.Title

\ No newline at end of file +

@Model.Title

\ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Views/Routable.HomePage.cshtml b/src/Orchard.Web/Core/Routable/Views/Routable.HomePage.cshtml new file mode 100644 index 000000000..631e9eb0f --- /dev/null +++ b/src/Orchard.Web/Core/Routable/Views/Routable.HomePage.cshtml @@ -0,0 +1 @@ +@Display(Model) \ No newline at end of file diff --git a/src/Orchard.Web/Core/Shapes/Views/Display.cshtml b/src/Orchard.Web/Core/Shapes/Views/Display.cshtml deleted file mode 100644 index 86e9c225f..000000000 --- a/src/Orchard.Web/Core/Shapes/Views/Display.cshtml +++ /dev/null @@ -1,4 +0,0 @@ -@{ - Html.AddTitleParts((string)Model.Title); -} -@Display(Model) \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogController.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogController.cs index bddfb7a1f..f97bdab92 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogController.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogController.cs @@ -76,10 +76,9 @@ namespace Orchard.Blogs.Controllers { var list = Shape.List(); list.AddRange(blogPosts); - blog.ContentItem = blogPart; blog.Content.Add(Shape.Parts_Blogs_BlogPost_List(ContentItems: list), "5"); - return View("Display", blog); + return View(blog); } public ActionResult LiveWriterManifest(string blogSlug) { diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogArchivesPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogArchivesPartDriver.cs index 4bc0982fb..ab6498812 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogArchivesPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogArchivesPartDriver.cs @@ -2,7 +2,6 @@ using Orchard.Blogs.Services; using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; -using Orchard.Core.ContentsLocation.Models; namespace Orchard.Blogs.Drivers { public class BlogArchivesPartDriver : ContentPartDriver { @@ -24,13 +23,13 @@ namespace Orchard.Blogs.Drivers { if (blog == null) return null; - return shapeHelper.Parts_Blogs_BlogArchives(ContentItem: part, Blog: blog, Archives: _blogPostService.GetArchives(blog)); + return shapeHelper.Parts_Blogs_BlogArchives(ContentItem: part.ContentItem, Blog: blog, Archives: _blogPostService.GetArchives(blog)); }).Location("Content"); } protected override DriverResult Editor(BlogArchivesPart part, dynamic shapeHelper) { - var location = part.GetLocation("Editor", "Primary", "5"); - return ContentPartTemplate(part, "Parts/Blogs.BlogArchives").Location(location); + return ContentShape("Parts_Blogs_BlogArchives_Editor", + () => shapeHelper.EditorTemplate(TemplateName: "Parts/Blogs.BlogArchives", Model: part, Prefix: Prefix)); } protected override DriverResult Editor(BlogArchivesPart part, IUpdateModel updater, dynamic shapeHelper) { diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogPartDriver.cs index 2310d02b3..8c7bbe885 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogPartDriver.cs @@ -6,7 +6,6 @@ using Orchard.Blogs.Services; using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; using Orchard.Core.Feeds; -using Orchard.DisplayManagement; using Orchard.Localization; namespace Orchard.Blogs.Drivers { @@ -41,6 +40,8 @@ namespace Orchard.Blogs.Drivers { () => shapeHelper.Parts_Blogs_Blog_Manage(ContentPart: part)), ContentShape("Parts_Blogs_Blog_Description", () => shapeHelper.Parts_Blogs_Blog_Description(ContentPart: part, Description: part.Description)), + ContentShape("Parts_Blogs_Blog_BlogPostCount", + () => shapeHelper.Parts_Blogs_Blog_BlogPostCount(ContentPart: part, PostCount: part.PostCount)), // todo: (heskew) implement a paging solution that doesn't require blog posts to be tied to the blog within the controller ContentShape("Parts_Blogs_BlogPost_List", () => { diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/RecentBlogPostsPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/RecentBlogPostsPartDriver.cs index ac7ec0313..082bf4019 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/RecentBlogPostsPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/RecentBlogPostsPartDriver.cs @@ -5,7 +5,6 @@ using Orchard.Blogs.Services; using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; using Orchard.Core.Common.Models; -using Orchard.Core.ContentsLocation.Models; namespace Orchard.Blogs.Drivers { public class RecentBlogPostsPartDriver : ContentPartDriver { @@ -44,12 +43,12 @@ namespace Orchard.Blogs.Drivers { var blogPostList = shapeHelper.Parts_Blogs_BlogPost_List(ContentPart: part, ContentItems: list); - return ContentShape(shapeHelper.Parts_Blogs_RecentBlogPosts(ContentItem: part, ContentItems: blogPostList)); + return ContentShape(shapeHelper.Parts_Blogs_RecentBlogPosts(ContentItem: part.ContentItem, ContentItems: blogPostList)); } protected override DriverResult Editor(RecentBlogPostsPart part, dynamic shapeHelper) { - var location = part.GetLocation("Editor", "Primary", "5"); - return ContentPartTemplate(part, "Parts/Blogs.RecentBlogPosts").Location(location); + return ContentShape("Parts_Blogs_RecentBlogPosts_Edit", + () => shapeHelper.EditorTemplate(TemplateName: "Parts/Blogs.RecentBlogPosts", Model: part, Prefix: Prefix)); } protected override DriverResult Editor(RecentBlogPostsPart part, IUpdateModel updater, dynamic shapeHelper) { diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj index b0d46eae4..2d593f17b 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj @@ -137,10 +137,6 @@ Code - - - - @@ -165,12 +161,13 @@ - + + diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Placement.info b/src/Orchard.Web/Modules/Orchard.Blogs/Placement.info index 107de8e35..53d21e5ac 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Placement.info +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Placement.info @@ -3,6 +3,7 @@ + + + @@ -25,7 +29,8 @@ Parts_Blogs_Blog_Description="Manage:after"/> - + diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Blog/Item.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Blog/Item.cshtml index 6057ccc62..631e9eb0f 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Blog/Item.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Blog/Item.cshtml @@ -1,2 +1 @@ -@Display(Model.Meta) -@Display(Model.Content) \ No newline at end of file +@Display(Model) \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPost/Item.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPost/Item.cshtml index 86e9c225f..631e9eb0f 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPost/Item.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPost/Item.cshtml @@ -1,4 +1 @@ -@{ - Html.AddTitleParts((string)Model.Title); -} @Display(Model) \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-Blog.Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-Blog.Edit.cshtml new file mode 100644 index 000000000..b18f344b7 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-Blog.Edit.cshtml @@ -0,0 +1,7 @@ +@using Orchard.Mvc.Html; +@{ + Html.AddTitleParts((string)Model.Title); +} +@Display(Model.Primary) +@Display(Model.Secondary) +
\ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-Blog.Editor.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-Blog.Editor.cshtml deleted file mode 100644 index ca46e8462..000000000 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-Blog.Editor.cshtml +++ /dev/null @@ -1,6 +0,0 @@ -@using Orchard.Mvc.Html; -@{ - Html.AddTitleParts((string)Model.Title); -} -@Display(Model.Primary) -
\ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-Blog.Summary.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-Blog.Summary.cshtml deleted file mode 100644 index f0d60c326..000000000 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-Blog.Summary.cshtml +++ /dev/null @@ -1,10 +0,0 @@ -@using Orchard.Blogs.Extensions; -@using Orchard.Blogs.Models; -

@Html.Link((string)Model.Title, Url.Blog((string)Model.Slug))

- -@Display(Model.Content) \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-Blog.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-Blog.cshtml deleted file mode 100644 index f1709ff14..000000000 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-Blog.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -

@Html.TitleForPage((string)Model.Title)

-@Display(Model.Meta) -@Display(Model.Content) \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-BlogPost.Editor.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-BlogPost.Editor.cshtml index cd956410b..fe43401f1 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-BlogPost.Editor.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-BlogPost.Editor.cshtml @@ -10,7 +10,7 @@
@Display(Model.Secondary)
- + @* TODO: (erikpo) In the future, remove the HasPublished check so the user can delete the content item from here if the choose to *@ @if (blogPost.HasDraft && blogPost.HasPublished) { @Html.AntiForgeryTokenValueOrchardLink(T("Discard Draft").ToString(), Url.Action("DiscardDraft", new {Area = "Orchard.Blogs", Controller = "BlogPostAdmin", id = Model.Item.Id}), new {@class = "button"}) diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-BlogPost.Summary.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-BlogPost.Summary.cshtml deleted file mode 100644 index 54e1e52e6..000000000 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-BlogPost.Summary.cshtml +++ /dev/null @@ -1,8 +0,0 @@ -@using Orchard.Blogs.Extensions; -@using Orchard.Blogs.Models; -@using Orchard.Core.Common.Extensions; -@using Orchard.Core.Common.Models; -@using Orchard.Core.Common.ViewModels; -

@Html.Link((string)Model.Title, Url.BlogPost((BlogPostPart)Model.ContentItem.Get(typeof(BlogPostPart))))

-
@Html.PublishedState(new CommonMetadataViewModel((CommonPart)Model.ContentItem.Get(typeof(CommonPart))), T) | @Display(Model.Meta)
-
@Display(Model.Content)
\ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-BlogPost.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-BlogPost.cshtml deleted file mode 100644 index d325507ec..000000000 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Items/Content-BlogPost.cshtml +++ /dev/null @@ -1,11 +0,0 @@ -
-
- @Display(Model.Header) - -
-
- @Display(Model.Content) -
-
\ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Parts/Blogs.Blog.BlogPostCount.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Parts/Blogs.Blog.BlogPostCount.cshtml new file mode 100644 index 000000000..1141d99b9 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Parts/Blogs.Blog.BlogPostCount.cshtml @@ -0,0 +1 @@ +
@T.Plural("1 post", "{0} posts", (int)Model.PostCount)
\ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Email/Drivers/SmtpSettingsPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Email/Drivers/SmtpSettingsPartDriver.cs index e8847e280..7706e6d2b 100644 --- a/src/Orchard.Web/Modules/Orchard.Email/Drivers/SmtpSettingsPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Email/Drivers/SmtpSettingsPartDriver.cs @@ -20,13 +20,13 @@ namespace Orchard.Email.Drivers { protected override string Prefix { get { return "SmtpSettings"; } } protected override DriverResult Editor(SmtpSettingsPart part, dynamic shapeHelper) { - return ContentShape("Parts_SmtpSettings_Editor", + return ContentShape("Parts_SmtpSettings_Edit", () => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: part, Prefix: Prefix)); } protected override DriverResult Editor(SmtpSettingsPart part, IUpdateModel updater, dynamic shapeHelper) { updater.TryUpdateModel(part, Prefix, null, null); - return ContentShape("Parts_SmtpSettings_Editor", + return ContentShape("Parts_SmtpSettings_Edit", () => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: part, Prefix: Prefix)); } } diff --git a/src/Orchard.Web/Modules/Orchard.Experimental/Views/DumpShapeTable.cshtml b/src/Orchard.Web/Modules/Orchard.Experimental/Views/DumpShapeTable.cshtml index e3b0999e7..aea6c14ec 100644 --- a/src/Orchard.Web/Modules/Orchard.Experimental/Views/DumpShapeTable.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Experimental/Views/DumpShapeTable.cshtml @@ -6,14 +6,8 @@ var shapeTable = workContext.Resolve().GetShapeTable(workContext.CurrentTheme.ThemeName); diff --git a/src/Orchard.Web/Modules/Orchard.Tags/Drivers/TagsPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Tags/Drivers/TagsPartDriver.cs index 2989a258a..b517e940e 100644 --- a/src/Orchard.Web/Modules/Orchard.Tags/Drivers/TagsPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Tags/Drivers/TagsPartDriver.cs @@ -36,7 +36,7 @@ namespace Orchard.Tags.Drivers { if (!_authorizationService.TryCheckAccess(Permissions.ApplyTag, CurrentUser, part)) return null; - return ContentShape("Parts_Tags_Editor", + return ContentShape("Parts_Tags_Edit", () => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: BuildEditorViewModel(part), Prefix: Prefix)); } @@ -52,7 +52,7 @@ namespace Orchard.Tags.Drivers { _tagService.UpdateTagsForContentItem(part.ContentItem.Id, tagNames); } - return ContentShape("Parts_Tags_Editor", + return ContentShape("Parts_Tags_Edit", () => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix)); } diff --git a/src/Orchard/ContentManagement/Drivers/ContentFieldDriver.cs b/src/Orchard/ContentManagement/Drivers/ContentFieldDriver.cs index 9ec26a243..17cbcded1 100644 --- a/src/Orchard/ContentManagement/Drivers/ContentFieldDriver.cs +++ b/src/Orchard/ContentManagement/Drivers/ContentFieldDriver.cs @@ -3,22 +3,23 @@ using System.Collections.Generic; using System.Linq; using Orchard.ContentManagement.Handlers; using Orchard.ContentManagement.MetaData; +using Orchard.DisplayManagement; namespace Orchard.ContentManagement.Drivers { public abstract class ContentFieldDriver : IContentFieldDriver where TField : ContentField, new() { protected virtual string Prefix { get { return ""; } } - protected virtual string Zone { get { return "body"; } } + protected virtual string Zone { get { return "Content"; } } DriverResult IContentFieldDriver.BuildDisplayShape(BuildDisplayContext context) { - return Process(context.ContentItem, (part, field) => Display(part, field, context.DisplayType)); + return Process(context.ContentItem, (part, field) => Display(part, field, context.DisplayType, context.New)); } DriverResult IContentFieldDriver.BuildEditorShape(BuildEditorContext context) { - return Process(context.ContentItem, Editor); + return Process(context.ContentItem, (part, field) => Editor(part, field, context.New)); } DriverResult IContentFieldDriver.UpdateEditorShape(UpdateEditorContext context) { - return Process(context.ContentItem, (part, field) => Editor(part, field, context.Updater)); + return Process(context.ContentItem, (part, field) => Editor(part, field, context.Updater, context.New)); } DriverResult Process(ContentItem item, Func effort) { @@ -43,19 +44,44 @@ namespace Orchard.ContentManagement.Drivers { } - protected virtual DriverResult Display(ContentPart part, TField field, string displayType) { return null; } - protected virtual DriverResult Editor(ContentPart part, TField field) { return null; } - protected virtual DriverResult Editor(ContentPart part, TField field, IUpdateModel updater) { return null; } + protected virtual DriverResult Display(ContentPart part, TField field, string displayType, dynamic shapeHelper) { return null; } + protected virtual DriverResult Editor(ContentPart part, TField field, dynamic shapeHelper) { return null; } + protected virtual DriverResult Editor(ContentPart part, TField field, IUpdateModel updater, dynamic shapeHelper) { return null; } + public ContentShapeResult ContentShape(string shapeType, Func factory) { + return ContentShapeImplementation(shapeType, null, ctx => factory()); + } + public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func factory) { + return ContentShapeImplementation(shapeType, defaultLocation, ctx => factory()); + } + + public ContentShapeResult ContentShape(string shapeType, Func factory) { + return ContentShapeImplementation(shapeType, null, ctx=>factory(CreateShape(ctx, shapeType))); + } + + public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func factory) { + return ContentShapeImplementation(shapeType, defaultLocation, factory); + } + + private ContentShapeResult ContentShapeImplementation(string shapeType, string defaultLocation, Func shapeBuilder) { + return new ContentShapeResult(shapeType, Prefix, shapeBuilder).Location(defaultLocation); + } + + private object CreateShape(BuildShapeContext context, string shapeType) { + IShapeFactory shapeFactory = context.New; + return shapeFactory.Create(shapeType); + } + + [Obsolete] public ContentTemplateResult ContentFieldTemplate(object model) { return new ContentTemplateResult(model, null, Prefix).Location(Zone); } - + [Obsolete] public ContentTemplateResult ContentFieldTemplate(object model, string template) { return new ContentTemplateResult(model, template, Prefix).Location(Zone); } - + [Obsolete] public ContentTemplateResult ContentFieldTemplate(object model, string template, string prefix) { return new ContentTemplateResult(model, template, prefix).Location(Zone); } @@ -64,4 +90,4 @@ namespace Orchard.ContentManagement.Drivers { return new CombinedResult(results); } } -} \ No newline at end of file +} \ No newline at end of file diff --git a/src/Orchard/ContentManagement/Drivers/ContentPartDriver.cs b/src/Orchard/ContentManagement/Drivers/ContentPartDriver.cs index c362864d9..146fce428 100644 --- a/src/Orchard/ContentManagement/Drivers/ContentPartDriver.cs +++ b/src/Orchard/ContentManagement/Drivers/ContentPartDriver.cs @@ -7,7 +7,7 @@ using Orchard.DisplayManagement; namespace Orchard.ContentManagement.Drivers { public abstract class ContentPartDriver : IContentPartDriver where TContent : ContentPart, new() { protected virtual string Prefix { get { return ""; } } - protected virtual string Zone { get { return "Primary"; } } + protected virtual string Zone { get { return "Content"; } } DriverResult IContentPartDriver.BuildDisplay(BuildDisplayContext context) { var part = context.ContentItem.As(); @@ -45,7 +45,6 @@ namespace Orchard.ContentManagement.Drivers { return ContentShapeImplementation(shapeType, null, ctx=>factory(CreateShape(ctx, shapeType))); } - public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func factory) { return ContentShapeImplementation(shapeType, defaultLocation, factory); } diff --git a/src/Orchard/Utility/Extensions/StringExtensions.cs b/src/Orchard/Utility/Extensions/StringExtensions.cs index 062c61f75..c44cecb61 100644 --- a/src/Orchard/Utility/Extensions/StringExtensions.cs +++ b/src/Orchard/Utility/Extensions/StringExtensions.cs @@ -29,6 +29,8 @@ namespace Orchard.Utility.Extensions { } public static string HtmlClassify(this string text) { + if (string.IsNullOrWhiteSpace(text)) + return text; var friendlier = text.CamelFriendly(); return Regex.Replace(friendlier, @"[^a-zA-Z]+", m => m.Index == 0 ? "" : "-").ToLowerInvariant(); }