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

<table class="table table-condensed history">
<thead>
<tr>
<th>{% trans "When" %}</th>
<th>{% trans "User" %}</th>
<th>{% trans "Action" %}</th>
<th>{% trans "Detail" %}</th>
<th>{% trans "Object" %}</th>
<th></th>
</tr>
<tbody>
{% for c in last_changes %}
<tr class="{% cycle 'stripe-odd' 'stripe-even' as rowcolors %}">
<td> {{ c.timestamp|naturaltime }}</td>
<td>{% if hide_links %}{{ c.get_user_text_display }}{% else %}{{ c.get_user_display }}{% endif %}</td>
<td><a href="{{ current_site_url }}{{ c.get_absolute_url }}">{{ c.get_action_display }}</a></td>
<td>{{ c.get_details_display }}</td>
<td><a href="{{ current_site_url }}{{ c.get_translation_url }}">{{ c.get_translation_display }}</a></td>
<td>{% if c.can_revert %}
<tr class="{{ rowcolors }}">
<td colspan="5">{% format_translation c.target c.unit.translation.language c.unit.translation.plural diff=c.old %}</td>
<td>
{% if not hide_links %}
{% perm 'unit.edit' c.unit as user_can_translate %}
{% if user_can_translate %}
<a class="btn btn-xs btn-primary" href="{{ current_site_url }}{{ c.translation.get_translate_url}}?{% if search_url %}{{ search_url }}&amp;offset={{ offset }}&amp;{% endif %}checksum={{ c.unit.checksum }}&amp;revert={{ c.id }}" title="{% trans "Revert to this translation" %}">{% trans "Revert" %}</a>
{% endif %}
{% endif %}
{% elif c.show_content %}
<tr class="{{ rowcolors }}">
<td colspan="5">{% format_translation c.target c.unit.translation.language c.unit.translation.plural %}</td>
<td>
{% elif c.show_source %}
<tr class="{{ rowcolors }}">
<td colspan="5">{% format_translation c.target c.component.project.source_language diff=c.old %}</td>
<td>
{% elif c.target %}
<tr class="{{ rowcolors }}">
<td colspan="5"><pre>{{ c.target }}</pre></td>
<td>
{% endif %}
{% if debug %}
<a class="btn btn-xs btn-primary" href="{{ current_site_url }}{% url 'show_change' pk=c.pk %}">{% trans "View notification" %}</a>
{% endif %}
</td>
</tr>
{% empty %}
<tr><td colspan="5" class="tablenotice">
{% trans "No matching activity found." %}
</td></tr>
{% endfor %}
</tbody>
</table>
