Moving some things around for optimal templating (just for blogs for now). Controller convention is needed for admin actions still, but the current structure is closer to what it should be in the end.

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4044346
This commit is contained in:
ErikPorter
2009-12-20 08:57:20 +00:00
parent b86457f897
commit 3312bdd55f
25 changed files with 141 additions and 112 deletions

View File

@@ -41,7 +41,7 @@ namespace Orchard.Tests.Models {
});
var contentHandler = _container.Resolve<IContentHandler>();
var ctx = new BuildDisplayModelContext(new ItemDisplayModel(new ContentItem()), null, null);
var ctx = new BuildDisplayModelContext(new ItemDisplayModel(new ContentItem()), null, null, null);
driver1.Verify(x => x.BuildDisplayModel(ctx), Times.Never());
contentHandler.BuildDisplayModel(ctx);
@@ -58,7 +58,7 @@ namespace Orchard.Tests.Models {
var item = new ContentItem();
item.Weld(new StubPart { Foo = new[] { "a", "b", "c" } });
var ctx = new BuildDisplayModelContext(new ItemDisplayModel(item), "", "");
var ctx = new BuildDisplayModelContext(new ItemDisplayModel(item), "", "", null);
Assert.That(ctx.DisplayModel.Displays.Count(), Is.EqualTo(0));
contentHandler.BuildDisplayModel(ctx);
Assert.That(ctx.DisplayModel.Displays.Count(), Is.EqualTo(1));

View File

@@ -4,6 +4,6 @@
<li><%= Html.ActionLink("Home", "Index", "Home", new {Area = ""}, new {})%></li>
<li><%= Html.ActionLink("About", "About", "Home", new {Area = ""}, new {})%></li>
<li><%= Html.ActionLink("Blogs", "List", "Blog", new {Area = "Orchard.Blogs"}, new {})%></li>
<li><%= Html.ActionLink("Admin", "ListForAdmin", new {Area = "Orchard.Blogs", Controller = "Blog"})%></li>
<li><%= Html.ActionLink("Admin", "List", new {Area = "Orchard.Blogs", Controller = "BlogAdmin"})%></li>
</ul>
</div>

View File

@@ -7,7 +7,7 @@ namespace Orchard.Blogs {
public void GetNavigation(NavigationBuilder builder) {
builder.Add("Blogs", "2",
menu => menu
.Add("Manage Blogs", "1.0", item => item.Action("ListForAdmin", "Blog", new { area = "Orchard.Blogs" }))
.Add("Manage Blogs", "1.0", item => item.Action("List", "BlogAdmin", new { area = "Orchard.Blogs" }))
.Add("Add New Blog", "1.1", item => item.Action("Create", "Blog", new { area = "Orchard.Blogs" })));
}
}

View File

@@ -0,0 +1,44 @@
using System.Linq;
using System.Web.Mvc;
using Orchard.Blogs.Models;
using Orchard.Blogs.Services;
using Orchard.Blogs.ViewModels;
using Orchard.Models;
using Orchard.Mvc.Results;
namespace Orchard.Blogs.Controllers {
[ValidateInput(false)]
public class BlogAdminController : Controller {
private readonly IBlogService _blogService;
private readonly IContentManager _contentManager;
public BlogAdminController(IContentManager contentManager, IBlogService blogService) {
_contentManager = contentManager;
_blogService = blogService;
}
public ActionResult List() {
//TODO: (erikpo) Need to make templatePath be more convention based so if my controller name has "Admin" in it then "Admin/{type}" is assumed
var model = new AdminBlogsViewModel {
Blogs = _blogService.Get().Select(b => _contentManager.BuildDisplayModel(b, null, "Summary", "Admin/Blog"))
};
return View(model);
}
//TODO: (erikpo) Should move the slug parameter and get call and null check up into a model binder
public ActionResult Item(string blogSlug) {
Blog blog = _blogService.Get(blogSlug);
if (blog == null)
return new NotFoundResult();
//TODO: (erikpo) Need to make templatePath be more convention based so if my controller name has "Admin" in it then "Admin/{type}" is assumed
var model = new BlogForAdminViewModel {
Blog = _contentManager.BuildDisplayModel(blog, null, "Detail", "Admin/Blog")
};
return View(model);
}
}
}

View File

@@ -21,7 +21,8 @@ namespace Orchard.Blogs.Controllers {
private readonly INotifier _notifier;
private readonly IBlogService _blogService;
public BlogController(ISessionLocator sessionLocator, IContentManager contentManager,
public BlogController(
ISessionLocator sessionLocator, IContentManager contentManager,
IAuthorizer authorizer, INotifier notifier,
IBlogService blogService) {
_sessionLocator = sessionLocator;
@@ -42,14 +43,6 @@ namespace Orchard.Blogs.Controllers {
return View(model);
}
public ActionResult ListForAdmin() {
var model = new BlogsForAdminViewModel {
Blogs = _blogService.Get().Select(b => _contentManager.BuildDisplayModel(b, null, "SummaryAdmin"))
};
return View(model);
}
//TODO: (erikpo) Should move the slug parameter and get call and null check up into a model binder
public ActionResult Item(string blogSlug) {
Blog blog = _blogService.Get(blogSlug);
@@ -64,20 +57,6 @@ namespace Orchard.Blogs.Controllers {
return View(model);
}
//TODO: (erikpo) Should move the slug parameter and get call and null check up into a model binder
public ActionResult ItemForAdmin(string blogSlug) {
Blog blog = _blogService.Get(blogSlug);
if (blog == null)
return new NotFoundResult();
var model = new BlogForAdminViewModel {
Blog = _contentManager.BuildDisplayModel(blog, null, "DetailAdmin")
};
return View(model);
}
public ActionResult Create() {
//TODO: (erikpo) Might think about moving this to an ActionFilter/Attribute
if (!_authorizer.Authorize(Permissions.CreateBlog, T("Not allowed to create blogs")))

View File

@@ -4,7 +4,6 @@ using Orchard.Blogs.Extensions;
using Orchard.Blogs.Models;
using Orchard.Blogs.Services;
using Orchard.Blogs.ViewModels;
using Orchard.Core.Common.Models;
using Orchard.Data;
using Orchard.Localization;
using Orchard.Models;
@@ -23,9 +22,12 @@ namespace Orchard.Blogs.Controllers {
private readonly IBlogService _blogService;
private readonly IBlogPostService _blogPostService;
public BlogPostController(ISessionLocator sessionLocator, IContentManager contentManager,
IAuthorizer authorizer, INotifier notifier,
IBlogService blogService, IBlogPostService blogPostService) {
public BlogPostController(
ISessionLocator sessionLocator, IContentManager contentManager,
IAuthorizer authorizer,
INotifier notifier,
IBlogService blogService,
IBlogPostService blogPostService) {
_sessionLocator = sessionLocator;
_contentManager = contentManager;
_authorizer = authorizer;

View File

@@ -7,7 +7,7 @@ namespace Orchard.Blogs.Extensions {
}
public static string BlogsForAdmin(this UrlHelper urlHelper) {
return urlHelper.Action("ListForAdmin", "Blog", new {area = "Orchard.Blogs"});
return urlHelper.Action("List", "BlogAdmin", new {area = "Orchard.Blogs"});
}
public static string Blog(this UrlHelper urlHelper, string blogSlug) {
@@ -15,7 +15,7 @@ namespace Orchard.Blogs.Extensions {
}
public static string BlogForAdmin(this UrlHelper urlHelper, string blogSlug) {
return urlHelper.Action("ItemForAdmin", "Blog", new {blogSlug, area = "Orchard.Blogs"});
return urlHelper.Action("Item", "BlogAdmin", new {blogSlug, area = "Orchard.Blogs"});
}
public static string BlogCreate(this UrlHelper urlHelper) {

View File

@@ -16,7 +16,7 @@ namespace Orchard.Blogs.Models {
Filters.Add(new ActivatingFilter<CommonAspect>("blog"));
Filters.Add(new ActivatingFilter<RoutableAspect>("blog"));
Filters.Add(new StorageFilter<BlogRecord>(repository));
Filters.Add(new ContentItemTemplates<Blog>("Blog", "Detail", "DetailAdmin", "Summary", "SummaryAdmin"));
Filters.Add(new ContentItemTemplates<Blog>("Detail", "Summary"));
OnGetEditorViewModel<Blog>((context, blog) =>
context.AddEditor(new TemplateViewModel(blog) { TemplateName = "Blog/Fields", ZoneName = "primary", Position = "1" })

View File

@@ -24,7 +24,7 @@ namespace Orchard.Blogs.Models {
Filters.Add(new ActivatingFilter<RoutableAspect>("blogpost"));
Filters.Add(new ActivatingFilter<BodyAspect>("blogpost"));
Filters.Add(new StorageFilter<BlogPostRecord>(repository));
Filters.Add(new ContentItemTemplates<BlogPost>("BlogPost", "Detail", "Summary", "SummaryAdmin"));
Filters.Add(new ContentItemTemplates<BlogPost>("Detail", "Summary"));
OnCreated<BlogPost>((context, bp) => bp.Blog.PostCount++);
@@ -59,15 +59,10 @@ namespace Orchard.Blogs.Models {
switch(context.DisplayType) {
case "Detail":
context.AddDisplay(
new TemplateViewModel(posts.Select(bp => contentManager.BuildDisplayModel(bp, null, "Summary"))) {
TemplateName = "BlogPost/List",
ZoneName = "body"
});
break;
case "DetailAdmin":
context.AddDisplay(
new TemplateViewModel(posts.Select(bp => contentManager.BuildDisplayModel(bp, null, "SummaryAdmin"))) {
TemplateName = "BlogPost/ListAdmin",
//TODO: (erikpo) Need to make templatePath be more convention based so if my controller name has "Admin" in it then "Admin/{type}" is assumed
new TemplateViewModel(posts.Select(bp => contentManager.BuildDisplayModel(bp, null, "Summary", "Admin/BlogPost")))
{
TemplateName = "Admin/BlogPost/List",
ZoneName = "body"
});
break;

View File

@@ -66,6 +66,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AdminMenu.cs" />
<Compile Include="Controllers\BlogAdminController.cs" />
<Compile Include="Controllers\BlogPostController.cs" />
<Compile Include="Extensions\HtmlHelperExtensions.cs" />
<Compile Include="Extensions\UriExtensions.cs" />
@@ -85,7 +86,7 @@
<Compile Include="Services\BlogPostService.cs" />
<Compile Include="Services\IBlogPostService.cs" />
<Compile Include="Services\IBlogService.cs" />
<Compile Include="ViewModels\BlogsForAdminViewModel.cs" />
<Compile Include="ViewModels\AdminBlogsViewModel.cs" />
<Compile Include="ViewModels\BlogViewModel.cs" />
<Compile Include="ViewModels\BlogPostViewModel.cs" />
<Compile Include="ViewModels\BlogPostEditViewModel.cs" />
@@ -99,11 +100,11 @@
<Content Include="Package.txt" />
<Content Include="Views\BlogPost\Create.ascx" />
<Content Include="Views\BlogPost\Edit.ascx" />
<Content Include="Views\Shared\DisplayTemplates\Blog\DetailAdmin.ascx" />
<Content Include="Views\Blog\ItemForAdmin.ascx" />
<Content Include="Views\Shared\DisplayTemplates\Blog\SummaryAdmin.ascx" />
<Content Include="Views\Shared\DisplayTemplates\Admin\Blog\Detail.ascx" />
<Content Include="Views\BlogAdmin\Item.ascx" />
<Content Include="Views\Shared\DisplayTemplates\Admin\Blog\Summary.ascx" />
<Content Include="Views\Blog\List.ascx" />
<Content Include="Views\Blog\ListForAdmin.ascx" />
<Content Include="Views\BlogAdmin\List.ascx" />
<Content Include="Views\Shared\DisplayTemplates\BlogPost\Detail.ascx" />
<Content Include="Views\Shared\DisplayTemplates\BlogPost\Summary.ascx" />
<Content Include="Views\Shared\DisplayTemplates\Blog\Detail.ascx" />
@@ -114,8 +115,8 @@
<Content Include="Views\Blog\Create.ascx" />
<Content Include="Views\Blog\Edit.ascx" />
<Content Include="Views\Blog\Item.ascx" />
<Content Include="Views\Shared\DisplayTemplates\BlogPost\SummaryAdmin.ascx" />
<Content Include="Views\Shared\DisplayTemplates\BlogPost\ListAdmin.ascx" />
<Content Include="Views\Shared\DisplayTemplates\Admin\BlogPost\Summary.ascx" />
<Content Include="Views\Shared\DisplayTemplates\Admin\BlogPost\List.ascx" />
<Content Include="Views\Shared\EditorTemplates\Blog\Fields.ascx" />
<Content Include="Views\Shared\EditorTemplates\Blog\Detail.ascx" />
<Content Include="Views\Shared\EditorTemplates\BlogPost\Detail.ascx" />

View File

@@ -86,8 +86,8 @@ namespace Orchard.Blogs {
"Admin/Blogs/{blogSlug}",
new RouteValueDictionary {
{"area", "Orchard.Blogs"},
{"controller", "Blog"},
{"action", "ItemForAdmin"}
{"controller", "BlogAdmin"},
{"action", "Item"}
},
new RouteValueDictionary {
{"blogSlug", new IsBlogConstraint(_blogService)}
@@ -145,29 +145,29 @@ namespace Orchard.Blogs {
},
new MvcRouteHandler())
},
new RouteDescriptor {
Route = new Route(
"Admin/Blogs/{blogSlug}/Posts",
new RouteValueDictionary {
{"area", "Orchard.Blogs"},
{"controller", "BlogPost"},
{"action", "ListForAdmin"}
},
new RouteValueDictionary {
{"blogSlug", new IsBlogConstraint(_blogService)}
},
new RouteValueDictionary {
{"area", "Orchard.Blogs"}
},
new MvcRouteHandler())
},
//new RouteDescriptor {
// Route = new Route(
// "Admin/Blogs/{blogSlug}/Posts",
// new RouteValueDictionary {
// {"area", "Orchard.Blogs"},
// {"controller", "BlogPostAdmin"},
// {"action", "List"}
// },
// new RouteValueDictionary {
// {"blogSlug", new IsBlogConstraint(_blogService)}
// },
// new RouteValueDictionary {
// {"area", "Orchard.Blogs"}
// },
// new MvcRouteHandler())
// },
new RouteDescriptor {
Route = new Route(
"Admin/Blogs",
new RouteValueDictionary {
{"area", "Orchard.Blogs"},
{"controller", "Blog"},
{"action", "ListForAdmin"}
{"controller", "BlogAdmin"},
{"action", "List"}
},
new RouteValueDictionary(),
new RouteValueDictionary {

View File

@@ -4,7 +4,7 @@ using Orchard.Models.ViewModels;
using Orchard.Mvc.ViewModels;
namespace Orchard.Blogs.ViewModels {
public class BlogsForAdminViewModel : AdminViewModel {
public class AdminBlogsViewModel : AdminViewModel {
public IEnumerable<ItemDisplayModel<Blog>> Blogs { get; set; }
}
}

View File

@@ -1,8 +1,7 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BlogsForAdminViewModel>" %>
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
<%@ Import Namespace="Orchard.Blogs.Models"%>
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<AdminBlogsViewModel>" %>
<%@ Import Namespace="Orchard.Mvc.Html"%>
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
<% Html.Title("Manage Blogs"); %>
<h2>Manage Blogs</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p><%

View File

@@ -8,7 +8,6 @@ using Orchard.Models.ViewModels;
namespace Orchard.Sandbox.Models {
public class SandboxContentHandler : ContentHandler {
public override IEnumerable<ContentType> GetContentTypes() {
return new[] { SandboxPage.ContentType };
}
@@ -23,7 +22,7 @@ namespace Orchard.Sandbox.Models {
Filters.Add(new ActivatingFilter<RoutableAspect>(SandboxPage.ContentType.Name));
Filters.Add(new ActivatingFilter<BodyAspect>(SandboxPage.ContentType.Name));
Filters.Add(new StorageFilter<SandboxPageRecord>(pageRepository) { AutomaticallyCreateMissingRecord = true });
Filters.Add(new ContentItemTemplates<SandboxPage>("SandboxPage", "Summary"));
Filters.Add(new ContentItemTemplates<SandboxPage>("Summary"));
OnGetItemMetadata<SandboxPage>((context, page) => {
context.Metadata.DisplayText = page.Record.Name;

View File

@@ -137,8 +137,12 @@ namespace Orchard.Models {
}
public ItemDisplayModel<TContentPart> BuildDisplayModel<TContentPart>(TContentPart content, string groupName, string displayType) where TContentPart : IContent {
var itemView = new ItemDisplayModel<TContentPart> {Item = content, Displays = Enumerable.Empty<TemplateViewModel>()};
var context = new BuildDisplayModelContext(itemView, groupName, displayType);
return BuildDisplayModel(content, groupName, displayType, null);
}
public ItemDisplayModel<TContent> BuildDisplayModel<TContent>(TContent content, string groupName, string displayType, string templatePath) where TContent : IContent {
var itemView = new ItemDisplayModel<TContent> { Item = content, Displays = Enumerable.Empty<TemplateViewModel>() };
var context = new BuildDisplayModelContext(itemView, groupName, displayType, templatePath);
foreach (var handler in Handlers) {
handler.BuildDisplayModel(context);
}
@@ -146,9 +150,13 @@ namespace Orchard.Models {
return itemView;
}
public ItemEditorModel<TContentPart> BuildEditorModel<TContentPart>(TContentPart content, string groupName) where TContentPart : IContent {
var itemView = new ItemEditorModel<TContentPart> { Item = content, Editors = Enumerable.Empty<TemplateViewModel>() };
var context = new BuildEditorModelContext(itemView, groupName);
public ItemEditorModel<TContent> BuildEditorModel<TContent>(TContent content, string groupName) where TContent : IContent {
return BuildEditorModel(content, groupName, null);
}
public ItemEditorModel<TContent> BuildEditorModel<TContent>(TContent content, string groupName, string templatePath) where TContent : IContent {
var itemView = new ItemEditorModel<TContent> { Item = content, Editors = Enumerable.Empty<TemplateViewModel>() };
var context = new BuildEditorModelContext(itemView, groupName, templatePath);
foreach (var handler in Handlers) {
handler.BuildEditorModel(context);
}
@@ -156,10 +164,13 @@ namespace Orchard.Models {
return itemView;
}
public ItemEditorModel<TContentPart> UpdateEditorModel<TContentPart>(TContentPart content, string groupName, IUpdateModel updater) where TContentPart : IContent {
var itemView = new ItemEditorModel<TContentPart> { Item = content, Editors = Enumerable.Empty<TemplateViewModel>() };
public ItemEditorModel<TContent> UpdateEditorModel<TContent>(TContent content, string groupName, IUpdateModel updater) where TContent : IContent {
return UpdateEditorModel(content, groupName, updater, null);
}
var context = new UpdateEditorModelContext(itemView, groupName, updater);
public ItemEditorModel<TContent> UpdateEditorModel<TContent>(TContent content, string groupName, IUpdateModel updater, string templatePath) where TContent : IContent {
var itemView = new ItemEditorModel<TContent> { Item = content, Editors = Enumerable.Empty<TemplateViewModel>() };
var context = new UpdateEditorModelContext(itemView, groupName, updater, templatePath);
foreach (var handler in Handlers) {
handler.UpdateEditorModel(context);
}

View File

@@ -1,22 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Orchard.Models.ViewModels;
namespace Orchard.Models.Driver {
public class BuildDisplayModelContext {
public BuildDisplayModelContext(ItemDisplayModel displayModel, string groupName, string displayType) {
public BuildDisplayModelContext(ItemDisplayModel displayModel, string groupName, string displayType, string templatePath) {
ContentItem = displayModel.Item;
GroupName = groupName;
DisplayType = displayType;
DisplayModel = displayModel;
TemplatePath = templatePath;
}
public ContentItem ContentItem { get; set; }
public string GroupName { get; set; }
public string DisplayType { get; set; }
public ItemDisplayModel DisplayModel { get; set; }
public ContentItem ContentItem { get; private set; }
public string GroupName { get; private set; }
public string DisplayType { get; private set; }
public ItemDisplayModel DisplayModel { get; private set; }
public string TemplatePath { get; private set; }
public void AddDisplay(TemplateViewModel display) {
DisplayModel.Displays = DisplayModel.Displays.Concat(new[] { display });

View File

@@ -1,19 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Orchard.Models.ViewModels;
namespace Orchard.Models.Driver {
public class BuildEditorModelContext {
public BuildEditorModelContext(ItemEditorModel editorModel, string groupName) {
public BuildEditorModelContext(ItemEditorModel editorModel, string groupName, string templatePath) {
ContentItem = editorModel.Item;
GroupName = groupName;
EditorModel = editorModel;
TemplatePath = templatePath;
}
public ContentItem ContentItem { get; set; }
public string GroupName { get; set; }
public ItemEditorModel EditorModel { get; set; }
public ContentItem ContentItem { get; private set; }
public string GroupName { get; private set; }
public ItemEditorModel EditorModel { get; private set; }
public string TemplatePath { get; private set; }
public void AddEditor(TemplateViewModel editor) {
EditorModel.Editors = EditorModel.Editors.Concat(new[] { editor });

View File

@@ -5,21 +5,19 @@ using Orchard.Models.ViewModels;
namespace Orchard.Models.Driver {
public class ContentItemTemplates<TContent> : TemplateFilterBase<TContent> where TContent : class, IContent {
private readonly string _templateName;
// todo: (heskew) use _prefix?
private readonly string _prefix;
private readonly string[] _displayTypes;
private Action<UpdateEditorModelContext, ItemEditorModel<TContent>> _updater;
public ContentItemTemplates(string templateName, params string[] displayTypes) {
_templateName = templateName;
public ContentItemTemplates(params string[] displayTypes) {
_displayTypes = displayTypes;
_updater = (context, viewModel) => context.Updater.TryUpdateModel(viewModel, "", null, null);
}
protected override void BuildDisplayModel(BuildDisplayModelContext context, TContent instance) {
var longestMatch = LongestMatch(context.DisplayType);
context.DisplayModel.TemplateName = _templateName + "/" + longestMatch;
context.DisplayModel.TemplateName = (!string.IsNullOrEmpty(context.TemplatePath) ? context.TemplatePath : typeof(TContent).Name) + "/" + longestMatch;
context.DisplayModel.Prefix = _prefix;
if (context.DisplayModel.GetType() != typeof(ItemDisplayModel<TContent>)) {
@@ -47,7 +45,7 @@ namespace Orchard.Models.Driver {
}
protected override void BuildEditorModel(BuildEditorModelContext context, TContent instance) {
context.EditorModel.TemplateName = _templateName + "/Detail";
context.EditorModel.TemplateName = (!string.IsNullOrEmpty(context.TemplatePath) ? context.TemplatePath : typeof(TContent).Name) + "/Detail";
context.EditorModel.Prefix = _prefix;
if (context.EditorModel.GetType() != typeof(ItemEditorModel<TContent>)) {
context.EditorModel.Adaptor = (html, viewModel) => {
@@ -64,7 +62,7 @@ namespace Orchard.Models.Driver {
_updater(context, (ItemEditorModel<TContent>)context.EditorModel);
else
_updater(context, new ItemEditorModel<TContent>(context.EditorModel));
context.EditorModel.TemplateName = _templateName + "/Detail";
context.EditorModel.TemplateName = (!string.IsNullOrEmpty(context.TemplatePath) ? context.TemplatePath : typeof(TContent).Name) + "/Detail";
context.EditorModel.Prefix = _prefix;
}

View File

@@ -2,11 +2,11 @@ using Orchard.Models.ViewModels;
namespace Orchard.Models.Driver {
public class UpdateEditorModelContext : BuildEditorModelContext {
public UpdateEditorModelContext(ItemEditorModel editorModel, string groupName, IUpdateModel updater)
: base(editorModel, groupName) {
public UpdateEditorModelContext(ItemEditorModel editorModel, string groupName, IUpdateModel updater, string templatePath)
: base(editorModel, groupName, templatePath) {
Updater = updater;
}
public IUpdateModel Updater { get; set; }
public IUpdateModel Updater { get; private set; }
}
}

View File

@@ -1,6 +1,5 @@
using System.Collections.Generic;
using Orchard.Models.Driver;
using Orchard.Models.Records;
using Orchard.Models.ViewModels;
namespace Orchard.Models {
@@ -17,7 +16,10 @@ namespace Orchard.Models {
ContentItemMetadata GetItemMetadata(IContent contentItem);
ItemDisplayModel<TContent> BuildDisplayModel<TContent>(TContent content, string groupName, string displayType) where TContent : IContent;
ItemDisplayModel<TContent> BuildDisplayModel<TContent>(TContent content, string groupName, string displayType, string templatePath) where TContent : IContent;
ItemEditorModel<TContent> BuildEditorModel<TContent>(TContent content, string groupName) where TContent : IContent;
ItemEditorModel<TContent> BuildEditorModel<TContent>(TContent content, string groupName, string templatePath) where TContent : IContent;
ItemEditorModel<TContent> UpdateEditorModel<TContent>(TContent content, string groupName, IUpdateModel updater) where TContent : IContent;
ItemEditorModel<TContent> UpdateEditorModel<TContent>(TContent content, string groupName, IUpdateModel updater, string templatePath) where TContent : IContent;
}
}