diff --git a/src/Orchard.Web/Packages/Orchard.Comments/Controllers/AdminController.cs b/src/Orchard.Web/Packages/Orchard.Comments/Controllers/AdminController.cs index f16fcee96..f7daca95d 100644 --- a/src/Orchard.Web/Packages/Orchard.Comments/Controllers/AdminController.cs +++ b/src/Orchard.Web/Packages/Orchard.Comments/Controllers/AdminController.cs @@ -228,6 +228,9 @@ namespace Orchard.Comments.Controllers { } catch (Exception exception) { _notifier.Error(T("Closing Comments failed: " + exception.Message)); + if (!String.IsNullOrEmpty(returnUrl)) { + return Redirect(returnUrl); + } return RedirectToAction("Index"); } } @@ -244,6 +247,9 @@ namespace Orchard.Comments.Controllers { } catch (Exception exception) { _notifier.Error(T("Enabling Comments failed: " + exception.Message)); + if (!String.IsNullOrEmpty(returnUrl)) { + return Redirect(returnUrl); + } return RedirectToAction("Index"); } } @@ -285,16 +291,22 @@ namespace Orchard.Comments.Controllers { } } - public ActionResult Delete(int id) { + public ActionResult Delete(int id, string returnUrl) { try { if (!_authorizer.Authorize(Permissions.ModerateComment, T("Couldn't delete comment"))) return new HttpUnauthorizedResult(); int commentedOn = _commentService.GetComment(id).CommentedOn; _commentService.DeleteComment(id); + if (!String.IsNullOrEmpty(returnUrl)) { + return Redirect(returnUrl); + } return RedirectToAction("Details", new { id = commentedOn }); } catch (Exception exception) { _notifier.Error(T("Deleting comment failed: " + exception.Message)); + if (!String.IsNullOrEmpty(returnUrl)) { + return Redirect(returnUrl); + } return Index(new CommentIndexOptions()); } } diff --git a/src/Orchard.Web/Packages/Orchard.Comments/Views/Models/EditorTemplates/HasComments.ascx b/src/Orchard.Web/Packages/Orchard.Comments/Views/Models/EditorTemplates/HasComments.ascx index 79a4499d9..ed051654a 100644 --- a/src/Orchard.Web/Packages/Orchard.Comments/Views/Models/EditorTemplates/HasComments.ascx +++ b/src/Orchard.Web/Packages/Orchard.Comments/Views/Models/EditorTemplates/HasComments.ascx @@ -9,6 +9,9 @@
  • Posted by <%= comment.UserName %> on <%= comment.CommentDate %>
  • +
  • + <%=Html.ActionLink("Delete", "Delete", new {Area="Orchard.Comments", Controller="Admin", id = comment.Id, returnUrl = Context.Request.Url}) %> +

  • <% } %> @@ -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 })%> <% } 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() %> -
    -

    Add a Comment

    -

    Information

    -
      -
    1. - <%= Html.Hidden("CommentedOn", Model.ContentItem.Id) %> - <%= Html.Hidden("ReturnUrl", Context.Request.Url) %> - - -
    2. -
    3. - - -
    4. -
    5. - - -
    6. -
    7. - - -
    8. -
    9. - -
    10. -
    -
    - <% Html.EndForm(); %> -<% } %> \ No newline at end of file +<% } %> | <%=Html.ActionLink("Go to comments management for this post", "Details", new {Area="Orchard.Comments", Controller="Admin", id = Model.ContentItem.Id, returnUrl = Context.Request.Url}) %>