{% load log %}
{% load i18n %}

<style type="text/css">
.action-list {
    list-style: none;
    margin-left: 0;
    color: #999;
}
.action-list li {
    margin-bottom: 5px;
}
.action-list .action-user {
    color: #000;
}
.action-list .action-time {
    font-size: 0.9em;
}
</style>

{% if request.user.is_superuser %}
    {% get_admin_log 5 as admin_log %}
{% else %}
    {% get_admin_log 5 as admin_log for_user user %}
{% endif %}

{% if not admin_log %}
    <p>{% trans "There isn\'t any history available for the admin." %}</p>
{% else %}
    <ul class="action-list">
    {% for entry in admin_log %}
        <li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}">
            <span class="action-user">{{ entry.user }}</span>
            <span class="action-type">
                {% if entry.is_addition %}
                    added
                {% endif %}
                {% if entry.is_change %}
                    changed
                {% endif %}
                {% if entry.is_deletion %}
                    deleted
                {% endif %}
            </span>
            {% if entry.content_type %}
                <span class="action-object-type">
                    {% trans entry.content_type.name %}</span>
                </span>
            {% endif %}
            <span class="action-object">
                {% if entry.is_deletion %}
                    {{ entry.object_repr }}
                {% else %}
                    <a href="{{ base_url }}{{ entry.get_admin_url }}">{{ entry.object_repr }}</a>
                {% endif %}
            </span>
            <span class="action-time">
                {{ entry.action_time|timesince }} ago
            </span>
        </li>
    {% endfor %}
    </ul>
{% endif %}