{#
    Display user's recent changes starting with most recent. Include icon
    indicating last action or a link to a diff if a text item was changed, a
    link to display item or deleted item, date, size, rev number, and comments.
#}

{% extends theme("layout.html") %}
{% import "utils.html" as utils with context %}

{% block content %}
    <h1>{{ _('My Changes') }}</h1>
    {% if my_changes %}
        {{ utils.page_links(page_num, pages, url) }}
        <div class="moin-clr"></div>
        <div class="moin-mychanges">
            <table class="zebra">
                <thead>
                    <tr>
                        <th>{{ _("Diff") }}</th>
                        <th>{{ _("Name or ID ~(Old Name)") }}</th>
                        <th>{{ _("Timestamp") }}</th>
                        <th class="moin-integer">{{ _("Size") }}</th>
                        <th class="moin-integer">{{ _("Rev.") }}</th>
                        <th>{{ _("Comment and/or `Summary`") }}</th>
                    </tr>
                </thead>

                <tbody>
                    {%- for doc in my_changes %}
                        {% set comment =  doc.comment %}
                        {% if doc.summary %}
                            {% set comment = comment + '`' + doc.summary + '`' %}
                        {% endif %}
                        <tr>
                            {#- create an icon with a link to diff, or other icon indicating state of item #}
                            <td class="moin-history-links">{{- utils.item_status_icon(doc.fqnames[0], doc, None) -}}</td>
                            {#- show item name or item id and old name if the item is deleted/nameless #}
                            <td class="moin-history-item moin-wordbreak">{{ utils.item_moniker(doc, doc.fqnames) }}</td>
                            <td>{{ doc.mtime|time_datetime }}</td>
                            <td class="moin-integer">{{ doc.size }}</td>
                            <td class="moin-integer">{{ doc.rev_number  or doc.revid|shorten_id }}</td>
                            <td class="moin-wordbreak">{{ comment }}</td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        {{ utils.page_links(page_num, pages, url) }}
    {% else %}
        <p class='moin-flash moin-flash-javascript moin-flash-error'>{{ _("No changes found.") }}</p>
    {% endif %}
{% endblock %}
