From 778bc8a9dcf8707a846e9b24e35d9f76c0984b82 Mon Sep 17 00:00:00 2001 From: Ryan Drew Burnett Date: Thu, 5 Nov 2015 21:48:04 +0000 Subject: [PATCH 1/2] Fixed reply button and comment link and added useful CSS class. --- .../Orchard.Comments/Views/Parts.Comment.cshtml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.Comment.cshtml b/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.Comment.cshtml index b14a0ce10..2b54552dc 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.Comment.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.Comment.cshtml @@ -8,8 +8,13 @@ var children = New.List(Items: Model.Items); children.Classes.Add("comments"); + if (Model.Items.Count > 0) { + Model.Classes.Add("has-replies"); + } + Model.Classes.Add("comment"); - Model.Classes.Add("comment-"+comment.Id); + + Model.Id = "comment" + comment.Id; var tag = Tag(Model, "article"); } @tag.StartElement @@ -17,8 +22,8 @@

@Display.CommentAuthor(ContentPart: comment) @Display.CommentMetadata(ContentPart: comment) - @if (comments.ThreadedComments) { - @Display.CommentReplyButton(ContentPart: comment) + @if (comments.ThreadedComments && comments.CommentsActive) { + @Display.CommentReplyButton(ContentPart: comment) }

From 6699245cbe0d2c3818701aa8ebe446051a61717f Mon Sep 17 00:00:00 2001 From: Ryan Drew Burnett Date: Fri, 6 Nov 2015 09:01:10 +0000 Subject: [PATCH 2/2] Reply button only displays if user has permission to post comments. --- .../Orchard.Comments/Views/Parts.Comment.cshtml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.Comment.cshtml b/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.Comment.cshtml index 2b54552dc..5bd5dc6bd 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.Comment.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Comments/Views/Parts.Comment.cshtml @@ -1,10 +1,12 @@ -@using Orchard.Comments.Models -@using Orchard.ContentManagement +@using Orchard.ContentManagement +@using Orchard.Comments +@using Orchard.Comments.Models @{ CommentPart comment = Model.ContentPart; CommentsPart comments = comment.CommentedOnContentItem.As(); - + var isAuthorized = AuthorizedFor(Permissions.AddComment, Model.ContentItem); + var children = New.List(Items: Model.Items); children.Classes.Add("comments"); @@ -22,7 +24,7 @@

@Display.CommentAuthor(ContentPart: comment) @Display.CommentMetadata(ContentPart: comment) - @if (comments.ThreadedComments && comments.CommentsActive) { + @if (comments.ThreadedComments && comments.CommentsActive && isAuthorized) { @Display.CommentReplyButton(ContentPart: comment) }