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

{% block content %}

{% perm 'source.edit' project as user_can_edit_source %}

{% include "paginator.html" %}

{% if page_obj.object_list %}
<table class="table">
<thead>
<tr>
<td></td>
<th>{% trans "Source" %}</th>
<th>{% trans "Context" %}</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.component.project.source_language %}</td>
<td class="translatetext expander">{% if source.context %}{% format_translation source.context source.translation.component.project.source_language %}{% endif %}</td>
<td class="source-checks">
<div class="list-group">
{% if ignored %}
{% include "snippets/list-checks.html" with object=source.translation.component.project checks=source.source_checks %}
{% else %}
{% include "snippets/list-checks.html" with object=source.translation.component.project checks=source.active_source_checks %}
{% endif %}
    </div>
{% 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 component=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 %}
