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

{% block breadcrumbs %}
<li><a href="{{ project.get_absolute_url }}">{{ project.name }}</a></li>
{% if component %}
<li><a href="{{ component.get_absolute_url }}">{{ component.name }}</a></li>
{% if translation %}
<li><a href="{{ translation.get_absolute_url }}">{{ translation.language }}</a></li>
{% endif %}
{% endif %}
<li>{% trans "Search and replace" %}</li>
{% endblock %}

{% block content %}

{% trans "Please review and confirm the search and replace results." as msg %}
{% show_message "info" msg %}

{% if limited %}
{% trans "Showing and replacing only the first 250 matches. Perform the replacement again to replace more entries." as msg %}
{% show_message "warning" msg %}
{% endif %}

<form method="POST">
{% csrf_token %}
{{ form.search.as_hidden }}
{{ form.replacement.as_hidden }}
{{ confirm.confirm }}

<table class="table">
{% for unit in matching %}
<tr>
<td rowspan="3">
<input type="checkbox" name="units" checked="1" value="{{ unit.pk }}" id="confirm_{{ unit.pk }}" />
</td>
<td>
<a href="{{ unit.get_absolute_url }}" class="btn btn-link btn-xs" title="{% trans "Edit" %}">{% icon "pencil.svg" %}</a>
<label for="confirm_{{ unit.pk }}">{{ unit.translation }}: {{ unit.position }}{% if unit.context %}({{ unit.context }}){% endif %}</label>
</td>
</tr>
<tr>
<td>{% format_translation unit.target unit.translation.language unit.translation.plural search_match=search_query match='replaced'%}</td>
</tr>
<tr>
<td>{% format_translation unit.replacement unit.translation.language unit.translation.plural search_match=replacement match='replacement' %}</td>
</tr>
{% endfor %}
</table>
<input type="submit" class="btn btn-primary" value="{% trans "Replace" %}" />
</form>

{% endblock %}

