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

{% block breadcrumbs %}
{% if project %}
<li><a href="{{ project.get_absolute_url }}">{{ project.name }}</a></li>
{% if component %}
<li><a href="{{ component.get_absolute_url }}">{{ component.name }}</a></li>
{% endif %}
{% if language %}
<li><a href="{% url 'project-language' project=project.slug lang=language.code %}">{{ language }}</a></li>
{% endif %}
{% endif %}
<li><a href="{% if back_url %}{{ back_url }}#search{% else %}{% url 'search' %}{% endif %}">{% trans "Search" %}</a></li>
{% endblock %}

{% block content %}

{% if show_results %}
{% if page_obj.object_list %}
<table class="table table-bordered">
<tbody>
{% for unit in page_obj.object_list %}
<tr><th colspan="2">
<a href="{{ unit.translation.get_absolute_url }}">{{ unit.translation }}</a>
{% get_state_flags unit %}
</th></tr>
<tr>
<th class="source">{% trans "Source" %}</th>
<td><a href="{{ unit.get_absolute_url }}">{% format_translation unit.source unit.translation.component.project.source_language search_match=search_query %}</a></td>
</tr>
<tr>
<th class="source">{{ unit.translation.language }}</th>
<td><a href="{{ unit.get_absolute_url }}">{% format_translation unit.target unit.translation.language unit.translation.plural search_match=search_query %}</a></td>
</tr>
{% endfor %}
</tbody>
</table>

{% include "paginator.html" %}
{% else %}
{% trans "No matching strings found." as msg %}
{% show_message "info" msg %}
{% endif %}
{% endif %}

<form method="GET">
{% include "snippets/search-form.html" %}
</form>

{% endblock %}
