@using Orchard.Comments
@using Orchard.Comments.Models
@using Orchard.ContentManagement

@{
    CommentPart comment = Model.ContentPart;
    CommentsPart comments = comment.CommentedOnContentItem.As<CommentsPart>();
    var isAuthorized = AuthorizedFor(Permissions.AddComment, Model.ContentItem);
    
    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.Id = "comment-" + comment.Id;
    var tag = Tag(Model, "article");
}

@tag.StartElement
    <header>
        <h4>@Display.CommentAuthor(ContentPart: comment)</h4>
        @Display.CommentMetadata(ContentPart: comment)
    </header>
   
    @Display.CommentText(ContentPart: Model.ContentPart, ContentItem: Model.ContentItem) 

    @Display(children)
    
    @if (comments.ThreadedComments && comments.CommentsActive && isAuthorized) 
    {
        @Display.CommentReplyButton(ContentPart: comment)
    }
@tag.EndElement