mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-23 21:13:35 +08:00
Hooked up remove BlogPost in the admin.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045314
This commit is contained in:
@@ -181,7 +181,7 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
if (blog == null)
|
if (blog == null)
|
||||||
return new NotFoundResult();
|
return new NotFoundResult();
|
||||||
|
|
||||||
BlogPost post = _blogPostService.Get(blog, postSlug);
|
BlogPost post = _blogPostService.Get(blog, postSlug, VersionOptions.Latest);
|
||||||
|
|
||||||
if (post == null)
|
if (post == null)
|
||||||
return new NotFoundResult();
|
return new NotFoundResult();
|
||||||
|
@@ -16,6 +16,7 @@ namespace Orchard.Blogs.Models {
|
|||||||
Filters.Add(new StorageFilter<CommonVersionRecord>(commonRepository));
|
Filters.Add(new StorageFilter<CommonVersionRecord>(commonRepository));
|
||||||
|
|
||||||
OnCreated<BlogPost>((context, bp) => bp.Blog.PostCount++);
|
OnCreated<BlogPost>((context, bp) => bp.Blog.PostCount++);
|
||||||
|
OnRemoved<BlogPost>((context, bp) => bp.Blog.PostCount--);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,4 +1,6 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<BlogPost>>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<BlogPost>>" %>
|
||||||
|
<%@ Import Namespace="Orchard.Themes"%>
|
||||||
|
<%@ Import Namespace="Orchard.Extensions"%>
|
||||||
<%@ Import Namespace="Orchard.ContentManagement"%>
|
<%@ Import Namespace="Orchard.ContentManagement"%>
|
||||||
<%@ Import Namespace="Orchard.Core.Common.Models"%>
|
<%@ Import Namespace="Orchard.Core.Common.Models"%>
|
||||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||||
@@ -7,14 +9,19 @@
|
|||||||
<h2><%=Html.Link(Html.Encode(Model.Item.Title), Url.BlogPostEdit(Model.Item.Blog.Slug, Model.Item.Slug)) %></h2>
|
<h2><%=Html.Link(Html.Encode(Model.Item.Title), Url.BlogPostEdit(Model.Item.Blog.Slug, Model.Item.Slug)) %></h2>
|
||||||
<div class="meta"><%=Html.PublishedState(Model.Item) %> | <%=Html.Link(_Encoded("?? comments").ToString(), "") %></div>
|
<div class="meta"><%=Html.PublishedState(Model.Item) %> | <%=Html.Link(_Encoded("?? comments").ToString(), "") %></div>
|
||||||
<div class="content"><%=Model.Item.As<BodyAspect>().Text ?? string.Format("<p><em>{0}</em></p>", _Encoded("there's no content for this blog post"))%></div>
|
<div class="content"><%=Model.Item.As<BodyAspect>().Text ?? string.Format("<p><em>{0}</em></p>", _Encoded("there's no content for this blog post"))%></div>
|
||||||
<p class="actions">
|
<ul class="actions">
|
||||||
<%-- todo: (heskew) make into a ul --%>
|
<li class="construct">
|
||||||
<span class="construct">
|
|
||||||
<a href="<%=Url.BlogPostEdit(Model.Item.Blog.Slug, Model.Item.Slug) %>" class="ibutton edit"><%=_Encoded("Edit Post")%></a>
|
<a href="<%=Url.BlogPostEdit(Model.Item.Blog.Slug, Model.Item.Slug) %>" class="ibutton edit"><%=_Encoded("Edit Post")%></a>
|
||||||
<a href="<%=Url.BlogPost(Model.Item.Blog.Slug, Model.Item.Slug) %>" class="ibutton view"><%=_Encoded("View Post")%></a><%
|
<a href="<%=Url.BlogPost(Model.Item.Blog.Slug, Model.Item.Slug) %>" class="ibutton view"><%=_Encoded("View Post")%></a><%
|
||||||
if (Model.Item.Published == null) { // todo: (heskew) be smart about this and maybe have other contextual actions - including view/preview for view up there ^^ %>
|
if (Model.Item.Published == null) { // todo: (heskew) be smart about this and maybe have other contextual actions - including view/preview for view up there ^^ %>
|
||||||
<a href="<%=Url.BlogPost(Model.Item.Blog.Slug, Model.Item.Slug) %>" class="ibutton publish"><%=_Encoded("Publish Post Now")%></a>
|
<a href="<%=Url.BlogPost(Model.Item.Blog.Slug, Model.Item.Slug) %>" class="ibutton publish"><%=_Encoded("Publish Post Now")%></a>
|
||||||
<% } %>
|
<% } %>
|
||||||
</span>
|
</li>
|
||||||
<span class="destruct"><a href="#" class="ibutton remove"><%=_Encoded("Remove Post")%></a></span>
|
<li class="destruct">
|
||||||
</p>
|
<% using (Html.BeginFormAntiForgeryPost(Url.BlogPostDelete(Model.Item.Blog.Slug, Model.Item.Slug))) { %>
|
||||||
|
<fieldset>
|
||||||
|
<input type="image" src="<%=ResolveUrl(Html.Resolve<IExtensionManager>().GetThemeLocation(Html.Resolve<IThemeService>().GetRequestTheme(ViewContext.RequestContext)) + "/styles/images/remove.png") %>" alt="<%=_Encoded("Remove Post") %>" title="<%=_Encoded("Remove Post") %>" class="ibutton image remove" />
|
||||||
|
</fieldset><%
|
||||||
|
} %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
@@ -211,16 +211,17 @@ namespace Orchard.Mvc.Html {
|
|||||||
return htmlHelper.BeginFormAntiForgeryPost(htmlHelper.ViewContext.HttpContext.Request.RawUrl, FormMethod.Post, new RouteValueDictionary());
|
return htmlHelper.BeginFormAntiForgeryPost(htmlHelper.ViewContext.HttpContext.Request.RawUrl, FormMethod.Post, new RouteValueDictionary());
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: (erikpo) Uncomment when needed (not currently needed)
|
public static MvcForm BeginFormAntiForgeryPost(this HtmlHelper htmlHelper, string formAction) {
|
||||||
//public static MvcForm BeginFormAntiForgeryPost(this HtmlHelper htmlHelper, string formAction) {
|
return htmlHelper.BeginFormAntiForgeryPost(formAction, FormMethod.Post, new RouteValueDictionary());
|
||||||
// return htmlHelper.BeginFormAntiForgeryPost(formAction, FormMethod.Post, new RouteValueDictionary());
|
}
|
||||||
//}
|
|
||||||
//public static MvcForm BeginFormAntiForgeryPost(this HtmlHelper htmlHelper, string formAction, FormMethod formMethod) {
|
public static MvcForm BeginFormAntiForgeryPost(this HtmlHelper htmlHelper, string formAction, FormMethod formMethod) {
|
||||||
// return htmlHelper.BeginFormAntiForgeryPost(formAction, formMethod, new RouteValueDictionary());
|
return htmlHelper.BeginFormAntiForgeryPost(formAction, formMethod, new RouteValueDictionary());
|
||||||
//}
|
}
|
||||||
//public static MvcForm BeginFormAntiForgeryPost(this HtmlHelper htmlHelper, string formAction, FormMethod formMethod, object htmlAttributes) {
|
|
||||||
// return htmlHelper.BeginFormAntiForgeryPost(formAction, formMethod, new RouteValueDictionary(htmlAttributes));
|
public static MvcForm BeginFormAntiForgeryPost(this HtmlHelper htmlHelper, string formAction, FormMethod formMethod, object htmlAttributes) {
|
||||||
//}
|
return htmlHelper.BeginFormAntiForgeryPost(formAction, formMethod, new RouteValueDictionary(htmlAttributes));
|
||||||
|
}
|
||||||
|
|
||||||
public static MvcForm BeginFormAntiForgeryPost(this HtmlHelper htmlHelper, string formAction, FormMethod formMethod, IDictionary<string, object> htmlAttributes) {
|
public static MvcForm BeginFormAntiForgeryPost(this HtmlHelper htmlHelper, string formAction, FormMethod formMethod, IDictionary<string, object> htmlAttributes) {
|
||||||
TagBuilder tagBuilder = new TagBuilder("form");
|
TagBuilder tagBuilder = new TagBuilder("form");
|
||||||
|
Reference in New Issue
Block a user