{% load translations %}
{% load i18n %}
{% load static %}
{% load crispy_forms_tags %}

{% for item in unitdata %}
<tbody class="zen-unit">
<tr id="row-status-{{ item.unit.checksum }}">
<td>{{ item.unit.position }}</td>
<td>
{% if item.unit.context %}
<div class="pull-right flip">
<label>{% trans "Context:" %}</label>
{{ item.unit.context }}
</div>
{% endif %}
{% get_location_links user.profile item.unit %}
</td>
<td>
<a href="{% url 'translate' project=object.component.project.slug component=object.component.slug lang=object.language.code %}?{{ search_url }}&amp;offset={{ item.offset }}" class="btn btn-xs btn-default pull-right flip" title="{% trans "Open in full editor" %}"><i class="fa fa-pencil"></i> {% trans "Edit" %}</a>
</td>
</tr>
{% if item.unit.comment %}
<tr id="row-comment-{{ item.unit.checksum }}">
<td></td>
<td colspan="2" class="translatetext">
    <label>{% trans "Source string comment" %}</label>
    {% format_translation item.unit.comment item.unit.translation.component.project.source_language %}
</td>
</tr>
{% endif %}
<tr id="row-source-{{ item.unit.checksum }}">
<td></td>
<td colspan="2" class="translatetext">

{% if item.unit.previous_source and item.unit.fuzzy %}
<div class="form-group">
<label>{% trans "Source change" %}</label>
{% format_translation item.unit.source item.unit.translation.component.project.source_language diff=item.unit.previous_source num_plurals=item.unit.translation.plural.number %}
</div>
{% endif %}

{% if item.secondary %}
{% for unit in item.secondary %}
<div class="form-group">
<label>{{ unit.translation.language }}</label>
{% format_translation unit.target unit.translation.language unit.translation.plural %}
</div>
{% endfor %}
{% endif %}

{% if not user.profile.hide_source_secondary or not item.secondary %}
{% format_translation item.unit.source item.unit.translation.component.project.source_language search_match=search_query num_plurals=item.unit.translation.plural.number unit=item.unit %}
{% endif %}

</td>
</tr>
<tr id="row-edit-{{ item.unit.checksum }}">
<td>
<i id="loading-{{ item.unit.checksum }}" class="fa fa-spinner fa-spin" style="display: none"></i>
<i id="status-{{ item.unit.checksum }}"></i>
</td>
<td colspan="2" class="translator">
{% crispy item.form %}
</td>
</tr>
</tbody>
{% endfor %}

{% if last_section %}
<tbody>
<tr><td colspan="3" id="last-section">
{% trans 'The translation has come to an end.' as msg %}
{% show_message 'info' msg %}
</td></tr>
</tbody>
{% endif %}
