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

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



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

    {% breadcrumb "Languages" "core:language:overview" %}
    {% breadcrumb view_language "core: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>
            {% if config.show %}
                <span class="{% fa_class 'check' %} text-success"></span>
            {% else %}
                <span class="{% fa_class 'times' %}"></span>
            {% endif %}
        </td>
    </tr>
    {% endfor %}
</tbody>
</table>
{% endblock %}



{#          #}
{# Side bar #}
{#          #}
{% block sidebar %}
{% endblock %}



{#         #}
{# Options #}
{#         #}
{% block options %}
<div class="btn-group">
    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        <span class="{% fa_class 'cog' %}"></span>
        {% trans "Options" %}
    </button>
    <ul class="dropdown-menu">
        <li>
            <a href="{% url 'core:language:edit' view_language.id %}" class="wger-modal-dialog">
                <span class="{% fa_class 'pencil-square-o' %}"></span>
                {% trans "Edit" %}
            </a>
        </li>
        <li role="separator" class="divider"></li>
        <li>
            <a href="{% url 'core:language:delete' view_language.id %}" class="wger-modal-dialog">
                <span class="{% fa_class 'trash' %}"></span>
                {% trans "Delete" %}
            </a>
        </li>
    </ul>
</div>
{% endblock %}
