<tal:block tal:condition="here/discussion"
    tal:define="comments_list here/get_comments_list;
                current_version options/current_version|nothing">
    <hr class="hr_addcomment" />
    <div class="commentbox_add" tal:condition="here/checkPermissionAddComments">
        <a tal:attributes="href string:${here/absolute_url}/comment_add_html"
            i18n:translate="" class="addcomment button-like">Add comment</a>
    </div>
    <div class="commentbox_add" tal:condition="not: here/checkPermissionAddComments">
        <a class="logincomment"
           tal:define="site_url python:here.getSite().absolute_url();
                       login_url string:${site_url}/login_html;
                       here_url here/absolute_url"
           tal:attributes="href string:${login_url}?came_from=${here_url}"
           i18n:translate="">Login to add a comment</a>
    </div>
    <tal:block repeat="item comments_list">
        <div tal:attributes="id string:comment-${item/getId}"
                 tal:condition="python: not item.spamstatus and
                                        (not current_version or
                                            current_version['timestamp'] < item.releasedate)"
                 class="comment-holder comment_box">
            <span tal:content="item/title" class="commentbox_title">Comment title here</span>
            <br /><br />
            <span style="font-size:95%;">
                <span tal:replace="structure item/body" />
            </span>
            <hr class="hr_inside_comment" />
            <a tal:condition="here/checkPermissionManageComments"
                tal:attributes="href string:${here/absolute_url}/comment_del?id=${item/id}"
                i18n:translate="" class="deletecomment commentbutton">
                Delete comment</a>
                    <a tal:condition="python: here.checkPermissionManageComments() and not item.spamstatus"
                       tal:attributes="href string:${here/absolute_url}/comment_spam_status?id=${item/id}&status=True"
                       i18n:translate=""
                       class="commentbutton markbutton">
                        Mark as junk
                    </a>
            <span class="commentbox_content">
                <span tal:omit-tag="" i18n:translate="">Posted by</span>
                <span tal:replace="item/author" />
                <span tal:omit-tag="" i18n:translate="">at</span>
                <span tal:replace="python:here.utShowFullDateTime(item.releasedate)" />
            </span>
        </div>
        <div tal:condition="python: item.spamstatus and not here.checkPermissionManageComments()" class="comment-holder-blocked comment-holder comment_box">
            <span class="commentbox_title" i18n:translate="">Junk comment</span>
        </div>
        <div tal:condition="python: item.spamstatus and here.checkPermissionManageComments()" class="comment-holder-blocked comment-holder comment_box">
            <span class="commentbox_title">
                <span class="comment-label-blocked" i18n:translate="">
                    Junk comment
                </span>
                &middot;
                <span tal:replace="item/title" />
            </span>
            <br /><br />
            <span style="font-size:95%;">
                    <span tal:replace="structure item/body" />
            </span>
            <hr class="hr_inside_comment" />
            <a tal:condition="here/checkPermissionManageComments"
                    tal:attributes="href string:${here/absolute_url}/comment_del?id=${item/id}"
                    i18n:translate="" class="deletecomment commentbutton">
                    Delete comment</a>
            <a tal:condition="python: here.checkPermissionManageComments() and item.spamstatus"
               tal:attributes="href string:${here/absolute_url}/comment_spam_status?id=${item/id}&status=False"
               i18n:translate=""
               class="commentbutton markbutton">
                Mark as valid
            </a>
            <span class="commentbox_content">
                    <span tal:omit-tag="" i18n:translate="">Posted by</span>
                    <span tal:replace="item/author" />
                    <span tal:omit-tag="" i18n:translate="">at</span>
                    <span tal:replace="python:here.utShowFullDateTime(item.releasedate)" />
            </span>
        </div>
    </tal:block>
    <tal:block condition="options/versions|nothing">
        <h3 id="older-header" i18n:translate="" style="display:none">
            Comments for older versions of this document
        </h3>
        <tal:block repeat="item comments_list">
            <div tal:define="version python:current_version['ob'].version_at_date(item.releasedate)"
                tal:attributes="id string:comment-${item/getId}"
                tal:condition="python: not item.spamstatus and
                                        current_version['timestamp'] > item.releasedate"
                class="comment-holder comment_box older" style="display:none">
                <span tal:content="item/title" class="commentbox_title">Comment title here</span>
                <em i18n:translate="">given for the version from</em>
                <em tal:content="version/pretty_timestamp"></em>
                (<a tal:content="version/filename"
                    tal:attributes="href version/url" />
                    <tal:block condition="not:version/url" i18n:translate="">
                        - this version was removed
                    </tal:block>)
                <br /><br />
                <span style="font-size:95%;">
                    <span tal:replace="structure item/body" />
                </span>
                <hr class="hr_inside_comment" />
                <a tal:condition="here/checkPermissionManageComments"
                    tal:attributes="href string:${here/absolute_url}/comment_del?id=${item/id}"
                    i18n:translate="" class="deletecomment commentbutton">
                    Delete comment</a>
                        <a tal:condition="python: here.checkPermissionManageComments() and not item.spamstatus"
                           tal:attributes="href string:${here/absolute_url}/comment_spam_status?id=${item/id}&status=True"
                           i18n:translate=""
                           class="commentbutton markbutton">
                            Mark as junk
                        </a>
                <span class="commentbox_content">
                    <span tal:omit-tag="" i18n:translate="">Posted by</span>
                    <span tal:replace="item/author" />
                    <span tal:omit-tag="" i18n:translate="">at</span>
                    <span tal:replace="python:here.utShowFullDateTime(item.releasedate)" />
                </span>
            </div>
        </tal:block>
        <p id="showolder" i18n:translate="" style="display:none">
            [<a href="javascript:void(0);">Show comments for other versions of this document</a>]
        </p>
    </tal:block>
</tal:block>
