mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Migrating Orchard.Blogs
--HG-- branch : dev
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Drivers;
|
||||
using Orchard.Blogs.Extensions;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Routing;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.Blogs.ViewModels;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Data;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Mvc.Results;
|
||||
using Orchard.Settings;
|
||||
using Orchard.UI.Admin;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
@@ -29,7 +27,8 @@ namespace Orchard.Blogs.Controllers {
|
||||
IBlogPostService blogPostService,
|
||||
IContentManager contentManager,
|
||||
ITransactionManager transactionManager,
|
||||
IBlogSlugConstraint blogSlugConstraint) {
|
||||
IBlogSlugConstraint blogSlugConstraint,
|
||||
IShapeHelperFactory shapeHelperFactory) {
|
||||
Services = services;
|
||||
_blogService = blogService;
|
||||
_blogPostService = blogPostService;
|
||||
@@ -37,8 +36,10 @@ namespace Orchard.Blogs.Controllers {
|
||||
_transactionManager = transactionManager;
|
||||
_blogSlugConstraint = blogSlugConstraint;
|
||||
T = NullLocalizer.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
public Localizer T { get; set; }
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
@@ -47,35 +48,34 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Not allowed to create blogs")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var blog = Services.ContentManager.New<BlogPart>(BlogPartDriver.ContentType.Name);
|
||||
var blog = Services.ContentManager.New<BlogPart>("Blog");
|
||||
if (blog == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var model = new CreateBlogViewModel {
|
||||
Blog = Services.ContentManager.BuildEditorModel(blog)
|
||||
};
|
||||
|
||||
var model = Services.ContentManager.BuildEditorModel(blog);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Create(CreateBlogViewModel model) {
|
||||
var blog = Services.ContentManager.New<BlogPart>(BlogPartDriver.ContentType.Name);
|
||||
[HttpPost, ActionName("Create")]
|
||||
public ActionResult CreatePOST() {
|
||||
var blog = Services.ContentManager.New<BlogPart>("Blog");
|
||||
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Couldn't create blog")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
_blogService.Create(blog);
|
||||
model.Blog = _contentManager.UpdateEditorModel(blog, this);
|
||||
_contentManager.Create(blog, VersionOptions.Draft);
|
||||
var model = _contentManager.UpdateEditorModel(blog, this);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
_transactionManager.Cancel();
|
||||
return View(model);
|
||||
}
|
||||
|
||||
_blogSlugConstraint.AddSlug(model.Blog.Item.Slug);
|
||||
if (!blog.Has<IPublishingControlAspect>())
|
||||
_contentManager.Publish(blog.ContentItem);
|
||||
|
||||
return Redirect(Url.BlogForAdmin(model.Blog.Item.Slug));
|
||||
_blogSlugConstraint.AddSlug((string)model.Slug);
|
||||
return Redirect(Url.BlogForAdmin((string)model.Slug));
|
||||
}
|
||||
|
||||
public ActionResult Edit(string blogSlug) {
|
||||
@@ -88,11 +88,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (blog == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var model = new BlogEditViewModel {
|
||||
Blog = Services.ContentManager.BuildEditorModel(blog),
|
||||
//PromoteToHomePage = CurrentSite.HomePage == "BlogHomePageProvider;" + blog.Id
|
||||
};
|
||||
|
||||
var model = Services.ContentManager.BuildEditorModel(blog);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
@@ -106,20 +102,12 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (blog == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var model = new BlogEditViewModel {
|
||||
Blog = Services.ContentManager.UpdateEditorModel(blog, this),
|
||||
};
|
||||
|
||||
var model = Services.ContentManager.UpdateEditorModel(blog, this);
|
||||
if (!ModelState.IsValid)
|
||||
return View(model);
|
||||
|
||||
//if (PromoteToHomePage)
|
||||
// CurrentSite.HomePage = "BlogHomePageProvider;" + model.Blog.Item.Id;
|
||||
|
||||
_blogService.Edit(model.Blog.Item);
|
||||
|
||||
_blogSlugConstraint.AddSlug(blog.Slug);
|
||||
Services.Notifier.Information(T("Blog information updated"));
|
||||
|
||||
return Redirect(Url.BlogsForAdmin());
|
||||
}
|
||||
|
||||
@@ -137,19 +125,22 @@ namespace Orchard.Blogs.Controllers {
|
||||
_blogService.Delete(blogPart);
|
||||
|
||||
Services.Notifier.Information(T("Blog was successfully deleted"));
|
||||
|
||||
return Redirect(Url.BlogsForAdmin());
|
||||
}
|
||||
|
||||
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 {
|
||||
Entries = _blogService.Get()
|
||||
.Select(b => Services.ContentManager.BuildDisplayModel(b, "SummaryAdmin"))
|
||||
.Select(vm => new AdminBlogEntry { ContentItemViewModel = vm, TotalPostCount = _blogPostService.Get(vm.Item, VersionOptions.Latest).Count()})
|
||||
};
|
||||
var list = Shape.List();
|
||||
list.AddRange(_blogService.Get()
|
||||
.Select(b => {
|
||||
var blog = Services.ContentManager.BuildDisplayModel(b, "SummaryAdmin.Blog");
|
||||
blog.TotalPostCount = _blogPostService.Get(b, VersionOptions.Latest).Count();
|
||||
return blog;
|
||||
}));
|
||||
|
||||
return View(model);
|
||||
var viewModel = Shape.ViewModel()
|
||||
.ContentItems(list);
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
//TODO: (erikpo) Should move the slug parameter and get call and null check up into a model binder
|
||||
@@ -160,10 +151,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
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 = Services.ContentManager.BuildDisplayModel(blogPart, "DetailAdmin")
|
||||
};
|
||||
|
||||
var model = Services.ContentManager.BuildDisplayModel(blogPart, "Admin.Blog");
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
@@ -3,12 +3,10 @@ using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using System.Xml.Linq;
|
||||
using Orchard.Blogs.Extensions;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Routing;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.Blogs.ViewModels;
|
||||
using Orchard.Core.Feeds;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Mvc.Results;
|
||||
|
||||
@@ -19,22 +17,28 @@ namespace Orchard.Blogs.Controllers {
|
||||
private readonly IBlogSlugConstraint _blogSlugConstraint;
|
||||
private readonly RouteCollection _routeCollection;
|
||||
|
||||
public BlogController(IOrchardServices services, IBlogService blogService, IBlogSlugConstraint blogSlugConstraint, RouteCollection routeCollection) {
|
||||
public BlogController(IOrchardServices services, IBlogService blogService, IBlogSlugConstraint blogSlugConstraint, RouteCollection routeCollection, IShapeHelperFactory shapeHelperFactory) {
|
||||
_services = services;
|
||||
_blogService = blogService;
|
||||
_blogSlugConstraint = blogSlugConstraint;
|
||||
_routeCollection = routeCollection;
|
||||
Logger = NullLogger.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
protected ILogger Logger { get; set; }
|
||||
|
||||
public ActionResult List() {
|
||||
var model = new BlogsViewModel {
|
||||
Blogs = _blogService.Get().Select(b => _services.ContentManager.BuildDisplayModel(b, "Summary"))
|
||||
};
|
||||
var blogs = _blogService.Get().Select(b => _services.ContentManager.BuildDisplayModel(b, "Summary.Blog"));
|
||||
|
||||
return View(model);
|
||||
var list = Shape.List();
|
||||
list.AddRange(blogs);
|
||||
|
||||
var viewModel = Shape.ViewModel()
|
||||
.ContentItems(list);
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
//TODO: (erikpo) Should move the slug parameter and get call and null check up into a model binder
|
||||
@@ -47,11 +51,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (blog == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var model = new BlogViewModel {
|
||||
Blog = _services.ContentManager.BuildDisplayModel(blog, "Detail")
|
||||
};
|
||||
|
||||
|
||||
var model = _services.ContentManager.BuildDisplayModel(blog, "Blog");
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
@@ -1,10 +1,9 @@
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Blogs.Drivers;
|
||||
using Orchard.Blogs.Extensions;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.Blogs.ViewModels;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Mvc.AntiForgery;
|
||||
using Orchard.Mvc.Results;
|
||||
@@ -31,40 +30,44 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.EditBlogPost, T("Not allowed to create blog post")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var blogPost = Services.ContentManager.New<BlogPostPart>(BlogPostPartDriver.ContentType.Name);
|
||||
|
||||
var blogPost = Services.ContentManager.New<BlogPostPart>("BlogPost");
|
||||
if (blogPost.BlogPart == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var model = new CreateBlogPostViewModel {
|
||||
BlogPost = Services.ContentManager.BuildEditorModel(blogPost)
|
||||
};
|
||||
var model = Services.ContentManager.BuildEditorModel(blogPost);
|
||||
|
||||
//todo: (heskew) unhack
|
||||
model.Metadata.Type += ".BlogPost";
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Create(CreateBlogPostViewModel model) {
|
||||
[HttpPost, ActionName("Create")]
|
||||
public ActionResult CreatePOST() {
|
||||
if (!Services.Authorizer.Authorize(Permissions.EditBlogPost, T("Couldn't create blog post")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var blogPost = Services.ContentManager.New<BlogPostPart>(BlogPostPartDriver.ContentType.Name);
|
||||
|
||||
var blogPost = Services.ContentManager.New<BlogPostPart>("BlogPost");
|
||||
if (blogPost.BlogPart == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
Services.ContentManager.Create(blogPost, VersionOptions.Draft);
|
||||
model.BlogPost = Services.ContentManager.UpdateEditorModel(blogPost, this);
|
||||
var model = Services.ContentManager.UpdateEditorModel(blogPost, this);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
return View(model);
|
||||
}
|
||||
|
||||
if (!blogPost.Has<IPublishingControlAspect>())
|
||||
Services.ContentManager.Publish(blogPost.ContentItem);
|
||||
|
||||
Services.Notifier.Information(T("Your {0} has been created.", blogPost.TypeDefinition.DisplayName));
|
||||
return Redirect(Url.BlogPostEdit(model.BlogPost.Item));
|
||||
return Redirect(Url.BlogPostEdit((string)model.Blog.Slug, (int)model.ContentItem.Id));
|
||||
}
|
||||
|
||||
//todo: the content shape template has extra bits that the core contents module does not (remove draft functionality)
|
||||
//todo: - move this extra functionality there or somewhere else that's appropriate?
|
||||
public ActionResult Edit(string blogSlug, int postId) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.EditBlogPost, T("Couldn't edit blog post")))
|
||||
return new HttpUnauthorizedResult();
|
||||
@@ -77,9 +80,10 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (post == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var model = new BlogPostEditViewModel {
|
||||
BlogPost = Services.ContentManager.BuildEditorModel(post)
|
||||
};
|
||||
var model = Services.ContentManager.BuildEditorModel(post);
|
||||
|
||||
//todo: (heskew) unhack
|
||||
model.Metadata.Type += ".BlogPost";
|
||||
|
||||
return View(model);
|
||||
}
|
||||
@@ -99,19 +103,14 @@ namespace Orchard.Blogs.Controllers {
|
||||
return new NotFoundResult();
|
||||
|
||||
// Validate form input
|
||||
var model = new BlogPostEditViewModel {
|
||||
BlogPost = Services.ContentManager.UpdateEditorModel(blogPost, this)
|
||||
};
|
||||
|
||||
TryUpdateModel(model);
|
||||
|
||||
var model = Services.ContentManager.UpdateEditorModel(blogPost, this);
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
return View(model);
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("Your {0} has been saved.", blogPost.TypeDefinition.DisplayName));
|
||||
return Redirect(Url.BlogPostEdit(model.BlogPost.Item));
|
||||
return Redirect(Url.BlogPostEdit((BlogPostPart)model.ContentItem.Get(typeof(BlogPostPart))));
|
||||
}
|
||||
|
||||
[ValidateAntiForgeryTokenOrchard]
|
||||
|
@@ -3,9 +3,9 @@ using System.Web.Mvc;
|
||||
using Orchard.Blogs.Extensions;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.Blogs.ViewModels;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Feeds;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Mvc.Results;
|
||||
using Orchard.Security;
|
||||
@@ -21,14 +21,17 @@ namespace Orchard.Blogs.Controllers {
|
||||
IOrchardServices services,
|
||||
IBlogService blogService,
|
||||
IBlogPostService blogPostService,
|
||||
IFeedManager feedManager) {
|
||||
IFeedManager feedManager,
|
||||
IShapeHelperFactory shapeHelperFactory) {
|
||||
_services = services;
|
||||
_blogService = blogService;
|
||||
_blogPostService = blogPostService;
|
||||
_feedManager = feedManager;
|
||||
T = NullLocalizer.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
public Localizer T { get; set; }
|
||||
|
||||
//TODO: (erikpo) Should think about moving the slug parameters and get calls and null checks up into a model binder or action filter
|
||||
@@ -37,22 +40,16 @@ namespace Orchard.Blogs.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
//TODO: (erikpo) Move looking up the current blog up into a modelbinder
|
||||
BlogPart blogPart = _blogService.Get(blogSlug);
|
||||
|
||||
var blogPart = _blogService.Get(blogSlug);
|
||||
if (blogPart == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
//TODO: (erikpo) Look up the current user and their permissions to this blog post and determine if they should be able to view it or not.
|
||||
VersionOptions versionOptions = VersionOptions.Published;
|
||||
BlogPostPart postPart = _blogPostService.Get(blogPart, postSlug, versionOptions);
|
||||
|
||||
var postPart = _blogPostService.Get(blogPart, postSlug, VersionOptions.Published);
|
||||
if (postPart == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var model = new BlogPostViewModel {
|
||||
BlogPart = blogPart,
|
||||
BlogPost = _services.ContentManager.BuildDisplayModel(postPart, "Detail")
|
||||
};
|
||||
var model = _services.ContentManager.BuildDisplayModel(postPart, "BlogPost");
|
||||
|
||||
return View(model);
|
||||
}
|
||||
@@ -65,15 +62,21 @@ namespace Orchard.Blogs.Controllers {
|
||||
return new NotFoundResult();
|
||||
|
||||
var archive = new ArchiveData(archiveData);
|
||||
var model = new BlogPostArchiveViewModel {
|
||||
BlogPart = blogPart,
|
||||
ArchiveData = archive,
|
||||
BlogPosts = _blogPostService.Get(blogPart, archive).Select(b => _services.ContentManager.BuildDisplayModel(b, "Summary"))
|
||||
};
|
||||
|
||||
var list = Shape.List();
|
||||
list.AddRange(_blogPostService.Get(blogPart, archive).Select(b => _services.ContentManager.BuildDisplayModel(b, "Summary.BlogPost")));
|
||||
|
||||
_feedManager.Register(blogPart);
|
||||
|
||||
return View(model);
|
||||
var viewModel = Shape.ViewModel()
|
||||
.ContentItems(list)
|
||||
.Blog(blogPart)
|
||||
.ArchiveData(archive);
|
||||
|
||||
//todo: (heskew) add back
|
||||
//.ArchiveData(archive) <-- ??
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,107 +1,65 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Routing;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Extensions;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Contents.ViewModels;
|
||||
using Orchard.Core.ContentsLocation.Models;
|
||||
using Orchard.Core.Feeds;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Blogs.Drivers {
|
||||
[UsedImplicitly]
|
||||
public class BlogPartDriver : ContentItemDriver<BlogPart> {
|
||||
public class BlogPartDriver : ContentPartDriver<BlogPart> {
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
public readonly static ContentType ContentType = new ContentType {
|
||||
Name = "Blog",
|
||||
DisplayName = "Blog"
|
||||
};
|
||||
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly IBlogPostService _blogPostService;
|
||||
private readonly IFeedManager _feedManager;
|
||||
|
||||
public BlogPartDriver(IOrchardServices services, IContentManager contentManager, IBlogPostService blogPostService, IFeedManager feedManager) {
|
||||
public BlogPartDriver(IOrchardServices services, IContentManager contentManager, IBlogPostService blogPostService, IFeedManager feedManager, IShapeHelperFactory shapeHelperFactory) {
|
||||
Services = services;
|
||||
_contentManager = contentManager;
|
||||
_blogPostService = blogPostService;
|
||||
_feedManager = feedManager;
|
||||
T = NullLocalizer.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override ContentType GetContentType() {
|
||||
return ContentType;
|
||||
}
|
||||
|
||||
protected override string Prefix { get { return ""; } }
|
||||
|
||||
protected override string GetDisplayText(BlogPart item) {
|
||||
return item.Name;
|
||||
}
|
||||
|
||||
public override RouteValueDictionary GetDisplayRouteValues(BlogPart blogPart) {
|
||||
return new RouteValueDictionary {
|
||||
{"Area", "Orchard.Blogs"},
|
||||
{"Controller", "Blog"},
|
||||
{"Action", "Item"},
|
||||
{"blogSlug", blogPart.Slug}
|
||||
};
|
||||
}
|
||||
|
||||
public override RouteValueDictionary GetEditorRouteValues(BlogPart blogPart) {
|
||||
return new RouteValueDictionary {
|
||||
{"Area", "Orchard.Blogs"},
|
||||
{"Controller", "Blog"},
|
||||
{"Action", "Edit"},
|
||||
{"blogSlug", blogPart.Slug}
|
||||
};
|
||||
}
|
||||
|
||||
protected override DriverResult Display(BlogPart blogPart, string displayType) {
|
||||
|
||||
IEnumerable<ContentItemViewModel<BlogPostPart>> blogPosts = null;
|
||||
if (displayType.StartsWith("DetailAdmin")) {
|
||||
IEnumerable<dynamic > blogPosts = null;
|
||||
if (displayType.StartsWith("Admin")) {
|
||||
blogPosts = _blogPostService.Get(blogPart, VersionOptions.Latest)
|
||||
.Select(bp => _contentManager.BuildDisplayModel(bp, "SummaryAdmin"));
|
||||
.Select(bp => _contentManager.BuildDisplayModel(bp, "SummaryAdmin.BlogPost"));
|
||||
}
|
||||
else if (displayType.StartsWith("Detail")) {
|
||||
else if (!displayType.Contains("Summary")) {
|
||||
blogPosts = _blogPostService.Get(blogPart)
|
||||
.Select(bp => _contentManager.BuildDisplayModel(bp, "Summary"));
|
||||
.Select(bp => _contentManager.BuildDisplayModel(bp, "Summary.BlogPost"));
|
||||
_feedManager.Register(blogPart);
|
||||
}
|
||||
|
||||
var blogPostList = Shape.List();
|
||||
blogPostList.AddRange(blogPosts);
|
||||
|
||||
return Combined(
|
||||
ContentItemTemplate("Items/Blogs.Blog").LongestMatch(displayType, "Summary", "DetailAdmin", "SummaryAdmin"),
|
||||
ContentPartTemplate(blogPart, "Parts/Blogs.Blog.Manage").Location("manage"),
|
||||
ContentPartTemplate(blogPart, "Parts/Blogs.Blog.Metadata").Location("metadata"),
|
||||
ContentPartTemplate(blogPart, "Parts/Blogs.Blog.Description").Location("manage", "after"),
|
||||
blogPosts == null
|
||||
? null
|
||||
: ContentPartTemplate(
|
||||
new ListContentsViewModel {
|
||||
ContainerId = blogPart.Id,
|
||||
Entries = blogPosts.Select(bp => new ListContentsViewModel.Entry {
|
||||
ContentItem = bp.Item.ContentItem,
|
||||
ContentItemMetadata = _contentManager.GetItemMetadata(bp.Item.ContentItem),
|
||||
ViewModel = bp
|
||||
}).ToList()
|
||||
},
|
||||
"Parts/Blogs.BlogPost.List",
|
||||
"").LongestMatch(displayType, "DetailAdmin").Location("primary"));
|
||||
ContentPartTemplate(blogPostList, "Parts/Blogs.BlogPost.List").LongestMatch(displayType, "Admin").Location("primary"));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(BlogPart blogPart) {
|
||||
var location = blogPart.GetLocation("Editor");
|
||||
return Combined(
|
||||
ContentItemTemplate("Items/Blogs.Blog"),
|
||||
ContentPartTemplate(blogPart, "Parts/Blogs.Blog.Fields").Location(location));
|
||||
}
|
||||
|
||||
|
@@ -1,23 +1,16 @@
|
||||
using System.Web.Routing;
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Extensions;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Feeds;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Blogs.Drivers {
|
||||
[UsedImplicitly]
|
||||
public class BlogPostPartDriver : ContentItemDriver<BlogPostPart> {
|
||||
public class BlogPostPartDriver : ContentPartDriver<BlogPostPart> {
|
||||
private readonly IFeedManager _feedManager;
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
public readonly static ContentType ContentType = new ContentType {
|
||||
Name = "BlogPost",
|
||||
DisplayName = "Blog Post"
|
||||
};
|
||||
|
||||
public BlogPostPartDriver(IOrchardServices services, IFeedManager feedManager) {
|
||||
_feedManager = feedManager;
|
||||
Services = services;
|
||||
@@ -26,68 +19,13 @@ namespace Orchard.Blogs.Drivers {
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override ContentType GetContentType() {
|
||||
return ContentType;
|
||||
}
|
||||
|
||||
protected override string Prefix { get { return ""; } }
|
||||
|
||||
protected override string GetDisplayText(BlogPostPart postPart) {
|
||||
return postPart.Title;
|
||||
}
|
||||
|
||||
public override RouteValueDictionary GetDisplayRouteValues(BlogPostPart postPart) {
|
||||
if (postPart.BlogPart == null)
|
||||
return new RouteValueDictionary();
|
||||
|
||||
return new RouteValueDictionary {
|
||||
{"Area", "Orchard.Blogs"},
|
||||
{"Controller", "BlogPost"},
|
||||
{"Action", "Item"},
|
||||
{"blogSlug", postPart.BlogPart.Slug},
|
||||
{"postSlug", postPart.Slug},
|
||||
};
|
||||
}
|
||||
|
||||
public override RouteValueDictionary GetEditorRouteValues(BlogPostPart postPart) {
|
||||
if (postPart.BlogPart == null)
|
||||
return new RouteValueDictionary();
|
||||
|
||||
return new RouteValueDictionary {
|
||||
{"Area", "Orchard.Blogs"},
|
||||
{"Controller", "BlogPostAdmin"},
|
||||
{"Action", "Edit"},
|
||||
{"blogSlug", postPart.BlogPart.Slug},
|
||||
{"postId", postPart.Id},
|
||||
};
|
||||
}
|
||||
|
||||
public override RouteValueDictionary GetCreateRouteValues(BlogPostPart postPart) {
|
||||
if (postPart.BlogPart == null)
|
||||
return new RouteValueDictionary();
|
||||
|
||||
return new RouteValueDictionary {
|
||||
{"Area", "Orchard.Blogs"},
|
||||
{"Controller", "BlogPostAdmin"},
|
||||
{"Action", "Create"},
|
||||
{"blogSlug", postPart.BlogPart.Slug},
|
||||
};
|
||||
}
|
||||
|
||||
protected override DriverResult Display(BlogPostPart part, string displayType) {
|
||||
if (displayType.StartsWith("Detail")) {
|
||||
if (displayType.StartsWith("Detail"))
|
||||
_feedManager.Register(part.BlogPart);
|
||||
}
|
||||
|
||||
return base.Display(part, displayType);
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(BlogPostPart postPart) {
|
||||
return ContentItemTemplate("Items/Blogs.BlogPost");
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(BlogPostPart postPart, IUpdateModel updater) {
|
||||
return Editor(postPart);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,38 +1,53 @@
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.Blogs.ViewModels;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Mvc.Filters;
|
||||
|
||||
namespace Orchard.Blogs.Filters {
|
||||
public class ArchivesFilter : FilterProvider, IResultFilter {
|
||||
private readonly IBlogPostService _blogPostService;
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
private readonly IShapeHelperFactory _shapeHelperFactory;
|
||||
|
||||
public ArchivesFilter(IBlogPostService blogPostService) {
|
||||
public ArchivesFilter(IBlogPostService blogPostService, IWorkContextAccessor workContextAccessor, IShapeHelperFactory shapeHelperFactory) {
|
||||
_blogPostService = blogPostService;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
_shapeHelperFactory = shapeHelperFactory;
|
||||
}
|
||||
|
||||
//todo: make work for real
|
||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||
dynamic model = filterContext.Controller.ViewData.Model;
|
||||
|
||||
var blogViewModel = filterContext.Controller.ViewData.Model as BlogViewModel;
|
||||
if (blogViewModel != null) {
|
||||
blogViewModel.Zones.AddRenderPartial("sidebar", "Archives", new BlogArchivesViewModel { BlogPart = blogViewModel.Blog.Item, Archives = _blogPostService.GetArchives(blogViewModel.Blog.Item) });
|
||||
if (model == null || model.GetType().GetProperty("Metadata") == null || model.Metadata.GetType().GetProperty("Type") == null)
|
||||
return;
|
||||
|
||||
var modelType = model.Metadata.Type;
|
||||
if (string.IsNullOrEmpty(modelType))
|
||||
return;
|
||||
|
||||
var workContext = _workContextAccessor.GetContext(filterContext);
|
||||
var shape = _shapeHelperFactory.CreateHelper();
|
||||
|
||||
if (modelType == "Items_Content_Blog") {
|
||||
BlogPart blog = model.ContentItem.Get(typeof (BlogPart));
|
||||
var blogArchives = shape.BlogArchives()
|
||||
.Archives(new BlogPostArchiveViewModel { BlogPart = blog, Archives = _blogPostService.GetArchives(blog) });
|
||||
workContext.Page.Sidebar.Add(blogArchives);
|
||||
return;
|
||||
}
|
||||
|
||||
var blogPostViewModel = filterContext.Controller.ViewData.Model as BlogPostViewModel;
|
||||
if (blogPostViewModel != null) {
|
||||
blogPostViewModel.Zones.AddRenderPartial("sidebar", "Archives", new BlogArchivesViewModel { BlogPart = blogPostViewModel.BlogPart, Archives = _blogPostService.GetArchives(blogPostViewModel.BlogPart) });
|
||||
return;
|
||||
}
|
||||
|
||||
var blogPostArchiveViewModel = filterContext.Controller.ViewData.Model as BlogPostArchiveViewModel;
|
||||
if (blogPostArchiveViewModel != null) {
|
||||
blogPostArchiveViewModel.Zones.AddRenderPartial("sidebar", "Archives", new BlogArchivesViewModel { BlogPart = blogPostArchiveViewModel.BlogPart, Archives = _blogPostService.GetArchives(blogPostArchiveViewModel.BlogPart) });
|
||||
if (modelType == "Items_Content_BlogPost" || modelType == "BlogPostArchive") {
|
||||
BlogPart blog = model.Blog.ContentItem.Get(typeof (BlogPart));
|
||||
var blogArchives = shape.BlogArchives()
|
||||
.Archives(new BlogPostArchiveViewModel { BlogPart = blog, Archives = _blogPostService.GetArchives(blog) });
|
||||
workContext.Page.Sidebar.Add(blogArchives);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnResultExecuted(ResultExecutedContext filterContext) {
|
||||
}
|
||||
public void OnResultExecuted(ResultExecutedContext filterContext) {}
|
||||
}
|
||||
}
|
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Drivers;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Core.Common.Models;
|
||||
@@ -29,7 +28,7 @@ namespace Orchard.Blogs.Handlers {
|
||||
//INFO: (erikpo) Get all blog posts for the current blog
|
||||
var postsQuery =
|
||||
from bpr in commonRepository.Table
|
||||
where bpr.ContentItemRecord.ContentType.Name == BlogPostPartDriver.ContentType.Name && bpr.Container.Id == blogPostPart.BlogPart.Record.Id
|
||||
where bpr.ContentItemRecord.ContentType.Name == "BlogPost" && bpr.Container.Id == blogPostPart.BlogPart.Record.Id
|
||||
orderby bpr.PublishedUtc
|
||||
select bpr;
|
||||
|
||||
|
@@ -8,6 +8,11 @@ namespace Orchard.Blogs.Handlers {
|
||||
public class BlogPartHandler : ContentHandler {
|
||||
public BlogPartHandler(IRepository<BlogPartRecord> repository) {
|
||||
Filters.Add(StorageFilter.For(repository));
|
||||
|
||||
OnGetDisplayShape<BlogPart>((context, blog) => {
|
||||
context.Model.Description = blog.Description;
|
||||
context.Model.PostCount = blog.PostCount;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@@ -28,6 +28,10 @@ namespace Orchard.Blogs.Handlers {
|
||||
blog.PostCount = postsCount;
|
||||
});
|
||||
|
||||
OnGetDisplayShape<BlogPostPart>(SetModelProperties);
|
||||
OnGetEditorShape<BlogPostPart>(SetModelProperties);
|
||||
OnUpdateEditorShape<BlogPostPart>(SetModelProperties);
|
||||
|
||||
OnInitializing<BlogPostPart>((context, bp) => {
|
||||
var blogSlug = requestContext.RouteData.Values.ContainsKey("blogSlug") ? requestContext.RouteData.Values["blogSlug"] as string : null;
|
||||
if (!string.IsNullOrEmpty(blogSlug)) {
|
||||
@@ -57,6 +61,10 @@ namespace Orchard.Blogs.Handlers {
|
||||
blogPost => context.ContentManager.Remove(blogPost.ContentItem)));
|
||||
}
|
||||
|
||||
private static void SetModelProperties(BuildModelContext context, BlogPostPart blogPost) {
|
||||
context.Model.Blog = blogPost.BlogPart;
|
||||
}
|
||||
|
||||
Localizer T { get; set; }
|
||||
}
|
||||
}
|
@@ -39,6 +39,7 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
@@ -97,17 +98,7 @@
|
||||
<Compile Include="Services\IBlogPostService.cs" />
|
||||
<Compile Include="Services\IBlogService.cs" />
|
||||
<Compile Include="Services\XmlRpcHandler.cs" />
|
||||
<Compile Include="ViewModels\AdminBlogsViewModel.cs" />
|
||||
<Compile Include="ViewModels\BlogArchivesViewModel.cs" />
|
||||
<Compile Include="ViewModels\BlogPostArchiveViewModel.cs" />
|
||||
<Compile Include="ViewModels\BlogViewModel.cs" />
|
||||
<Compile Include="ViewModels\BlogPostViewModel.cs" />
|
||||
<Compile Include="ViewModels\BlogPostEditViewModel.cs" />
|
||||
<Compile Include="ViewModels\BlogsViewModel.cs" />
|
||||
<Compile Include="ViewModels\BlogForAdminViewModel.cs" />
|
||||
<Compile Include="ViewModels\CreateBlogPostViewModel.cs" />
|
||||
<Compile Include="ViewModels\CreateBlogViewModel.cs" />
|
||||
<Compile Include="ViewModels\BlogEditViewModel.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Content\Admin\images\draft.gif" />
|
||||
@@ -119,31 +110,36 @@
|
||||
<Content Include="Scripts\archives.js" />
|
||||
<Content Include="Styles\admin.css" />
|
||||
<Content Include="Styles\archives.css" />
|
||||
<Content Include="Views\Archives.ascx" />
|
||||
<Content Include="Views\BlogPostAdmin\Create.ascx" />
|
||||
<Content Include="Views\BlogPostAdmin\Edit.ascx" />
|
||||
<Content Include="Views\BlogPost\ListByArchive.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Items\Blogs.Blog.DetailAdmin.ascx" />
|
||||
<Content Include="Views\BlogAdmin\Item.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Items\Blogs.Blog.SummaryAdmin.ascx" />
|
||||
<Content Include="Views\Blog\List.ascx" />
|
||||
<Content Include="Views\BlogAdmin\List.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Items\Blogs.BlogPost.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Items\Blogs.BlogPost.Summary.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Items\Blogs.Blog.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.Blog.Manage.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.BlogPost.List.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.BlogPost.List.DetailAdmin.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Items\Blogs.Blog.Summary.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.Blog.Description.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.Blog.Metadata.ascx" />
|
||||
<Content Include="Views\BlogPost\Item.ascx" />
|
||||
<Content Include="Views\BlogAdmin\Create.ascx" />
|
||||
<Content Include="Views\BlogAdmin\Edit.ascx" />
|
||||
<Content Include="Views\Blog\Item.ascx" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Blogs.Blog.Fields.ascx" />
|
||||
<Content Include="Views\EditorTemplates\Items\Blogs.Blog.ascx" />
|
||||
<Content Include="Views\EditorTemplates\Items\Blogs.BlogPost.ascx" />
|
||||
<None Include="Views\BlogArchives.cshtml" />
|
||||
<Content Include="Views\BlogAdmin\Create.cshtml" />
|
||||
<Content Include="Views\BlogAdmin\Edit.cshtml" />
|
||||
<Content Include="Views\BlogAdmin\Item.cshtml" />
|
||||
<Content Include="Views\BlogAdmin\List.cshtml" />
|
||||
<Content Include="Views\BlogPostAdmin\Create.cshtml" />
|
||||
<Content Include="Views\BlogPostAdmin\Edit.cshtml" />
|
||||
<Content Include="Views\BlogPost\Item.cshtml" />
|
||||
<None Include="Views\BlogPost\ListByArchive.cshtml" />
|
||||
<Content Include="Views\Blog\Item.cshtml" />
|
||||
<Content Include="Views\Blog\List.cshtml" />
|
||||
<None Include="Views\DisplayTemplates\Parts\Blogs.Blog.Manage.cshtml" />
|
||||
<None Include="Views\DisplayTemplates\Parts\Blogs.Blog.Description.cshtml" />
|
||||
<None Include="Views\DisplayTemplates\Parts\Blogs.Blog.Metadata.cshtml" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.BlogPost.List.cshtml" />
|
||||
<None Include="Views\EditorTemplates\Parts\Blogs.Blog.Fields.cshtml" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.BlogPost.List.Admin.cshtml">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="Views\Items\Content.Admin.Blog.cshtml" />
|
||||
<Content Include="Views\Items\Content.Blog.cshtml" />
|
||||
<Content Include="Views\Items\Content.BlogPost.cshtml" />
|
||||
<Content Include="Views\Items\Content.Edit.Blog.cshtml">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="Views\Items\Content.Edit.BlogPost.cshtml" />
|
||||
<Content Include="Views\Items\Content.Summary.Blog.cshtml" />
|
||||
<Content Include="Views\Items\Content.Summary.BlogPost.cshtml" />
|
||||
<Content Include="Views\Items\Content.SummaryAdmin.Blog.cshtml" />
|
||||
<Content Include="Views\Items\Content.SummaryAdmin.BlogPost.cshtml" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Views\Web.config" />
|
||||
</ItemGroup>
|
||||
|
@@ -239,6 +239,7 @@ namespace Orchard.Blogs {
|
||||
new MvcRouteHandler())
|
||||
},
|
||||
new RouteDescriptor {
|
||||
Priority = 11,
|
||||
Route = new Route(
|
||||
"{blogSlug}/{postSlug}",
|
||||
new RouteValueDictionary {
|
||||
@@ -255,7 +256,8 @@ namespace Orchard.Blogs {
|
||||
new MvcRouteHandler())
|
||||
},
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
Priority = 11,
|
||||
Route = new Route(
|
||||
"{blogSlug}",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Blogs"},
|
||||
|
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Drivers;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.ContentManagement;
|
||||
@@ -29,7 +28,7 @@ namespace Orchard.Blogs.Services {
|
||||
|
||||
public BlogPostPart Get(BlogPart blogPart, string slug, VersionOptions versionOptions) {
|
||||
return
|
||||
_contentManager.Query(versionOptions, BlogPostPartDriver.ContentType.Name).Join<RoutePartRecord>().Where(rr => rr.Slug == slug).
|
||||
_contentManager.Query(versionOptions, "BlogPost").Join<RoutePartRecord>().Where(rr => rr.Slug == slug).
|
||||
Join<CommonPartRecord>().Where(cr => cr.Container == blogPart.Record.ContentItemRecord).List().
|
||||
SingleOrDefault().As<BlogPostPart>();
|
||||
}
|
||||
@@ -112,7 +111,7 @@ namespace Orchard.Blogs.Services {
|
||||
|
||||
private IContentQuery<ContentItem, CommonPartRecord> GetBlogQuery(ContentPart<BlogPartRecord> blog, VersionOptions versionOptions) {
|
||||
return
|
||||
_contentManager.Query(versionOptions, BlogPostPartDriver.ContentType.Name).Join<CommonPartRecord>().Where(
|
||||
_contentManager.Query(versionOptions, "BlogPost").Join<CommonPartRecord>().Where(
|
||||
cr => cr.Container == blog.Record.ContentItemRecord).OrderByDescending(cr => cr.CreatedUtc);
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,6 @@ using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Routing;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Routable.Models;
|
||||
|
||||
@@ -31,14 +30,6 @@ namespace Orchard.Blogs.Services {
|
||||
.List();
|
||||
}
|
||||
|
||||
public void Create(BlogPart blogPart) {
|
||||
_contentManager.Create(blogPart.ContentItem);
|
||||
}
|
||||
|
||||
public void Edit(BlogPart blogPart) {
|
||||
_blogSlugConstraint.AddSlug(blogPart.Slug);
|
||||
}
|
||||
|
||||
public void Delete(BlogPart blogPart) {
|
||||
_contentManager.Remove(blogPart.ContentItem);
|
||||
_blogSlugConstraint.RemoveSlug(blogPart.Slug);
|
||||
|
@@ -5,8 +5,6 @@ namespace Orchard.Blogs.Services {
|
||||
public interface IBlogService : IDependency {
|
||||
BlogPart Get(string slug);
|
||||
IEnumerable<BlogPart> Get();
|
||||
void Create(BlogPart blogPart);
|
||||
void Edit(BlogPart blogPart);
|
||||
void Delete(BlogPart blogPart);
|
||||
}
|
||||
}
|
@@ -3,7 +3,6 @@ using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Drivers;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
@@ -165,7 +164,7 @@ namespace Orchard.Blogs.Services {
|
||||
var description = content.Optional<string>("description");
|
||||
var slug = content.Optional<string>("wp_slug");
|
||||
|
||||
var blogPost = _contentManager.New<BlogPostPart>(BlogPostPartDriver.ContentType.Name);
|
||||
var blogPost = _contentManager.New<BlogPostPart>("BlogPost");
|
||||
|
||||
// BodyPart
|
||||
if (blogPost.Is<BodyPart>()) {
|
||||
|
@@ -1,14 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class AdminBlogsViewModel : BaseViewModel {
|
||||
public IEnumerable<AdminBlogEntry> Entries { get; set; }
|
||||
}
|
||||
|
||||
public class AdminBlogEntry {
|
||||
public ContentItemViewModel<BlogPart> ContentItemViewModel { get; set; }
|
||||
public int TotalPostCount { get; set; }
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Blogs.Models;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class BlogArchivesViewModel {
|
||||
public BlogPart BlogPart { get; set; }
|
||||
public IEnumerable<KeyValuePair<ArchiveData, int>> Archives { get; set; }
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class BlogEditViewModel : BaseViewModel {
|
||||
public ContentItemViewModel<BlogPart> Blog { get; set; }
|
||||
public bool PromoteToHomePage { get; set; }
|
||||
}
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class BlogForAdminViewModel : BaseViewModel {
|
||||
public ContentItemViewModel<BlogPart> Blog { get; set; }
|
||||
}
|
||||
}
|
@@ -1,11 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class BlogPostArchiveViewModel : BaseViewModel {
|
||||
public class BlogPostArchiveViewModel {
|
||||
public BlogPart BlogPart { get; set; }
|
||||
public ArchiveData ArchiveData { get; set; }
|
||||
public IEnumerable<ContentItemViewModel<BlogPostPart>> BlogPosts { get; set; }
|
||||
public IEnumerable<KeyValuePair<ArchiveData, int>> Archives { get; set; }
|
||||
}
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class BlogPostEditViewModel : BaseViewModel {
|
||||
public ContentItemViewModel<BlogPostPart> BlogPost { get; set; }
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class BlogPostViewModel : BaseViewModel {
|
||||
public BlogPart BlogPart { get; set; }
|
||||
public ContentItemViewModel<BlogPostPart> BlogPost { get; set; }
|
||||
}
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class BlogViewModel : BaseViewModel {
|
||||
public ContentItemViewModel<BlogPart> Blog { get; set; }
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class BlogsViewModel : BaseViewModel {
|
||||
public IEnumerable<ContentItemViewModel<BlogPart>> Blogs { get; set; }
|
||||
}
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class CreateBlogPostViewModel : BaseViewModel {
|
||||
public ContentItemViewModel<BlogPostPart> BlogPost { get; set; }
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class CreateBlogViewModel : BaseViewModel {
|
||||
public ContentItemViewModel<BlogPart> Blog { get; set; }
|
||||
//public bool PromoteToHomePage { get; set; }
|
||||
}
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" Inherits="Orchard.Mvc.ViewUserControl<BlogArchivesViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<% Html.RegisterStyle("archives.css"); %>
|
||||
<% Html.RegisterFootScript("archives.js"); %>
|
||||
<div class="archives">
|
||||
<h3><%: T("Archives") %></h3><%
|
||||
if (Model.Archives.Count() > 0) {
|
||||
if (Model.Archives.Count() > 20) { %>
|
||||
<ul class="years"><%
|
||||
int lastYear = Model.Archives.First().Key.Year;
|
||||
int firstYear = Model.Archives.Last().Key.Year;
|
||||
|
||||
for (int year = lastYear; year >= firstYear; year--) {
|
||||
var yearMonths = Model.Archives.Where(m => m.Key.Year == year);
|
||||
|
||||
if (year == lastYear) { %>
|
||||
<li>
|
||||
<h4><%=year %></h4><%
|
||||
}
|
||||
else { %>
|
||||
<li class="previous">
|
||||
<h4><%=year %> <span>(<%=yearMonths.Sum(ym => ym.Value) %>)</span></h4><%
|
||||
} %>
|
||||
<%: Html.UnorderedList(yearMonths, (t, i) => Html.Link(string.Format("{0:MMMM} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth(Model.BlogPart.Slug, t.Key.Year, t.Key.Month)), "archiveMonthList") %>
|
||||
</li><%
|
||||
} %>
|
||||
</ul><%
|
||||
}
|
||||
else { %>
|
||||
<%: Html.UnorderedList(Model.Archives, (t, i) => Html.Link(string.Format("{0:MMMM yyyy} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth(Model.BlogPart.Slug, t.Key.Year, t.Key.Month)), "archiveMonthList") %><%
|
||||
}
|
||||
}
|
||||
else { %>
|
||||
<div class="message info"><%: T("None found")%></div><%
|
||||
} %>
|
||||
</div>
|
@@ -1,3 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BlogViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<%: Html.DisplayForItem(m => m.Blog) %>
|
@@ -0,0 +1 @@
|
||||
@Display(Model)
|
@@ -1,8 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BlogsViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<%if (Model.Blogs.Count() > 0) { %>
|
||||
<%: Html.UnorderedList(Model.Blogs, (b, i) => Html.DisplayForItem(b), "blogs contentItems") %><%
|
||||
}
|
||||
else { %>
|
||||
<p><%: T("No blogs found.") %></p><%
|
||||
} %>
|
@@ -0,0 +1,4 @@
|
||||
@Display(Model.ContentItems)
|
||||
@if (Model.ContentItems.Items.Count < 1) {
|
||||
<p>@T("No blogs found.")</p>
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<CreateBlogViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<h1><%: Html.TitleForPage(T("Create New Blog").ToString()) %></h1>
|
||||
<% using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%: Html.ValidationSummary() %>
|
||||
<%: Html.EditorForItem(vm => vm.Blog) %><%
|
||||
} %>
|
@@ -0,0 +1,5 @@
|
||||
<h1>@Html.TitleForPage(T("Create New Blog").ToString())</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
@Display(Model)
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BlogEditViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<h1><%: Html.TitleForPage(T("Blog Properties").ToString()) %></h1>
|
||||
<% using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%: Html.ValidationSummary() %>
|
||||
<%: Html.EditorForItem(m => m.Blog) %><%
|
||||
} %>
|
@@ -0,0 +1,5 @@
|
||||
<h1>@Html.TitleForPage(T("Blog Properties").ToString())</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
@Display(Model)
|
||||
}
|
@@ -1,4 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BlogForAdminViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<% Html.AddTitleParts(T("Manage Blog").ToString()); %>
|
||||
<%: Html.DisplayForItem(m => m.Blog) %>
|
@@ -0,0 +1,4 @@
|
||||
@{
|
||||
Html.AddTitleParts(T("Manage Blog").ToString());
|
||||
}
|
||||
@Display(Model)
|
@@ -1,30 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<AdminBlogsViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<h1><%: Html.TitleForPage(T("Manage Blogs").ToString()) %></h1>
|
||||
<%-- todo: Add helper text here when ready. <p><%: T("Possible text about setting up and managing a blog goes here.") %></p> --%><%
|
||||
if (Model.Entries.Count() > 0) { %>
|
||||
<div class="actions"><a class="add button primaryAction" href="<%: Url.BlogCreate() %>"><%: T("New Blog") %></a></div>
|
||||
<%: Html.UnorderedList(Model.Entries, (entry, i) => {
|
||||
// Add blog post count rendering into "meta" zone
|
||||
entry.ContentItemViewModel.Zones.AddAction("meta:after", html => {
|
||||
int draftCount = entry.TotalPostCount - entry.ContentItemViewModel.Item.PostCount;
|
||||
int totalPostCount = entry.TotalPostCount;
|
||||
|
||||
var linkText = T.Plural("1 post", "{0} posts", totalPostCount).ToString();
|
||||
if (draftCount > 0){
|
||||
linkText = linkText + " (" + T.Plural("1 draft", "{0} drafts", draftCount).ToString() + ")";
|
||||
}
|
||||
|
||||
if (entry.ContentItemViewModel.Zones["meta"].Items.Count > 1)
|
||||
html.ViewContext.Writer.Write(" | ");
|
||||
|
||||
html.ViewContext.Writer.Write(html.Link(linkText, Url.BlogForAdmin(entry.ContentItemViewModel.Item.Slug)));
|
||||
});
|
||||
|
||||
// Display the summary for the blog post
|
||||
return Html.DisplayForItem(entry.ContentItemViewModel);
|
||||
}, "blogs contentItems")%><%
|
||||
} else { %>
|
||||
<div class="info message"><%:T("There are no blogs for you to see. Want to <a href=\"{0}\">add one</a>?", Url.BlogCreate())%></div><%
|
||||
} %>
|
@@ -0,0 +1,8 @@
|
||||
@using Orchard.Blogs.Extensions
|
||||
<h1>@Html.TitleForPage(T("Manage Blogs").ToString())</h1>
|
||||
@if (Model.ContentItems.Items.Count > 0) {
|
||||
<div class="actions"><a class="add button primaryAction" href="@Url.BlogCreate()">@T("New Blog")</a></div>
|
||||
@Display(Model.ContentItems)
|
||||
} else {
|
||||
<div class="info message">@T("There are no blogs for you to see. Want to <a href=\"{0}\">add one</a>?", Url.BlogCreate())</div>
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
@using Orchard.Blogs.Extensions
|
||||
@using Orchard.Blogs.ViewModels
|
||||
@{
|
||||
BlogPostArchiveViewModel model = Model.Archives;
|
||||
}
|
||||
@//todo: IResourceManager -> Html.RegisterStyle("archives.css");
|
||||
@//todo: IResourceManager -> Html.RegisterFootScript("archives.js");
|
||||
<div class="archives">
|
||||
<h3>@T("Archives")</h3>
|
||||
@if (model.Archives.Count() > 0) {
|
||||
/* todo: need to fix up this syntax
|
||||
if (Model.Archives.Count() > 20) {
|
||||
<ul class="years">
|
||||
int lastYear = Model.Archives.First().Key.Year;
|
||||
int firstYear = Model.Archives.Last().Key.Year;
|
||||
|
||||
for (int year = lastYear; year >= firstYear; year--) {
|
||||
var yearMonths = Model.Archives.Where(m => m.Key.Year == year);
|
||||
|
||||
if (year == lastYear) {
|
||||
<li>
|
||||
<h4>@year</h4>
|
||||
} else {
|
||||
<li class="previous">
|
||||
<h4>@year <span>(@yearMonths.Sum(ym => ym.Value))</span></h4>
|
||||
}
|
||||
@Html.UnorderedList(yearMonths, (t, i) => Html.Link(string.Format("{0:MMMM} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth(Model.BlogPart.Slug, t.Key.Year, t.Key.Month)), "archiveMonthList")
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
} else {
|
||||
*/
|
||||
@Html.UnorderedList(model.Archives, (t, i) => Html.Link(string.Format("{0:MMMM yyyy} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth(model.BlogPart.Slug, t.Key.Year, t.Key.Month)), "archiveMonthList")
|
||||
/*
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
<div class="message info">@T("None found")</div>
|
||||
}
|
||||
</div>
|
@@ -1,4 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BlogPostViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<% Html.AddTitleParts(Model.BlogPart.Name); %>
|
||||
<%: Html.DisplayForItem(m => m.BlogPost) %>
|
@@ -0,0 +1,4 @@
|
||||
@{
|
||||
Html.AddTitleParts((string)Model.Title);
|
||||
}
|
||||
@Display(Model)
|
@@ -1,14 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BlogPostArchiveViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<h1 class="page-title"><%: Html.TitleForPage(T("Archives").ToString(), Model.ArchiveData.Year.ToString(), Model.ArchiveData.Month > 0 ? new DateTime(Model.ArchiveData.Year, Model.ArchiveData.Month, 1).ToString("MMMM") : null, Model.ArchiveData.Day > 0 ? Model.ArchiveData.Day.ToString() : null)%></h1>
|
||||
|
||||
<div class="archive-trail">
|
||||
<%: T("Archives").ToString()
|
||||
%> / <%: Html.Link(Model.ArchiveData.Year.ToString(), Url.BlogArchiveYear(Model.BlogPart.Slug, Model.ArchiveData.Year))
|
||||
%><%=Model.ArchiveData.Month > 0 ? string.Format(" / {0}", Html.Link(Model.ArchiveData.ToDateTime().ToString("MMMM"), Url.BlogArchiveMonth(Model.BlogPart.Slug, Model.ArchiveData.Year, Model.ArchiveData.Month))) : ""
|
||||
%><%=Model.ArchiveData.Day > 0 ? string.Format(" / {0}", Html.Link(Model.ArchiveData.Day.ToString(), Url.BlogArchiveDay(Model.BlogPart.Slug, Model.ArchiveData.Year, Model.ArchiveData.Month, Model.ArchiveData.Day))) : ""
|
||||
%>
|
||||
</div>
|
||||
|
||||
<%: Html.UnorderedList(Model.BlogPosts, (c, i) => Html.DisplayForItem(c), "blogPosts contentItems")%>
|
@@ -0,0 +1,9 @@
|
||||
@using Orchard.Blogs.Extensions
|
||||
<h1 class="page-title">@Html.TitleForPage(T("Archives").Text, (string)Model.ArchiveData.Year.ToString(), (string)(Model.ArchiveData.Month > 0 ? new DateTime(Model.ArchiveData.Year, Model.ArchiveData.Month, 1).ToString("MMMM") : null), (string)(Model.ArchiveData.Day > 0 ? Model.ArchiveData.Day.ToString() : null))</h1>
|
||||
<div class="archive-trail">
|
||||
@T("Archives") /
|
||||
@Html.Link((string)Model.ArchiveData.Year.ToString(), Url.BlogArchiveYear((string)Model.Blog.Slug, (int)Model.ArchiveData.Year))
|
||||
@(new MvcHtmlString(Model.ArchiveData.Month > 0 ? string.Format(" / {0}", Html.Link((string)Model.ArchiveData.ToDateTime().ToString("MMMM"), Url.BlogArchiveMonth((string)Model.Blog.Slug,(int) Model.ArchiveData.Year, (int)Model.ArchiveData.Month))) : ""))
|
||||
@(new MvcHtmlString(Model.ArchiveData.Day > 0 ? string.Format(" / {0}", Html.Link((string)Model.ArchiveData.Day.ToString(), Url.BlogArchiveDay((string)Model.Blog.Slug, (int)Model.ArchiveData.Year, (int)Model.ArchiveData.Month, (int)Model.ArchiveData.Day))) : ""))
|
||||
</div>
|
||||
@Display(Model.ContentItems)
|
@@ -1,7 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<CreateBlogPostViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<h1><%: Html.TitleForPage(T("Create New Blog Post").ToString()) %></h1>
|
||||
<% using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%: Html.ValidationSummary() %>
|
||||
<%: Html.EditorForItem(m => m.BlogPost) %><%
|
||||
} %>
|
@@ -0,0 +1,5 @@
|
||||
<h1>@Html.TitleForPage(T("Create New Blog Post").ToString())</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
@Display(Model)
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BlogPostEditViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<h1><%: Html.TitleForPage(T("Edit Blog Post").ToString()) %></h1>
|
||||
<% using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%: Html.ValidationSummary() %>
|
||||
<%: Html.EditorForItem(m => m.BlogPost) %><%
|
||||
} %>
|
@@ -0,0 +1,5 @@
|
||||
<h1>@Html.TitleForPage(T("Edit Blog Post").ToString())</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
@Display(Model)
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<BlogPart>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<h1><a href="<%: Url.BlogForAdmin(Model.Item.Slug) %>"><%: Html.TitleForPage(Model.Item.Name) %></a></h1>
|
||||
<% Html.Zone("manage"); %>
|
||||
<div class="manage"><a href="<%: Url.BlogPostCreate(Model.Item) %>" class="add button primaryAction"><%: T("New Post")%></a></div>
|
||||
<% Html.Zone("primary"); %>
|
@@ -1,7 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<BlogPart>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<h2><%: Html.Link(Model.Item.Name, Url.Blog(Model.Item.Slug)) %></h2>
|
||||
<% if (!string.IsNullOrEmpty(Model.Item.Description)) { %><p><%: Model.Item.Description %></p><% } %>
|
||||
<div class="blog metadata"><%: T.Plural("1 post", "{0} posts", Model.Item.PostCount)%> | <%Html.Zone("meta");%></div>
|
@@ -1,23 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<BlogPart>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<div class="summary">
|
||||
<div class="related">
|
||||
<a href="<%: Url.Blog(Model.Item.Slug) %>" title="<%: T("View") %>"><%: T("View") %></a><%: T(" | ")%>
|
||||
<a href="<%: Url.BlogForAdmin(Model.Item.Slug) %>" title="<%: T("List Posts") %>"><%: T("List Posts")%></a><%: T(" | ")%>
|
||||
<a href="<%: Url.BlogPostCreate(Model.Item) %>" title="<%: T("New Post") %>"><%: T("New Post") %></a><%: T(" | ")%>
|
||||
<a href="<%: Url.BlogEdit(Model.Item.Slug) %>" title="<%: T("Edit") %>"><%: T("Edit")%></a><%: T(" | ")%>
|
||||
<%-- todo: (heskew) this is waaaaa too verbose. need template helpers for all ibuttons --%>
|
||||
<% using (Html.BeginFormAntiForgeryPost(Url.BlogRemove(Model.Item.Slug), FormMethod.Post, new { @class = "inline link" })) { %>
|
||||
<button type="submit" class="linkButton" title="<%: T("Remove") %>"><%: T("Remove") %></button><%
|
||||
} %>
|
||||
</div>
|
||||
<div class="properties">
|
||||
<h3><%: Html.Link(Model.Item.Name, Url.BlogForAdmin(Model.Item.Slug)) %></h3>
|
||||
<p><% Html.Zone("meta");%></p>
|
||||
<%--<p>[list of authors] [modify blog access]</p>--%>
|
||||
<p><%: Model.Item.Description %></p>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
@@ -1,10 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<BlogPart>>" %>
|
||||
<%@ Import Namespace="Orchard.UI.Resources"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<h1><%: Html.TitleForPage(Model.Item.Name) %></h1>
|
||||
<% Html.RegisterLink(new LinkEntry { Rel = "wlwmanifest", Type = "application/wlwmanifest+xml", Href = Url.BlogLiveWriterManifest(Model.Item.Slug) });%>
|
||||
<% Html.RegisterLink(new LinkEntry { Rel = "EditURI", Type = "application/rsd+xml", Title = "RSD", Href = Url.BlogRsd(Model.Item.Slug) });%>
|
||||
<% Html.Zone("primary", ":manage :metadata");
|
||||
Html.ZonesAny(); %>
|
@@ -1,12 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<BlogPostPart>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<%@ Import Namespace="Orchard.Core.Common.Extensions" %>
|
||||
<%@ Import Namespace="Orchard.Core.Common.Models" %>
|
||||
<%@ Import Namespace="Orchard.ContentManagement" %>
|
||||
<%@ Import Namespace="Orchard.Core.Common.ViewModels" %>
|
||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
||||
<h2><%: Html.Link(Model.Item.Title, Url.BlogPost(Model.Item)) %></h2>
|
||||
<div class="meta"><%: Html.PublishedState(new CommonMetadataViewModel(Model.Item.As<CommonPart>()), T) %> | <%Html.Zone("meta");%></div>
|
||||
<div class="content"><% Html.Zone("primary", ":manage :metadata");%></div>
|
@@ -1,6 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<BlogPostPart>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<h1><%: Html.TitleForPage(Model.Item.Title)%></h1>
|
||||
<% Html.Zone("primary", ":manage :metadata");
|
||||
Html.ZonesAny(); %>
|
@@ -1,5 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BlogPart>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<div class="blog-description">
|
||||
<p><%: Model.Description %></p>
|
||||
</div>
|
@@ -0,0 +1,3 @@
|
||||
<div class="blog-description">
|
||||
<p>@Model.Description</p>
|
||||
</div>
|
@@ -1,10 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BlogPart>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%><%
|
||||
Html.RegisterStyle("admin.css");
|
||||
if (AuthorizedFor(Permissions.ManageBlogs)) { %>
|
||||
<div class="item-properties actions">
|
||||
<p><a href="<%: Url.BlogEdit(Model.Slug) %>" class="edit"><%: T("Blog Properties") %></a></p>
|
||||
</div><%
|
||||
} %>
|
@@ -0,0 +1,7 @@
|
||||
@using Orchard.Blogs.Extensions
|
||||
@if (AuthorizedFor(Orchard.Blogs.Permissions.ManageBlogs)) {
|
||||
//todo: IResourceManager -> Html.RegisterStyle("admin.css");
|
||||
<div class="item-properties actions">
|
||||
<p><a href="@Url.BlogEdit((string)Model.Slug)" class="edit">@T("Blog Properties")</a></p>
|
||||
</div>
|
||||
}
|
@@ -1,2 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BlogPart>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
@@ -0,0 +1 @@
|
||||
[[metadata??]]
|
@@ -0,0 +1,22 @@
|
||||
@using Orchard.Core.Contents.ViewModels
|
||||
@using Orchard.Utility.Extensions
|
||||
@if (Model.Items.Count > 0) {
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("List", "Admin", new { area = "Contents", id = "" }))) {
|
||||
<fieldset class="bulk-actions">
|
||||
<label for="publishActions">@T("Actions:")</label>
|
||||
<select id="publishActions" name="Options.BulkAction">
|
||||
@Html.SelectOption(ContentsBulkAction.None, ContentsBulkAction.None, T("Choose action...").ToString())
|
||||
@Html.SelectOption(ContentsBulkAction.None, ContentsBulkAction.PublishNow, T("Publish Now").ToString())
|
||||
@Html.SelectOption(ContentsBulkAction.None, ContentsBulkAction.Unpublish, T("Unpublish").ToString())
|
||||
@Html.SelectOption(ContentsBulkAction.None, ContentsBulkAction.Remove, T("Remove").ToString())
|
||||
</select>
|
||||
@Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString())
|
||||
<button type="submit" name="submit.BulkEdit" value="yes">@T("Apply")</button>
|
||||
</fieldset>
|
||||
<fieldset class="contentItems bulk-items">
|
||||
@Display(Model)
|
||||
</fieldset>
|
||||
}
|
||||
} else {
|
||||
<div class="info message">@T("There are no posts for this blog.")</div>
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ListContentsViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
||||
<%@ Import Namespace="Orchard.Utility.Extensions" %>
|
||||
<%
|
||||
if (Model.Entries.Count() < 1) { %>
|
||||
<div class="info message"><%:T("There are no posts for this blog.") %></div><%
|
||||
}
|
||||
else {
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("List", "Admin", new { area = "Contents", id = "" }))) { %>
|
||||
<fieldset class="bulk-actions">
|
||||
<label for="publishActions"><%:T("Actions:") %></label>
|
||||
<select id="publishActions" name="<%:Html.NameOf(m => m.Options.BulkAction) %>">
|
||||
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.None, T("Choose action...").ToString()) %>
|
||||
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.PublishNow, T("Publish Now").ToString()) %>
|
||||
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.Unpublish, T("Unpublish").ToString()) %>
|
||||
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.Remove, T("Remove").ToString()) %>
|
||||
</select>
|
||||
<%:Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString()) %>
|
||||
<button type="submit" name="submit.BulkEdit" value="yes"><%:T("Apply") %></button>
|
||||
</fieldset>
|
||||
<fieldset class="contentItems bulk-items">
|
||||
<%:Html.UnorderedList(
|
||||
Model.Entries,
|
||||
(entry, i) => Html.DisplayForItem(entry.ViewModel),
|
||||
"") %>
|
||||
</fieldset><%
|
||||
}
|
||||
} %>
|
@@ -1,3 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Contents.ViewModels.ListContentsViewModel>" %>
|
||||
<%: Html.UnorderedList(Model.Entries, (bp, i) => Html.DisplayForItem(bp.ViewModel), "blogPosts contentItems") %>
|
||||
<% if (Model.Entries.Count() < 1) { %><p><%: T("There are no posts for this blog.") %></p><% } %>
|
@@ -0,0 +1,4 @@
|
||||
@Display(Model)
|
||||
@if (Model.Items.Count < 1) {
|
||||
<p>@T("There are no posts for this blog.")</p>
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<BlogPart>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<% Html.AddTitleParts(Model.Item.Name); %>
|
||||
<% Html.Zone("primary"); %>
|
||||
<% Html.ZonesAny(); %>
|
||||
<fieldset><input class="button primaryAction" type="submit" value="<%: T("Add") %>" /></fieldset>
|
@@ -1,20 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<BlogPostPart>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<% Html.AddTitleParts(Model.Item.Title); %>
|
||||
<div class="sections">
|
||||
<div class="primary"><%
|
||||
Html.Zone("primary");
|
||||
Html.ZonesExcept("secondary"); %>
|
||||
</div>
|
||||
<div class="secondary">
|
||||
<% Html.Zone("secondary");%>
|
||||
<fieldset>
|
||||
<input class="button primaryAction" type="submit" name="submit.Save" value="<%: T("Save") %>"/><%
|
||||
//TODO: (erikpo) In the future, remove the HasPublished check so the user can delete the content item from here if the choose to
|
||||
if (Model.Item.HasDraft && Model.Item.HasPublished) { %>
|
||||
<%: Html.AntiForgeryTokenValueOrchardLink(T("Discard Draft").ToString(), Url.Action("DiscardDraft", new {Area = "Orchard.Blogs", Controller = "BlogPostAdmin", id = Model.Item.Id}), new {@class = "button"})%><%
|
||||
} %>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
@@ -1,6 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BlogPart>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<fieldset>
|
||||
<%: Html.LabelFor(m => m.Description) %>
|
||||
<%: Html.TextAreaFor(m => m.Description, 5, 60, null) %>
|
||||
</fieldset>
|
@@ -0,0 +1,5 @@
|
||||
@model Orchard.Blogs.Models.BlogPart
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.Description)
|
||||
@Html.TextAreaFor(m => m.Description, 5, 60, null)
|
||||
</fieldset>
|
@@ -0,0 +1,7 @@
|
||||
@using Orchard.Blogs.Extensions
|
||||
@using Orchard.Blogs.Models
|
||||
<h1><a href="@Url.BlogForAdmin((string)Model.Slug)">@Html.TitleForPage((string)Model.Title)</a></h1>
|
||||
@Display(Model.manage)
|
||||
<div class="manage"><a href="@Url.BlogPostCreate((BlogPart)Model.ContentItem.Get(typeof(BlogPart)))" class="add button primaryAction">@T("New Post")</a></div>
|
||||
@Display(Model.metadata)
|
||||
@Display(Model.primary)
|
@@ -0,0 +1,10 @@
|
||||
@using Orchard.Blogs.Extensions
|
||||
@using Orchard.UI.Resources
|
||||
@{
|
||||
Html.RegisterLink(new LinkEntry { Rel = "wlwmanifest", Type = "application/wlwmanifest+xml", Href = Url.BlogLiveWriterManifest((string)Model.Slug) });
|
||||
Html.RegisterLink(new LinkEntry { Rel = "EditURI", Type = "application/rsd+xml", Title = "RSD", Href = Url.BlogRsd((string)Model.Slug) });
|
||||
}
|
||||
<h1>@Html.TitleForPage((string)Model.Title)</h1>
|
||||
@Display(Model.manage)
|
||||
@Display(Model.metadata)
|
||||
@Display(Model.primary)
|
@@ -0,0 +1,3 @@
|
||||
<h1>@Html.TitleForPage((string)Model.Title)</h1>
|
||||
@Display(Model.metadata)
|
||||
@Display(Model.primary)
|
@@ -0,0 +1,4 @@
|
||||
@Html.AddTitleParts(Model.Title)
|
||||
@Display(Model.primary)
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!111 Content.Edit.Blog !!!!!!!!!!!!!!!!!!!!!!!!11
|
||||
<fieldset><input class="button primaryAction" type="submit" value="@T("Add")" /></fieldset>
|
@@ -0,0 +1,20 @@
|
||||
@using Orchard.Blogs.Models
|
||||
@{
|
||||
Html.AddTitleParts((string)Model.Title);
|
||||
BlogPostPart blogPost = Model.ContentItem.Get(typeof(BlogPostPart));
|
||||
}
|
||||
<div class="sections">
|
||||
<div class="primary">
|
||||
@Display(Model.primary)
|
||||
</div>
|
||||
<div class="secondary">
|
||||
@Display(Model.secondary)
|
||||
<fieldset>
|
||||
<input class="button primaryAction" type="submit" name="submit.Save" value="@T("Save")"/>
|
||||
@//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"})
|
||||
}
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,7 @@
|
||||
@using Orchard.Blogs.Extensions
|
||||
@using Orchard.Blogs.Models
|
||||
<h2>@Html.Link((string)Model.Title, Url.Blog((string)Model.Slug))</h2>
|
||||
@if (!string.IsNullOrEmpty((string)Model.Description)) {
|
||||
<p>@Model.Description</p>
|
||||
}
|
||||
<div class="blog metadata">@T.Plural("1 post", "{0} posts", (int)Model.PostCount) | @Display(Model.meta)</div>
|
@@ -0,0 +1,8 @@
|
||||
@using Orchard.Blogs.Extensions
|
||||
@using Orchard.Blogs.Models
|
||||
@using Orchard.Core.Common.Extensions
|
||||
@using Orchard.Core.Common.Models
|
||||
@using Orchard.Core.Common.ViewModels
|
||||
<h2>@Html.Link((string)Model.Title, Url.BlogPost((BlogPostPart)Model.ContentItem.Get(typeof(BlogPostPart))))</h2>
|
||||
<div class="meta">@Html.PublishedState(new CommonMetadataViewModel((CommonPart)Model.ContentItem.Get(typeof(CommonPart))), T) | @Display(Model.meta)</div>
|
||||
<div class="content">@Display(Model.primary)</div>
|
@@ -0,0 +1,21 @@
|
||||
@using Orchard.Blogs.Extensions
|
||||
@using Orchard.Blogs.Models
|
||||
<div class="summary">
|
||||
<div class="related">
|
||||
<a href="@Url.Blog((string)Model.Slug)" title="@T("View")">@T("View")</a>@T(" | ")
|
||||
<a href="@Url.BlogForAdmin((string)Model.Slug)" title="@T("List Posts")">@T("List Posts")</a>@T(" | ")
|
||||
<a href="@Url.BlogPostCreate((BlogPart)Model.ContentItem.Get(typeof(BlogPart)))" title="@T("New Post")">@T("New Post")</a>@T(" | ")
|
||||
<a href="@Url.BlogEdit((string)Model.Slug)" title="@T("Edit")">@T("Edit")</a>@T(" | ")
|
||||
@//todo: (heskew) this is a bit too verbose. need template helpers for all ibuttons
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.BlogRemove((string)Model.Slug), FormMethod.Post, new { @class = "inline link" })) {
|
||||
<button type="submit" class="linkButton" title="@T("Remove")">@T("Remove")</button>
|
||||
}
|
||||
</div>
|
||||
<div class="properties">
|
||||
<h3>@Html.Link((string)Model.Title, Url.BlogForAdmin((string)Model.Slug))</h3>
|
||||
<p>@Display(Model.meta)</p>
|
||||
@//<p>[list of authors] [modify blog access]</p>
|
||||
<p>@Model.Description</p>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
@@ -0,0 +1,22 @@
|
||||
@using Orchard.Blogs.Extensions
|
||||
@using Orchard.Blogs.Models
|
||||
@using Orchard.ContentManagement
|
||||
@using Orchard.Utility.Extensions
|
||||
@{
|
||||
ContentItem contentItem = Model.ContentItem;
|
||||
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
|
||||
}
|
||||
|
||||
<div class="summary" itemscope="itemscope" itemid="@contentItem.Id" itemtype="http://orchardproject.net/data/ContentItem">
|
||||
<div class="properties">
|
||||
<input type="checkbox" value="@contentItem.Id" name="itemIds"/>
|
||||
<h3>@Html.Link((string)Model.Title, Url.BlogPost((BlogPostPart)Model.ContentItem.Get(typeof(BlogPostPart))))</h3>
|
||||
<div class="metadata">@Display(Model.metadata)</div>
|
||||
</div>
|
||||
<div class="related">@Display(Model.secondary)
|
||||
@Html.Link(T("Edit").Text, Url.BlogPost((BlogPostPart)Model.ContentItem.Get(typeof(BlogPostPart)))) @T(" | ")
|
||||
@Html.Link(T("Remove").Text, Url.Action("Remove", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl }), new { itemprop = "RemoveUrl UnsafeUrl" })
|
||||
<br />@Display(Model.meta)
|
||||
</div>
|
||||
<div class="primary">@Display(Model.primary)</div>
|
||||
</div>
|
@@ -65,15 +65,15 @@ namespace Orchard.Setup.Services {
|
||||
"Orchard.Framework",
|
||||
"Common",
|
||||
"Shapes",
|
||||
//"PublishLater",
|
||||
"PublishLater",
|
||||
"Contents",
|
||||
//"ContentsLocation",
|
||||
"Dashboard",
|
||||
"Reports",
|
||||
//"Feeds",
|
||||
"Feeds",
|
||||
"HomePage",
|
||||
"Navigation",
|
||||
//"Scheduling",
|
||||
"Scheduling",
|
||||
"Indexing",
|
||||
//"Localization",
|
||||
"Routable",
|
||||
@@ -86,7 +86,7 @@ namespace Orchard.Setup.Services {
|
||||
"PackagingServices",
|
||||
"Orchard.Modules",
|
||||
"Orchard.Themes",
|
||||
//"Orchard.Blogs",
|
||||
"Orchard.Blogs",
|
||||
"Orchard.Comments",
|
||||
"Orchard.Tags",
|
||||
"Orchard.Media",
|
||||
|
Reference in New Issue
Block a user