mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 18:27:55 +08:00
- Blogs: ability to close/enable comments on a blog post level from the blog post edit admin.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4042889
This commit is contained in:
@@ -216,11 +216,14 @@ namespace Orchard.Comments.Controllers {
|
||||
return RedirectToAction("Details", new { viewModel.CommentedItemId, viewModel.Options });
|
||||
}
|
||||
|
||||
public ActionResult Close(int commentedItemId) {
|
||||
public ActionResult Close(int commentedItemId, string returnUrl) {
|
||||
try {
|
||||
if (!_authorizer.Authorize(Permissions.CloseComment, T("Couldn't close comments")))
|
||||
return new HttpUnauthorizedResult();
|
||||
_commentService.CloseCommentsForCommentedContent(commentedItemId);
|
||||
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||
return Redirect(returnUrl);
|
||||
}
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
catch (Exception exception) {
|
||||
@@ -229,11 +232,14 @@ namespace Orchard.Comments.Controllers {
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult Enable(int commentedItemId) {
|
||||
public ActionResult Enable(int commentedItemId, string returnUrl) {
|
||||
try {
|
||||
if (!_authorizer.Authorize(Permissions.EnableComment, T("Couldn't enable comments")))
|
||||
return new HttpUnauthorizedResult();
|
||||
_commentService.EnableCommentsForCommentedContent(commentedItemId);
|
||||
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||
return Redirect(returnUrl);
|
||||
}
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
catch (Exception exception) {
|
||||
|
@@ -14,7 +14,9 @@
|
||||
</ol>
|
||||
<% if (Model.Closed) { %>
|
||||
<p>Comments have been disabled for this content.</p>
|
||||
<%= Html.ActionLink("Enable Comments for this content", "Enable", new { Area="Orchard.Comments", Controller="Admin", returnUrl = Context.Request.Url, commentedItemId = Model.ContentItem.Id })%>
|
||||
<% } else { %>
|
||||
<%= Html.ActionLink("Close Comments for this content", "Close", new { Area="Orchard.Comments", Controller="Admin", returnUrl = Context.Request.Url, commentedItemId = Model.ContentItem.Id })%>
|
||||
<% Html.BeginForm("Create", "Admin", new { area = "Orchard.Comments" }); %>
|
||||
<%= Html.ValidationSummary() %>
|
||||
<div class="yui-g">
|
||||
|
Reference in New Issue
Block a user