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

{% perm 'screenshot.edit' object.component as user_can_change_screenshot %}

{% for source in sources %}
{% with source.unit as unit %}
{% if unit %}
<tr>
<td class="translatetext">{% format_translation unit.source unit.translation.component.project.source_language %}</td>
<td>
<a href="{{ source.get_absolute_url }}?checksum={{ unit.checksum }}" class="btn btn-primary"><i class="fa fa-search"></i> {% trans "View" %}</a>
</td>
{% if user_can_change_screenshot %}
<td>
<form action="{% url 'screenshot-remove-source' pk=object.pk %}" method="POST">
{% csrf_token %}
<input type="hidden" name="source" value="{{ source.pk }}" />
<button type="submit" class="btn btn-danger"><i class="fa fa-trash"></i> {% trans "Remove" %}</button>
</form>
{% endif %}
</td>
</tr>
{% endif %}
{% endwith %}
{% empty %}
<tr class="warning">
<td colspan="2">{% trans "No source strings are currently assigned!" %}</td>
</tr>
{% endfor %}

