<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      lang="en"
      metal:use-macro="context/main_template/macros/master"
      i18n:domain="zopyx.plone.smashdocs">
<body>

<metal:override fill-slot="top_slot"
    tal:define="disable_column_one python:request.set('disable_plone.leftcolumn',1);
                disable_column_two python:request.set('disable_plone.rightcolumn',1);"/>

<metal:main fill-slot="content-core">

    <link rel="stylesheet" type="text/css" tal:attributes="href string:${portal_url}/++resource++zopyx.plone.smashdocs/styles.css"/>

    <div style="margin-bottom: 1em">
        <span class="label" i18n:translate="">Group ID</span>:
        <span tal:content="context/group_id | nothing" />
    </div>

    <a tal:attributes="href string:${context/absolute_url}/++add++SmashDocument">
        <button i18n:translate="">New document</button>
    </a>
    <br/>
    <br/>

    <tal:loop repeat="mode python: ('draft', 'review')">

        <tal:def define="rows python: view.get_documents(mode)">

            <table class="listing" tal:condition="rows">
                <caption>
                    <span tal:content="mode"/>
                    (<span tal:content="python: len(rows)"/>)
                <thead>
                    <tr>
                        <th i18n:translate="">Title</th>
                        <th i18n:translate="">Status</th>
                        <th i18n:translate="">Archived</th>
                        <th i18n:translate="">Creator</th>
                        <th i18n:translate="">Group</th>
                        <th i18n:translate="">Unread conversation changes</th>
                        <th i18n:translate="">Unread section changes</th>
                        <th i18n:translate="">Open document</th>
                    </tr>
                </thead>
                <tbody>
                    <tr tal:repeat="row rows">
                        <td>
                            <a tal:attributes="href string:${context/absolute_url}/redirect-document?document_id=${row/id}" tal:content="row/title"/>
                            <br/>
                            <a tal:condition="python: mode=='draft'"
                                tal:attributes="href string:${context/absolute_url}/delete-document?document_id=${row/id}">
                                Delete
                            </a>
                        </td>
                        <td tal:content="row/status"/>
                        <td tal:content="row/archived"/>
                        <td tal:content="row/creatorId"/>
                        <td tal:content="row/groupId"/>
                        <td tal:content="row/hasUnreadConversationChanges"/>
                        <td tal:content="row/hasUnreadSectionChanges"/>
                        <td tal:content="row/hasOpenedDocument"/>
                    </tr>
                </tbody>
            </table>
        </tal:def>
    </tal:loop>

</metal:main>

</body>
</html>

