mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 12:09:41 +08:00
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
This commit is contained in:
@@ -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<BodyAspect> {
|
||||
public class BodyDriver : ContentPartDriver<BodyAspect> {
|
||||
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");
|
||||
|
@@ -0,0 +1,5 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BodyDisplayViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Common.ViewModels"%>
|
||||
<div class="manage">
|
||||
<%=Html.ItemEditLink("Edit", Model.BodyAspect.ContentItem) %>
|
||||
</div>
|
@@ -0,0 +1,3 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BodyDisplayViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Common.ViewModels"%>
|
||||
</div>
|
@@ -0,0 +1,3 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BodyDisplayViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Common.ViewModels"%>
|
||||
<div class="managewrapper">
|
@@ -226,6 +226,9 @@
|
||||
<Content Include="Themes\Views\DisplayTemplates\Items\ContentItem.ascx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\ManageWrapperPost.ascx" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\ManageWrapperPre.ascx" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Manage.ascx" />
|
||||
<Content Include="Dashboard\Views\Web.config" />
|
||||
<Content Include="Themes\Styles\special.css" />
|
||||
</ItemGroup>
|
||||
|
@@ -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;
|
||||
}
|
@@ -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"));
|
||||
}
|
||||
|
||||
|
@@ -156,9 +156,7 @@
|
||||
<Content Include="Views\DisplayTemplates\Items\Blogs.Blog.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.BlogPost.List.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Items\Blogs.Blog.Summary.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.BlogPost.Manage.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.BlogPost.Metadata.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.Blog.Manage.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.Blog.Description.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.Blog.Metadata.ascx" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Blogs.BlogPost.Publish.ascx" />
|
||||
|
@@ -1,9 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BlogPost>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%><%
|
||||
if (AuthorizedFor(Permissions.EditOthersBlogPost)) { %>
|
||||
<div class="manage">
|
||||
<a href="<%=Url.BlogPostEdit(Model.Blog.Slug, Model.Id) %>" class="edit"><%=_Encoded("Edit") %></a>
|
||||
</div><%
|
||||
} %>
|
@@ -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"));
|
||||
}
|
||||
|
||||
|
@@ -120,7 +120,6 @@
|
||||
<Content Include="Views\DisplayTemplates\Items\Pages.Page.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Items\Pages.Page.Summary.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Pages.Page.Metadata.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Pages.Page.Manage.ascx" />
|
||||
<Content Include="Views\EditorTemplates\Items\Pages.Page.ascx" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Pages.Page.Publish.ascx" />
|
||||
<Content Include="Views\Admin\Create.ascx" />
|
||||
|
@@ -1,9 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Pages.Models.Page>" %>
|
||||
<%@ Import Namespace="Orchard.Pages"%>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html" %><%
|
||||
if (AuthorizedFor(Permissions.EditOthersPages)) { %>
|
||||
<div class="manage">
|
||||
<a href="<%=Url.Action("Edit", "Admin", new {id = Model.Id, area = "Orchard.Pages"}) %>" class="edit"><%=_Encoded("Edit")%></a>
|
||||
</div><%
|
||||
} %>
|
Reference in New Issue
Block a user