mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
- Blogs: blog post edit view refining for comments: removing add comment form, adding delete comment and close/enable comments links as well as a link that will take you to the back end comments admin page for comments filtered by that blog post.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4042967
This commit is contained in:
@@ -228,6 +228,9 @@ namespace Orchard.Comments.Controllers {
|
|||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
_notifier.Error(T("Closing Comments failed: " + exception.Message));
|
_notifier.Error(T("Closing Comments failed: " + exception.Message));
|
||||||
|
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
}
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -244,6 +247,9 @@ namespace Orchard.Comments.Controllers {
|
|||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
_notifier.Error(T("Enabling Comments failed: " + exception.Message));
|
_notifier.Error(T("Enabling Comments failed: " + exception.Message));
|
||||||
|
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
}
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -285,16 +291,22 @@ namespace Orchard.Comments.Controllers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Delete(int id) {
|
public ActionResult Delete(int id, string returnUrl) {
|
||||||
try {
|
try {
|
||||||
if (!_authorizer.Authorize(Permissions.ModerateComment, T("Couldn't delete comment")))
|
if (!_authorizer.Authorize(Permissions.ModerateComment, T("Couldn't delete comment")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
int commentedOn = _commentService.GetComment(id).CommentedOn;
|
int commentedOn = _commentService.GetComment(id).CommentedOn;
|
||||||
_commentService.DeleteComment(id);
|
_commentService.DeleteComment(id);
|
||||||
|
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
}
|
||||||
return RedirectToAction("Details", new { id = commentedOn });
|
return RedirectToAction("Details", new { id = commentedOn });
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
_notifier.Error(T("Deleting comment failed: " + exception.Message));
|
_notifier.Error(T("Deleting comment failed: " + exception.Message));
|
||||||
|
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
}
|
||||||
return Index(new CommentIndexOptions());
|
return Index(new CommentIndexOptions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,9 @@
|
|||||||
<li>
|
<li>
|
||||||
Posted by <%= comment.UserName %> on <%= comment.CommentDate %>
|
Posted by <%= comment.UserName %> on <%= comment.CommentDate %>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<%=Html.ActionLink("Delete", "Delete", new {Area="Orchard.Comments", Controller="Admin", id = comment.Id, returnUrl = Context.Request.Url}) %>
|
||||||
|
</li>
|
||||||
<hr />
|
<hr />
|
||||||
<% } %>
|
<% } %>
|
||||||
</ol>
|
</ol>
|
||||||
@@ -17,35 +20,4 @@
|
|||||||
<%= Html.ActionLink("Enable Comments for this content", "Enable", new { Area="Orchard.Comments", Controller="Admin", returnUrl = Context.Request.Url, commentedItemId = Model.ContentItem.Id })%>
|
<%= Html.ActionLink("Enable Comments for this content", "Enable", new { Area="Orchard.Comments", Controller="Admin", returnUrl = Context.Request.Url, commentedItemId = Model.ContentItem.Id })%>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<%= Html.ActionLink("Close Comments for this content", "Close", new { Area="Orchard.Comments", Controller="Admin", returnUrl = Context.Request.Url, commentedItemId = Model.ContentItem.Id })%>
|
<%= 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.ActionLink("Go to comments management for this post", "Details", new {Area="Orchard.Comments", Controller="Admin", id = Model.ContentItem.Id, returnUrl = Context.Request.Url}) %>
|
||||||
<%= Html.ValidationSummary() %>
|
|
||||||
<div class="yui-g">
|
|
||||||
<h2 class="separator">Add a Comment</h2>
|
|
||||||
<h3>Information</h3>
|
|
||||||
<ol>
|
|
||||||
<li>
|
|
||||||
<%= Html.Hidden("CommentedOn", Model.ContentItem.Id) %>
|
|
||||||
<%= Html.Hidden("ReturnUrl", Context.Request.Url) %>
|
|
||||||
<label for="Name">Name:</label>
|
|
||||||
<input id="Text1" class="inputText inputTextLarge" name="Name" type="text" />
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label for="Email">Email:</label>
|
|
||||||
<input id="Email" class="inputText inputTextLarge" name="Email" type="text" />
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label for="SiteName">SiteName:</label>
|
|
||||||
<input id="SiteName" class="inputText inputTextLarge" name="SiteName" type="text" />
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label for="CommentText">Leave a comment</label>
|
|
||||||
<textarea id="CommentText" rows="10" cols="30" name="CommentText">
|
|
||||||
</textarea>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<input type="submit" class="button" value="Submit Comment" />
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
<% Html.EndForm(); %>
|
|
||||||
<% } %>
|
|
||||||
|
Reference in New Issue
Block a user