mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-18 17:47:54 +08:00
Did some cleanup on blogs and hooked up BlogPost edit.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4042850
This commit is contained in:
@@ -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("List", "Blog", new { area = "Orchard.Blogs" }))
|
||||
.Add("Manage Blogs", "1.0", item => item.Action("ListForAdmin", "Blog", new { area = "Orchard.Blogs" }))
|
||||
.Add("Create New Blog", "1.1", item => item.Action("Create", "Blog", new { area = "Orchard.Blogs" })));
|
||||
}
|
||||
}
|
||||
|
@@ -15,24 +15,24 @@ using Orchard.UI.Notify;
|
||||
namespace Orchard.Blogs.Controllers {
|
||||
[ValidateInput(false)]
|
||||
public class BlogController : Controller, IUpdateModel {
|
||||
private readonly ISessionLocator _sessionLocator;
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly INotifier _notifier;
|
||||
private readonly IBlogService _blogService;
|
||||
private readonly IBlogPostService _blogPostService;
|
||||
private readonly ISessionLocator _sessionLocator;
|
||||
|
||||
public BlogController(IContentManager contentManager, INotifier notifier, IBlogService blogService, IBlogPostService blogPostService, ISessionLocator sessionLocator) {
|
||||
public BlogController(ISessionLocator sessionLocator, IContentManager contentManager, INotifier notifier, IBlogService blogService, IBlogPostService blogPostService) {
|
||||
_sessionLocator = sessionLocator;
|
||||
_contentManager = contentManager;
|
||||
_notifier = notifier;
|
||||
_blogService = blogService;
|
||||
_blogPostService = blogPostService;
|
||||
_sessionLocator = sessionLocator;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public ActionResult List() {
|
||||
public ActionResult ListForAdmin() {
|
||||
return View(new BlogsViewModel {Blogs = _blogService.Get()});
|
||||
}
|
||||
|
||||
@@ -67,14 +67,26 @@ namespace Orchard.Blogs.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Edit(string blogSlug) {
|
||||
var model = new BlogEditViewModel { Blog = _blogService.Get(blogSlug) };
|
||||
//TODO: (erikpo) Move looking up the current blog up into a modelbinder
|
||||
Blog blog = _blogService.Get(blogSlug);
|
||||
|
||||
if (blog == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var model = new BlogEditViewModel { Blog = blog };
|
||||
model.Editors = _contentManager.GetEditors(model.Blog.ContentItem);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Edit(string blogSlug, FormCollection input) {
|
||||
var model = new BlogEditViewModel { Blog = _blogService.Get(blogSlug) };
|
||||
//TODO: (erikpo) Move looking up the current blog up into a modelbinder
|
||||
Blog blog = _blogService.Get(blogSlug);
|
||||
|
||||
if (blog == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var model = new BlogEditViewModel { Blog = blog };
|
||||
model.Editors = _contentManager.UpdateEditors(model.Blog.ContentItem, this);
|
||||
|
||||
IValueProvider values = input.ToValueProvider();
|
||||
@@ -83,7 +95,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
|
||||
_notifier.Information(T("Blog information updated"));
|
||||
|
||||
//TODO: (erikpo) Since the model isn't actually updated yet and it's possible the slug changed I'm getting the slug from input. Lame?!?!
|
||||
//TODO: (erikpo) This should redirect to the blog homepage in the admin once that page is created
|
||||
return Redirect(Url.Blogs());
|
||||
}
|
||||
|
||||
|
@@ -5,22 +5,32 @@ using Orchard.Blogs.Services;
|
||||
using Orchard.Blogs.ViewModels;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Data;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Models;
|
||||
using Orchard.Models.Driver;
|
||||
using Orchard.Mvc.Results;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.Blogs.Controllers {
|
||||
[ValidateInput(false)]
|
||||
public class BlogPostController : Controller {
|
||||
public class BlogPostController : Controller, IUpdateModel {
|
||||
private readonly ISessionLocator _sessionLocator;
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly INotifier _notifier;
|
||||
private readonly IBlogService _blogService;
|
||||
private readonly IBlogPostService _blogPostService;
|
||||
|
||||
public BlogPostController(ISessionLocator sessionLocator, IBlogService blogService, IBlogPostService blogPostService) {
|
||||
public BlogPostController(ISessionLocator sessionLocator, IContentManager contentManager, INotifier notifier, IBlogService blogService, IBlogPostService blogPostService) {
|
||||
_sessionLocator = sessionLocator;
|
||||
_contentManager = contentManager;
|
||||
_notifier = notifier;
|
||||
_blogService = blogService;
|
||||
_blogPostService = blogPostService;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public ActionResult ListByBlog(string blogSlug) {
|
||||
Blog blog = _blogService.Get(blogSlug);
|
||||
|
||||
@@ -45,8 +55,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
return View(new BlogPostViewModel {Blog = blog, Post = post});
|
||||
}
|
||||
|
||||
public ActionResult Create(string blogSlug)
|
||||
{
|
||||
public ActionResult Create(string blogSlug) {
|
||||
//TODO: (erikpo) Move looking up the current blog up into a modelbinder
|
||||
Blog blog = _blogService.Get(blogSlug);
|
||||
|
||||
@@ -57,8 +66,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Create(string blogSlug, CreateBlogPostViewModel model)
|
||||
{
|
||||
public ActionResult Create(string blogSlug, CreateBlogPostViewModel model) {
|
||||
//TODO: (erikpo) Move looking up the current blog up into a modelbinder
|
||||
Blog blog = _blogService.Get(blogSlug);
|
||||
|
||||
@@ -76,5 +84,52 @@ namespace Orchard.Blogs.Controllers {
|
||||
|
||||
return Redirect(Url.BlogPost(blogSlug, blogPost.As<RoutableAspect>().Slug));
|
||||
}
|
||||
|
||||
public ActionResult Edit(string blogSlug, string postSlug) {
|
||||
//TODO: (erikpo) Move looking up the current blog up into a modelbinder
|
||||
Blog blog = _blogService.Get(blogSlug);
|
||||
|
||||
if (blog == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
BlogPost post = _blogPostService.Get(blog, postSlug);
|
||||
|
||||
if (post == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var model = new BlogPostEditViewModel { Blog = blog, Post = post };
|
||||
model.Editors = _contentManager.GetEditors(model.Post.ContentItem);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Edit(string blogSlug, string postSlug, FormCollection input) {
|
||||
//TODO: (erikpo) Move looking up the current blog up into a modelbinder
|
||||
Blog blog = _blogService.Get(blogSlug);
|
||||
|
||||
if (blog == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
BlogPost post = _blogPostService.Get(blog, postSlug);
|
||||
|
||||
if (post == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var model = new BlogPostEditViewModel { Blog = blog, Post = post };
|
||||
model.Editors = _contentManager.UpdateEditors(model.Post.ContentItem, this);
|
||||
|
||||
IValueProvider values = input.ToValueProvider();
|
||||
if (!TryUpdateModel(model, values))
|
||||
return View(model);
|
||||
|
||||
_notifier.Information(T("Blog post information updated"));
|
||||
|
||||
//TODO: (erikpo) Since the model isn't actually updated yet and it's possible the slug changed I'm getting the slug from input. Lame?!?!
|
||||
return Redirect(Url.BlogPostEdit(blog.Slug, values.GetValue(ControllerContext, "Slug").AttemptedValue));
|
||||
}
|
||||
|
||||
bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
|
||||
return TryUpdateModel(model, prefix, includeProperties, excludeProperties);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Blogs.Models;
|
||||
|
||||
namespace Orchard.Blogs.Extensions {
|
||||
public static class HtmlHelperExtensions {
|
||||
public static string Published(this HtmlHelper<BlogPost> htmlHelper) {
|
||||
return htmlHelper.Published(htmlHelper.ViewData.Model);
|
||||
}
|
||||
|
||||
public static string Published(this HtmlHelper htmlHelper, BlogPost blogPost) {
|
||||
//TODO: (erikpo) Relative time instead would be nice.
|
||||
return blogPost.Published.HasValue ? blogPost.Published.Value.ToString("{0:M d yyyy h:mm tt}") : "Draft";
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,7 +3,7 @@ using System.Web.Mvc;
|
||||
namespace Orchard.Blogs.Extensions {
|
||||
public static class UrlHelperExtensions {
|
||||
public static string Blogs(this UrlHelper urlHelper) {
|
||||
return urlHelper.Action("List", "Blog", new {area = "Orchard.Blogs"});
|
||||
return urlHelper.Action("ListForAdmin", "Blog", new {area = "Orchard.Blogs"});
|
||||
}
|
||||
|
||||
public static string Blog(this UrlHelper urlHelper, string blogSlug) {
|
||||
|
@@ -8,6 +8,7 @@ namespace Orchard.Blogs.Models {
|
||||
public readonly static ContentType ContentType = new ContentType { Name = "blogpost", DisplayName = "Blog Post" };
|
||||
|
||||
public Blog Blog { get; set; }
|
||||
public int Id { get { return ContentItem.Id; } }
|
||||
public string Title { get { return this.As<RoutableAspect>().Title; } }
|
||||
public string Body { get { return this.As<BodyAspect>().Record.Text; } }
|
||||
public string Slug { get { return this.As<RoutableAspect>().Slug; } }
|
||||
|
@@ -69,6 +69,7 @@
|
||||
<Compile Include="Controllers\BlogPostController.cs" />
|
||||
<Compile Include="Extensions\BlogCreateViewModelExtensions.cs" />
|
||||
<Compile Include="Extensions\BlogPostCreateViewModelExtensions.cs" />
|
||||
<Compile Include="Extensions\HtmlHelperExtensions.cs" />
|
||||
<Compile Include="Extensions\UrlHelperExtensions.cs" />
|
||||
<Compile Include="Routing\IsBlogConstraint.cs" />
|
||||
<Compile Include="Services\BlogService.cs" />
|
||||
@@ -89,6 +90,7 @@
|
||||
<Compile Include="ViewModels\BlogsViewModel.cs" />
|
||||
<Compile Include="ViewModels\BlogViewModel.cs" />
|
||||
<Compile Include="ViewModels\BlogPostViewModel.cs" />
|
||||
<Compile Include="ViewModels\BlogPostEditViewModel.cs" />
|
||||
<Compile Include="ViewModels\CreateBlogPostViewModel.cs" />
|
||||
<Compile Include="ViewModels\CreateBlogViewModel.cs" />
|
||||
<Compile Include="ViewModels\BlogEditViewModel.cs" />
|
||||
@@ -96,6 +98,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Package.txt" />
|
||||
<Content Include="Views\BlogPost\Create.aspx" />
|
||||
<Content Include="Views\BlogPost\Edit.aspx" />
|
||||
<Content Include="Views\Blog\ListForAdmin.aspx" />
|
||||
<Content Include="Views\Shared\BlogPostPreview.ascx" />
|
||||
<Content Include="Views\BlogPost\EditorTemplates\CreateBlogPostViewModel.ascx" />
|
||||
<Content Include="Views\BlogPost\Item.aspx" />
|
||||
<Content Include="Views\Blog\Create.aspx" />
|
||||
@@ -107,7 +112,6 @@
|
||||
<Content Include="Views\Blog\DisplayTemplates\BlogsViewModel.ascx" />
|
||||
<Content Include="Views\Blog\EditorTemplates\CreateBlogViewModel.ascx" />
|
||||
<Content Include="Views\Blog\Item.aspx" />
|
||||
<Content Include="Views\Blog\List.aspx" />
|
||||
<Content Include="Views\Shared\Foot.aspx" />
|
||||
<Content Include="Views\Shared\Head.aspx" />
|
||||
<Content Include="Views\Shared\Messages.ascx" />
|
||||
|
@@ -51,22 +51,6 @@ 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/Create",
|
||||
@@ -83,13 +67,45 @@ namespace Orchard.Blogs {
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
},
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"Admin/Blogs/{blogSlug}/Posts/{postSlug}/Edit",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Blogs"},
|
||||
{"controller", "BlogPost"},
|
||||
{"action", "Edit"}
|
||||
},
|
||||
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", "BlogPost"},
|
||||
{"action", "ListForAdmin"}
|
||||
},
|
||||
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", "List"}
|
||||
{"action", "ListForAdmin"}
|
||||
},
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary {
|
||||
|
@@ -40,6 +40,8 @@ namespace Orchard.Blogs.Services {
|
||||
return _contentManager.Create<BlogPost>("blogpost", bp =>
|
||||
{
|
||||
bp.Record.Blog = parameters.Blog.Record;
|
||||
bp.As<BodyAspect>().Record.Text = parameters.Body;
|
||||
bp.As<BodyAspect>().Record.Format = "html";
|
||||
bp.Record.Published = parameters.Published;
|
||||
bp.As<RoutableAspect>().Record.Title = parameters.Title;
|
||||
bp.As<RoutableAspect>().Record.Slug = parameters.Slug;
|
||||
|
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
using Orchard.UI.Models;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class BlogPostEditViewModel : AdminViewModel {
|
||||
public Blog Blog { get; set; }
|
||||
public BlogPost Post { get; set; }
|
||||
public IEnumerable<ModelTemplate> Editors { get; set; }
|
||||
|
||||
[HiddenInput(DisplayValue = false)]
|
||||
public int Id {
|
||||
get { return Post.Id; }
|
||||
}
|
||||
|
||||
[Required]
|
||||
public string Title {
|
||||
get { return Post.As<RoutableAspect>().Record.Title; }
|
||||
set { Post.As<RoutableAspect>().Record.Title = value; }
|
||||
}
|
||||
|
||||
[Required]
|
||||
public string Body {
|
||||
get { return Post.As<BodyAspect>().Record.Text; }
|
||||
set { Post.As<BodyAspect>().Record.Text = value; }
|
||||
}
|
||||
|
||||
[Required]
|
||||
public string Slug {
|
||||
get { return Post.As<RoutableAspect>().Record.Slug; }
|
||||
set { Post.As<RoutableAspect>().Record.Slug = value; }
|
||||
}
|
||||
|
||||
public DateTime? Published {
|
||||
get { return Post.Record.Published; }
|
||||
set { Post.Record.Published = value; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -8,13 +8,14 @@
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%-- todo: (heskew) make master-less when we get into theming --%>
|
||||
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
|
||||
<h2>Blog</h2>
|
||||
<div><%=Html.Encode(Model.Blog.Name) %></div><%
|
||||
<h1><%=Html.Encode(Model.Blog.Name) %></h1>
|
||||
<div><%=Html.Encode(Model.Blog.Description) %></div>
|
||||
<div><a href="<%=Url.BlogEdit(Model.Blog.Slug) %>">(edit)</a></div><%
|
||||
//TODO: (erikpo) Move this into a helper
|
||||
if (Model.Posts.Count() > 0) { %>
|
||||
<ul><%
|
||||
foreach (BlogPost post in Model.Posts) { %>
|
||||
<li><a href="<%=Url.BlogPost(Model.Blog.Slug, post.As<RoutableAspect>().Slug) %>"><%=Html.Encode(post.As<RoutableAspect>().Title) %></a></li><%
|
||||
<li><% Html.RenderPartial("BlogPostPreview", post); %></li><%
|
||||
} %>
|
||||
</ul><%
|
||||
} %>
|
||||
|
@@ -0,0 +1,13 @@
|
||||
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogPostEditViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<% Html.Include("Head"); %>
|
||||
<h2>Edit Blog Post</h2>
|
||||
<p><a href="<%=Url.Blogs() %>">Manage Blogs</a> > <a href="<%=Url.BlogEdit(Model.Blog.Slug) %>"><%=Html.Encode(Model.Blog.Name)%></a> > <a href="<%=Url.BlogPostEdit(Model.Blog.Slug, Model.Post.Slug) %>"><%=Model.Title %></a></p>
|
||||
<% using (Html.BeginForm()) { %>
|
||||
<%=Html.ValidationSummary() %>
|
||||
<%=Html.EditorForModel() %>
|
||||
<fieldset><input class="button" type="submit" value="Save" /></fieldset>
|
||||
<% } %>
|
||||
<% Html.Include("Foot"); %>
|
@@ -0,0 +1,38 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BlogPostEditViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<div class="sections">
|
||||
<div class="primary">
|
||||
<h3>Blog Post Content</h3>
|
||||
<%-- todo: (heskew) thin out the fieldsets if they become overkill --%>
|
||||
<fieldset>
|
||||
<label for="title">Title:</label>
|
||||
<span><%=Html.TextBoxFor(m => m.Title, new { id = "title", @class = "text" })%></span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label class="sub" for="permalink">Permalink: <span>http://localhost/<%=Model.Blog.Slug %>/</span></label>
|
||||
<span><%=Html.TextBoxFor(m => m.Slug, new { id = "permalink", @class = "text" })%> <span> « How to write a permalink. » </span></span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label for="body">Excerpt:</label>
|
||||
<span>[still needed]</span>
|
||||
<label for="body">Body:</label>
|
||||
<span><%=Html.TextAreaFor(m => m.Body, new { id = "body", @class = "html" })%></span>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="secondary">
|
||||
<h3>Publish Settings</h3>
|
||||
<fieldset>
|
||||
<label for="Command_PublishNow"><%=Html.RadioButton("Command", "PublishNow", new { id = "Command_PublishNow" }) %> Publish Now</label>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label for="Command_PublishLater"><%=Html.RadioButton("Command", "PublishLater", new { id = "Command_PublishLater" }) %> Publish Later</label>
|
||||
<%=Html.EditorFor(m => m.Published) %>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label for="Command_SaveDraft"><%=Html.RadioButton("Command", "SaveDraft", new { id = "Command_SaveDraft" }) %> Save Draft</label></li>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<input class="button" type="submit" name="submit.Save" value="Save"/>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
@@ -1,4 +1,4 @@
|
||||
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<BlogPostViewModel>" %>
|
||||
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="ViewPage<BlogPostViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Common.Models"%>
|
||||
<%@ Import Namespace="Orchard.Models"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
@@ -8,7 +8,10 @@
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%-- todo: (heskew) make master-less when we get into theming --%>
|
||||
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
|
||||
<h2><%=Html.Encode(Model.Post.Title) %></h2>
|
||||
<div>Posted by <%=Html.Encode(Model.Post.Creator.UserName) %> on {M d yyyy h:mm tt}</div>
|
||||
<%=Model.Post.Body %>
|
||||
<h1><%=Html.Encode(Model.Post.Title) %></h1>
|
||||
<div class="metadata">
|
||||
<div class="posted">Posted by <%=Html.Encode(Model.Post.Creator.UserName) %> <%=Model.Post.Published.HasValue ? "on" : "as a" %> <%=Html.Published(Model.Post) %></div>
|
||||
<div><a href="<%=Url.BlogPostEdit(Model.Blog.Slug, Model.Post.Slug) %>">(edit)</a></div>
|
||||
</div>
|
||||
<div class="content"><%=Model.Post.Body %></div>
|
||||
</asp:Content>
|
@@ -0,0 +1,8 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BlogPost>" %>
|
||||
<%@ Import Namespace="Orchard.Models"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Core.Common.Models"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<h2 class="title"><a href="<%=Url.BlogPost(Model.Blog.Slug, Model.As<RoutableAspect>().Slug) %>"><%=Html.Encode(Model.As<RoutableAspect>().Title) %></a></h2>
|
||||
<div class="posted"><%=Html.Published() %></div>
|
||||
<div class="content"><%=Model.Body %></div>
|
Reference in New Issue
Block a user