{% load i18n %}
{% load translations %}
{% load permissions %}

<div class="panel panel-primary">
<div class="panel-heading">
<h4 class="panel-title">{% if history_title %}{{ history_title }}{% else %}{% trans "History" %}{% endif %}</h4>
</div>
<div class="panel-body">


<table class="table table-condensed">
<thead>
<tr>
<th>{% trans "When" %}</th>
<th>{% trans "User" %}</th>
<th>{% trans "Action" %}</th>
<th>{% trans "Translation" %}</th>
<th></th>
</tr>
<tbody>
{% for c in last_changes %}
<tr>
<td>{{ c.timestamp|naturaltime }}</td>
<td>{{ c.get_user_display }}</td>
<td><a href="{{ c.get_absolute_url }}">{{ c.get_action_display }}</a></td>
<td><a href="{{ c.get_translation_url }}">{{ c.get_translation_display }}</a></td>
<td></td>
</tr>
{% if c.can_revert %}
<tr>
<td colspan="4">{% format_translation c.target c.unit.translation.language %}</td>
<td>
{% can_translate request.user c.translation as user_can_translate %}
{% if user_can_translate %}
<a class="historybutton small-button" href="{{ c.translation.get_translate_url}}?{% if search_id %}sid={{ search_id }}&amp;offset={{ offset }}&amp;{% endif %}checksum={{ c.unit.checksum }}&amp;revert={{ c.id }}" title="{% trans "Revert to this translation" %}">{% trans "Revert" %}</a>
{% endif %}
</td>
</tr>
{% elif c.target %}
<tr>
<td colspan="4"><pre>{{ c.target }}</td>
<td></td>
</tr>
{% endif %}
{% empty %}
<tr><td colspan="4" class="tablenotice">
{% if not hide_browse %}
{% trans "No recent activity has been recorded." %}
{% else %}
{% trans "No matching activity has been found." %}
{% endif %}
</td></tr>
{% endfor %}
</tbody>
</table>
</div>
{% if not hide_browse or last_changes_rss %}
<div class="panel-footer">
{% if not hide_browse %}
<a class="btn btn-default" href="{% url 'changes' %}?{{ last_changes_url }}">{% trans "Browse changes" %}</a>
{% endif %}
{% if last_changes_rss %}
<a class="btn btn-default" href="{{ last_changes_rss }}">{% trans "Follow using RSS" %}</a>
{% endif %}
</div>
{% endif %}
</div>
