list.pt 3.28 KB
<div metal:use-macro="load: ../layout-menu.pt">

    <div metal:fill-slot="content" i18n:domain="user">
        <h1 i18n:translate="">Users</h1>

        <form method="post" action="/user">
            <table class="table table-striped table-hover">
                <thead>
                    <tr>
                        <th i18n:translate="">Group</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>
                            <select id="gid" name="gid" class="form-control">
                                <option/>
                                <option
                                    i18n:translate=""
                                    tal:repeat="group groups"
                                    tal:attributes="value group.id; selected
                                    str(group.id) == request.GET.get('gid')">
                                    ${group.group_name}
                                </option>
                            </select>
                        </td>
                        <td>
                            <input type="submit" name="submit" value="Show"
                                class="btn btn-primary"
                                i18n:attributes="value">
                        </td>

                    </tr>
                </tbody>
            </table>
        </form>

        <p tal:condition="not count" i18n:translate="">No result</p>
        <p tal:condition="count" i18n:translate="user-result">
            <span tal:replace="count" i18n:name="count"/> rows
        </p>

        <table class="table table-striped table-hover" tal:condition="count">
            <thead>
                <tr>
                    <th i18n:translate="">Email</th>
                    <th i18n:translate="">Username</th>
                    <th i18n:translate="">Status</th>
                    <th i18n:translate="">Last login</th>
                    <th i18n:translate="">Registered date</th>
                    <th colspan="2"/>
                </tr>
            </thead>
            <tbody>
                <tr tal:repeat="user users">
                    <td tal:content="user.email"/>
                    <td tal:content="user.user_name"/>
                    <td tal:condition="user.status" i18n:translate="">Active</td>
                    <td tal:condition="not user.status"/>
                    <td tal:condition="user.last_login_date"
                        tal:content="user.last_login_date.strftime('%d-%m-%Y
                        %H:%M:%S %z')"/>
                    <td tal:condition="not user.last_login_date"/>
                    <td tal:content="user.registered_date.strftime('%d-%m-%Y %H:%M:%S %z')"/>
                    <td>
                        <a href="/user/${user.id}" i18n:translate="">Edit</a>
                    </td>
                    <td tal:condition="user.id > 1 and user.id != request.user.id">
                        <a href="/user/${user.id}/delete" i18n:translate="">Delete</a>
                    </td>
                    <td tal:condition="user.id <= 1" i18n:translate="">System</td>
                    <td tal:condition="user.id > 1 and user.id == request.user.id" i18n:translate="">You</td>
                </tr>
            </tbody>
        </table>
    </div>

</div>