mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-24 13:33:34 +08:00
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:
@@ -21,9 +21,10 @@ namespace Orchard.Blogs.Controllers {
|
||||
private readonly INotifier _notifier;
|
||||
private readonly IBlogService _blogService;
|
||||
|
||||
public BlogController(ISessionLocator sessionLocator, IContentManager contentManager,
|
||||
IAuthorizer authorizer, INotifier notifier,
|
||||
IBlogService blogService) {
|
||||
public BlogController(
|
||||
ISessionLocator sessionLocator, IContentManager contentManager,
|
||||
IAuthorizer authorizer, INotifier notifier,
|
||||
IBlogService blogService) {
|
||||
_sessionLocator = sessionLocator;
|
||||
_contentManager = contentManager;
|
||||
_authorizer = authorizer;
|
||||
@@ -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")))
|
||||
|
Reference in New Issue
Block a user