#{param name=commentCount/}
#{param name=comments/}
#{param name=currentUser/}

<%
	import org.exoplatform.commons.utils.HTMLEntityEncoder;

	def encoder = HTMLEntityEncoder.getInstance();
%>

<%if(commentCount == 0) {%>
    <li class="no-comment">&{comment.message.noComment}</li>
<%} else { for (def comment in comments) {
	def avatar = encoder.encode(comment.getAuthor().getAvatar());
	def displayName = encoder.encode(comment.getAuthor().getDisplayName());
	def formattedComment = comment.getFormattedComment();
%>
    <li class="comment media">
        <a class="pull-left avatarXSmall" href="#">
            <img class="media-object" src="${avatar}" alt="${displayName}">
        </a>
        <div class="media-body">
            <div class="pull-right">
                <span class="muted">${comment.createdTime.format("MMM dd, yyyy HH:mm")}</span>
                <span class="comment-action">
                    <%if(comment.author.username == currentUser.username && currentUser.username != "guest") {%>
                        <a href="#" class="action-link delete-comment" commen-id="${comment.id}"><i class="uiIconLightGray uiIconTrashMini"></i></a>
                    <%}%>
                </span>
            </div>
            <h6 class="media-heading"><a href="#">${displayName}</a></h6>
            <div>
                ${formattedComment}
            </div>
        </div>
    </li>
<%}
}%>