{% extends "base.html" %}
{% load i18n %}
{% load translations %}
{% load static %}
{% load permissions %}

{% 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 strings" %}</a></li>
<li><a href="{% url 'review_source' project=object.project.slug subproject=object.slug %}">{% trans "review" %}</a></li>
{% endblock %}

{% block content %}

{% can_edit_priority user project as user_can_edit_priority %}

{% include "paginator.html" %}

{% if page_obj.object_list %}
<table class="table">
<thead>
<tr>
<td></td>
<th>{% trans "Source" %}</th>
<th>{% trans "Priority" %}</th>
<th>{% trans "Failing checks" %}</th>
</tr>
</thead>
<tbody>
{% for source in page_obj.object_list %}
{% with source.get_source_comments as comments %}
<tr>
<td class="expander {% if expand %}auto-expand{% endif %}">
<a><i class="fa fa-chevron-right expand-icon"></i></a>
</td>
<td class="translatetext expander">{% format_translation source.source source.translation.subproject.project.source_language %}</td>
<td>{{ source.source_info.get_priority_display }}{% if user_can_edit_priority %} <a class="button smallbutton edit-priority" href="{% url 'edit_priority' pk=source.source_info.pk %}" data-priority="{{ source.source_info.priority }}"><i class="fa fa-pencil"></i></a>{% endif %}</td>
<td class="source-checks">
{% if ignored %}
{% show_checks source.translation.subproject.project source.source_checks user %}
{% else %}
{% show_checks source.translation.subproject.project source.active_source_checks user %}
{% endif %}
{% if comments %}
<div class="alert alert-info check">{% trans "Comment" %}</div>
{% endif %}
</td>
</tr>
<tr style="display: none">
<td>
</td>
<td colspan="3" class="details-content">
<a href="{% url 'js-detail' project=object.project.slug subproject=object.slug checksum=source.checksum %}?next={{ request.get_full_path|urlencode }}" class="load-details"></a>
<i class="fa fa-spinner fa-spin"></i>
</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>

{% include "paginator.html" %}
{% else %}
<p>{% trans "No matching source strings found." %}</p>
{% endif %}

{% endblock %}
