{% extends "base.html" %}
{% load i18n staticfiles wger_extras django_bootstrap_breadcrumbs %}

{% block title %}{{ view_language }}{% endblock %}



{% block breadcrumbs %}
    {{ block.super }}

    {% breadcrumb "Languages" "config:language:overview" %}
    {% breadcrumb view_language "config:language:view" view_language.pk %}
{% endblock %}



{% block content %}
<table class="table">
<thead>
    <tr>
        <th>{% trans "Language short name" %}</th>
        <th>{% trans "Language full name" %}</th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>{{view_language.short_name}}</td>
        <td>{{view_language.full_name}}</td>
    </tr>
</tbody>
</table>


<h4>{% trans "Configuration" %}</h4>
<p>{% blocktrans %}Use the configuration to select in what languages the
exercises and ingredients will be shown for the current language (for example
the exercises should be shown in languages A, B and C; the ingredients only
in A).{% endblocktrans %}</p>

<table class="table">
<thead>
    <tr>
        <th>{% trans "Language full name" %}</th>
        <th>{% trans "Show" %}</th>
    </tr>
</thead>
<tbody>
    {% for config in view_language.language_source.all %}
    {% ifchanged config.get_item_display %}
    <tr>
        <td colspan="2" class="active" style="text-align:center;">{{config.get_item_display}}</td>
    </tr>
    {% endifchanged %}
    <tr>
        <td>
            <a href="{% url 'config:language_config:edit' config.id %}" class="wger-modal-dialog">
            {{config.language_target.full_name}}
            </a>
        </td>
        <td>

            <img src="{% if config.show %}{% static 'images/icons/status-on.svg' %}{% else %}{% static 'images/icons/status-off.svg' %}{% endif %}"
                 width="16"
                 height="16"
                 alt="">
        </td>
    </tr>
    {% endfor %}
</tbody>
</table>
{% endblock %}



{% block sidebar %}
<h4>{% trans "Options" %}</h4>

<p>
    <a href="{% url 'config:language:edit' view_language.id %}"
       {% auto_link_css flavour "wger-modal-dialog" %}>
        <img src="{% static 'images/icons/edit.svg' %}"
             width="32"
             height="32"
             alt="{% trans 'Edit' %}"
             >
        {% trans "Edit" %}
    </a>
</p>

<p>
    <a href="{% url 'config:language:delete' view_language.id %}"
       {% auto_link_css flavour "wger-modal-dialog" %}>
        <img src="{% static 'images/icons/trash.svg' %}"
             width="32"
             height="32"
             alt="{% trans 'Delete' %}"
             >
        {% trans "Delete" %}
    </a>
</p>

{% endblock %}
