{% extends "base.html" %}
{% load url from future %}
{% load i18n %}
{% load translations %}
{% load static %}

{% block breadcrumbs %}
<li><a href="{{ object.project.get_absolute_url }}">{{ object.project }}</a></li>
<li><a href="{{ object.get_absolute_url }}">{{ object.name }}</a></li>
<li><a href="{% url 'show_source' project=object.project.slug subproject=object.slug %}">{% trans "source" %}</a></li>
<li><a href="{% url 'review_source' project=object.project.slug subproject=object.slug %}">{% trans "review" %}</a></li>
{% endblock %}

{% block content %}

<h2>{% trans "Strings to review" %}</h2>

<span class="navi-toolbar ui-widget-header ui-corner-all">
<span id="navi">
<a id="button-first" {% if sources.number == 1 %}class="button-disabled"{% endif %} href="?page=1&amp;type={{ rqtype }}">{% trans "First" %}</a>
<a id="button-prev" {% if not sources.has_previous %}class="button-disabled"{% else %}href="?page={{ sources.previous_page_number }}&amp;type={{ rqtype }}"{% endif %}>{% trans "Previous" %}</a>
<a id="button-pos" class="textbutton">{% blocktrans with sources.number as position and sources.paginator.num_pages as total %}{{ position }} / {{ total }}{% endblocktrans %}</a>
<a id="button-next" {% if not sources.has_next %}class="button-disabled"{% else %}href="?page={{ sources.next_page_number }}&amp;type={{ rqtype }}"{% endif %}>{% trans "Next" %}</a>
<a id="button-end" {% if sources.paginator.num_pages == sources.number %}class="button-disabled"{% endif %} href="?page={{ sources.paginator.num_pages }}&amp;type={{ rqtype }}">{% trans "Last" %}</a>
</span>
</span>

{% if sources.object_list %}
<table>
<thead>
<tr>
<td></td>
<th>{% trans "Source" %}</th>
<th>{% trans "Failing checks" %}</th>
</tr>
</thead>
<tbody>
{% for source in sources.object_list %}
{% with source.get_source_comments as comments %}
<tr>
<td class="expander">
<span class="ui-icon ui-icon-triangle-1-e expander-icon"></span>
</td>
<td class="translatetext expander">{{ source.source|fmttranslation }}</td>
<td>
{% show_checks source.active_source_checks user %}
{% if comments %}
<span class="check">{% trans "Comment" %}</span>
{% endif %}
</td>
</tr>
<tr class="hidden">
<td>
</td>
<td>
<table>
{% with source as unit %}
{% include "unit-details.html" %}
{% endwith %}
{% if comments %}
<tr><th colspan="2">{% trans "User comments" %}</th></tr>
{% include "list-comments.html" %}
{% endif %}
<tr class="details"><td colspan="2"><a href="{% url 'js-detail' project=object.project.slug subproject=object.slug checksum=source.checksum %}" class="load-details"></a><img src="{% get_media_prefix %}loading.gif" /></td></tr>
</table>
</td>
<td>
</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% trans "No matching source strings found!" %}</p>
{% endif %}

{% endblock %}
