- 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:
suhacan
2009-12-02 02:34:04 +00:00
parent 54c3e2ca9e
commit 20300e3aaa
2 changed files with 10 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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">