Merge pull request #6015 from ryandrewburnett/dev

Fixed reply button and comment link and added useful CSS class.
This commit is contained in:
Sébastien Ros
2015-11-19 12:35:21 -08:00

View File

@@ -1,15 +1,22 @@
@using Orchard.Comments.Models @using Orchard.ContentManagement
@using Orchard.ContentManagement @using Orchard.Comments
@using Orchard.Comments.Models
@{ @{
CommentPart comment = Model.ContentPart; CommentPart comment = Model.ContentPart;
CommentsPart comments = comment.CommentedOnContentItem.As<CommentsPart>(); CommentsPart comments = comment.CommentedOnContentItem.As<CommentsPart>();
var isAuthorized = AuthorizedFor(Permissions.AddComment, Model.ContentItem);
var children = New.List(Items: Model.Items); var children = New.List(Items: Model.Items);
children.Classes.Add("comments"); children.Classes.Add("comments");
if (Model.Items.Count > 0) {
Model.Classes.Add("has-replies");
}
Model.Classes.Add("comment"); Model.Classes.Add("comment");
Model.Classes.Add("comment-"+comment.Id);
Model.Id = "comment" + comment.Id;
var tag = Tag(Model, "article"); var tag = Tag(Model, "article");
} }
@tag.StartElement @tag.StartElement
@@ -17,8 +24,8 @@
<h4> <h4>
<span class="who">@Display.CommentAuthor(ContentPart: comment)</span> <span class="who">@Display.CommentAuthor(ContentPart: comment)</span>
<span class="when">@Display.CommentMetadata(ContentPart: comment)</span> <span class="when">@Display.CommentMetadata(ContentPart: comment)</span>
@if (comments.ThreadedComments) { @if (comments.ThreadedComments && comments.CommentsActive && isAuthorized) {
<span class="reply">@Display.CommentReplyButton(ContentPart: comment)</span> @Display.CommentReplyButton(ContentPart: comment)
} }
</h4> </h4>
</header> </header>