@(post:(models.Post,models.User,Seq[models.Comment]), mode: String = "full")

@commentsTitle = {
    @if(post._3) {
        @post._3.size comments, latest by @post._3(0).author
    } else {
        no comments
    }
}
 
<div class="post @mode">
    <h2 class="post-title">
        <a href="@action(controllers.Application.show(post._1.id()))">@post._1.title</a>
    </h2>
    <div class="post-metadata">
        <span class="post-author">by @post._2.fullname</span>,
        <span class="post-date">
            @post._1.postedAt.format("dd MMM yy")
        </span>
        @if(mode != "full") {
            <span class="post-comments">
                @commentsTitle
            </span>
        }
    </div>
    @if(mode != "teaser") {
        <div class="post-content">
            <div class="about">Detail: </div>
            @Html(post._1.content.replace("\n", "<br>"))
        </div>
    }
</div>

@if(mode == "full") {
    
    <div class="comments">
        <h3>
            @commentsTitle
        </h3>
        
        @post._3.map { comment =>
            <div class="comment">
                <div class="comment-metadata">
                    <span class="comment-author">by @comment.author,</span>
                    <span class="comment-date">
                        @comment.postedAt.format("dd MMM yy")
                    </span>
                </div>
                <div class="comment-content">
                    <div class="about">Detail: </div>
                    @Html(comment.content.replace("\n", "<br>"))
                </div>
            </div>
        }
        
    </div>
    
}
 