diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Controllers/CommentController.cs b/src/Orchard.Web/Modules/Orchard.Comments/Controllers/CommentController.cs index dd72560ed..ace820b8c 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Controllers/CommentController.cs +++ b/src/Orchard.Web/Modules/Orchard.Comments/Controllers/CommentController.cs @@ -55,7 +55,7 @@ namespace Orchard.Comments.Controllers { } // is it a response to another comment ? - if(commentPart.RepliedOn.HasValue && (commentsPart == null || !commentsPart.ThreadedComments)) { + if(commentPart.RepliedOn.HasValue && commentsPart != null && commentsPart.ThreadedComments) { var replied = Services.ContentManager.Get(commentPart.RepliedOn.Value); if(replied != null) { var repliedPart = replied.As(); @@ -116,6 +116,10 @@ namespace Orchard.Comments.Controllers { } TempData["Comments.InvalidCommentEditorShape"] = editorShape; + var commentPart = comment.As(); + if(commentPart.RepliedOn.HasValue) { + TempData["Comments.RepliedOn"] = commentPart.RepliedOn.Value; + } } return this.RedirectLocal(returnUrl, "~/"); diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Views/ListOfComments.cshtml b/src/Orchard.Web/Modules/Orchard.Comments/Views/ListOfComments.cshtml index de1872e93..c6edaba15 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Views/ListOfComments.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Comments/Views/ListOfComments.cshtml @@ -2,7 +2,7 @@ @foreach (var comment in Model.CommentShapes) {
  • @{ - comment.Id = "comment-" + comment.ContentPart.Id; + comment.Id = "comment-" + comment.ContentItem.Id; var tag = Tag(comment, "article"); // using Tag so the comment can be altered by custom modules tag.AddCssClass("comment"); } diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.CommentForm.cshtml b/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.CommentForm.cshtml index 32d038bce..75f111bae 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.CommentForm.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.CommentForm.cshtml @@ -27,6 +27,7 @@ else if (WorkContext.CurrentUser == null && !AuthorizedFor(Permissions.AddCommen } else { @Html.ValidationSummary() + using (Html.BeginFormAntiForgeryPost(Url.Action("Create", "Comment", new { Area = "Orchard.Comments", ReturnUrl = Context.Request.ToUrlString() }), FormMethod.Post, new { @class = "comment-form" })) { if (TempData.ContainsKey("Comments.InvalidCommentEditorShape")) { @Display(TempData["Comments.InvalidCommentEditorShape"]); diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.ListOfComments.cshtml b/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.ListOfComments.cshtml index bfa46e29e..22e21a8bc 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.ListOfComments.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.ListOfComments.cshtml @@ -1,29 +1,59 @@ -@if (Model.CommentCount > 0) { +@using Orchard.Comments.Models +@{ + CommentsPart commentsPart = Model.ContentPart; +} + +@if (Model.CommentCount > 0) {

    @T.Plural("1 Comment", "{0} Comments", (int)Model.CommentCount)

    @Display.ListOfComments(CommentShapes: Model.CommentShapes)
    } -@using(Script.Foot()) { +@* render reply button if threaded comments enabled *@ +@if(commentsPart.ThreadedComments) { Script.Require("jQuery"); - + using (Script.Foot()) { + + } } \ No newline at end of file