From 783b731866dfcf46229361ece49a5ea197e834cd Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Tue, 2 Mar 2010 14:07:58 -0800 Subject: [PATCH] More work on the front end content management experience (what little there is atm) - Wrapped the body aspect itself (oddly, w/out an idea of wrappers for zone items atm) with an injected manage/edit template so any content item w/ a body aspect gets some manage experience - Changed the Page and Blog Post to not insert their own manage templates --HG-- branch : dev --- .../Core/Common/Controllers/BodyDriver.cs | 20 ++++++++++--- .../Views/DisplayTemplates/Parts/Manage.ascx | 5 ++++ .../Parts/ManageWrapperPost.ascx | 3 ++ .../Parts/ManageWrapperPre.ascx | 3 ++ src/Orchard.Web/Core/Orchard.Core.csproj | 3 ++ .../Core/Themes/Styles/special.css | 29 +++++++++++++++++-- .../Controllers/BlogPostDriver.cs | 5 ++-- .../Orchard.Blogs/Orchard.Blogs.csproj | 2 -- .../Parts/Blogs.BlogPost.Manage.ascx | 9 ------ .../Orchard.Pages/Controllers/PageDriver.cs | 3 +- .../Orchard.Pages/Orchard.Pages.csproj | 1 - .../Parts/Pages.Page.Manage.ascx | 9 ------ 12 files changed, 60 insertions(+), 32 deletions(-) create mode 100644 src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Manage.ascx create mode 100644 src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/ManageWrapperPost.ascx create mode 100644 src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/ManageWrapperPre.ascx delete mode 100644 src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.Manage.ascx delete mode 100644 src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Parts/Pages.Page.Manage.ascx diff --git a/src/Orchard.Web/Core/Common/Controllers/BodyDriver.cs b/src/Orchard.Web/Core/Common/Controllers/BodyDriver.cs index 484d3717a..a9df16837 100644 --- a/src/Orchard.Web/Core/Common/Controllers/BodyDriver.cs +++ b/src/Orchard.Web/Core/Common/Controllers/BodyDriver.cs @@ -1,18 +1,30 @@ -using Orchard.ContentManagement.Drivers; +using Orchard.ContentManagement; +using Orchard.ContentManagement.Drivers; using Orchard.Core.Common.Models; using Orchard.Core.Common.ViewModels; namespace Orchard.Core.Common.Controllers { - public class BodyDriver : ContentPartDriver { + public class BodyDriver : ContentPartDriver { + public IOrchardServices Services { get; set; } private const string TemplateName = "Parts/Common.Body"; private const string DefaultTextEditorTemplate = "TinyMceTextEditor"; + + public BodyDriver(IOrchardServices services) { + Services = services; + } + protected override string Prefix { get {return "Body";} } + // \/\/ Haackalicious on many accounts - don't copy what has been done here for the wrapper \/\/ protected override DriverResult Display(BodyAspect part, string displayType) { var model = new BodyDisplayViewModel { BodyAspect = part }; - return ContentPartTemplate(model, TemplateName, Prefix).Location("primary", "5"); + return Combined( + Services.Authorizer.Authorize(Permissions.ChangeOwner) ? ContentPartTemplate(model, "Parts/ManageWrapperPre").Location("primary", "5") : null, + Services.Authorizer.Authorize(Permissions.ChangeOwner) ? ContentPartTemplate(model, "Parts/Manage").Location("primary", "5") : null, + ContentPartTemplate(model, TemplateName, Prefix).Location("primary", "5"), + Services.Authorizer.Authorize(Permissions.ChangeOwner) ? ContentPartTemplate(model, "Parts/ManageWrapperPost").Location("primary", "5") : null); } protected override DriverResult Editor(BodyAspect part) { @@ -20,7 +32,7 @@ namespace Orchard.Core.Common.Controllers { return ContentPartTemplate(model, TemplateName, Prefix).Location("primary", "5"); } - protected override DriverResult Editor(BodyAspect part, Orchard.ContentManagement.IUpdateModel updater) { + protected override DriverResult Editor(BodyAspect part, IUpdateModel updater) { var model = new BodyEditorViewModel { BodyAspect = part, TextEditorTemplate = DefaultTextEditorTemplate }; updater.TryUpdateModel(model, Prefix, null, null); return ContentPartTemplate(model, TemplateName, Prefix).Location("primary", "5"); diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Manage.ascx b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Manage.ascx new file mode 100644 index 000000000..a8d07423b --- /dev/null +++ b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Manage.ascx @@ -0,0 +1,5 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Core.Common.ViewModels"%> +
+ <%=Html.ItemEditLink("Edit", Model.BodyAspect.ContentItem) %> +
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/ManageWrapperPost.ascx b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/ManageWrapperPost.ascx new file mode 100644 index 000000000..d39d7cc8d --- /dev/null +++ b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/ManageWrapperPost.ascx @@ -0,0 +1,3 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Core.Common.ViewModels"%> + \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/ManageWrapperPre.ascx b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/ManageWrapperPre.ascx new file mode 100644 index 000000000..21ca5474e --- /dev/null +++ b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/ManageWrapperPre.ascx @@ -0,0 +1,3 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Core.Common.ViewModels"%> +
\ 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 037df57b2..e33ff7f5c 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -226,6 +226,9 @@ + + + diff --git a/src/Orchard.Web/Core/Themes/Styles/special.css b/src/Orchard.Web/Core/Themes/Styles/special.css index b7726d37b..c3fe77eda 100644 --- a/src/Orchard.Web/Core/Themes/Styles/special.css +++ b/src/Orchard.Web/Core/Themes/Styles/special.css @@ -1,3 +1,28 @@ -.manage a { - border:1px solid red; +.managewrapper, +.managewrapper .manage { + border:1px dashed #ccc; +} +.managewrapper:hover, +.managewrapper:hover .manage { + border-color:#8f8f8f; +} +.managewrapper { + position:relative; +} +.managewrapper .manage { + border-top:0; + border-right:0; + overflow:hidden; + position:absolute; + right:0; +} +.managewrapper .manage a { + background-color:#fff; + color:#4687ad; + font:14px/14px Segoe UI,Trebuchet,Arial,Sans-Serif; + padding:1px 3px; +} +.managewrapper .manage a:hover { + background-color:#ffac40; + color:#fff; } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostDriver.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostDriver.cs index 72f4cf1cd..8410a72da 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostDriver.cs @@ -56,17 +56,16 @@ namespace Orchard.Blogs.Controllers { protected override RouteValueDictionary GetEditorRouteValues(BlogPost post) { return new RouteValueDictionary { {"Area", "Orchard.Blogs"}, - {"Controller", "BlogPost"}, + {"Controller", "BlogPostAdmin"}, {"Action", "Edit"}, {"blogSlug", post.Blog.Slug}, - {"postSlug", post.Slug}, + {"postId", post.Id}, }; } protected override DriverResult Display(BlogPost post, string displayType) { return Combined( ContentItemTemplate("Items/Blogs.BlogPost").LongestMatch(displayType, "Summary", "SummaryAdmin"), - ContentPartTemplate(post, "Parts/Blogs.BlogPost.Manage").Location("primary:manage"), ContentPartTemplate(post, "Parts/Blogs.BlogPost.Metadata").Location("primary:metadata")); } diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj index f04cfcec1..f7442e443 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj @@ -156,9 +156,7 @@ - - diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.Manage.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.Manage.ascx deleted file mode 100644 index 6998bc4ce..000000000 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.Manage.ascx +++ /dev/null @@ -1,9 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Blogs"%> -<%@ Import Namespace="Orchard.Blogs.Extensions"%> -<%@ Import Namespace="Orchard.Blogs.Models"%><% -if (AuthorizedFor(Permissions.EditOthersBlogPost)) { %> -<% -} %> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Controllers/PageDriver.cs b/src/Orchard.Web/Modules/Orchard.Pages/Controllers/PageDriver.cs index 0ca41ec5c..2f62e11e3 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Controllers/PageDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Pages/Controllers/PageDriver.cs @@ -55,14 +55,13 @@ namespace Orchard.Pages.Controllers { {"Area", "Orchard.Pages"}, {"Controller", "Admin"}, {"Action", "Edit"}, - {"pageSlug", page.Slug}, + {"id", page.Id}, }; } protected override DriverResult Display(Page page, string displayType) { return Combined( ContentItemTemplate("Items/Pages.Page").LongestMatch(displayType, "Summary", "SummaryAdmin"), - ContentPartTemplate(page, "Parts/Pages.Page.Manage").Location("primary:manage"), ContentPartTemplate(page, "Parts/Pages.Page.Metadata").Location("primary:metadata")); } diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj b/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj index 9aa51df97..16eae8090 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj +++ b/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj @@ -120,7 +120,6 @@ - diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Parts/Pages.Page.Manage.ascx b/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Parts/Pages.Page.Manage.ascx deleted file mode 100644 index 95954b82e..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Parts/Pages.Page.Manage.ascx +++ /dev/null @@ -1,9 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Pages"%> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Mvc.Html" %><% -if (AuthorizedFor(Permissions.EditOthersPages)) { %> -<% -} %> \ No newline at end of file