manage_classifications.html 2.18 KB
{% extends "base.html" %}
{% load dictionary_extras staticfiles i18n %}

{% block extrahead %}
    <link rel="stylesheet" type="text/css"
          href="{% static 'css/manage_classifications.css' %}"/>
    <script type="text/javascript"
            src="{% static 'js/manage-classifications.js' %}"></script>
{% endblock %}

{% block title %}{% trans 'Klasyfikacje' %}{% endblock %}

{% block content %}
    <form action="" method="post" class="add-classification">
        {% csrf_token %}
        {{ add_form.as_p }}
        <p>
            <button type="submit">{% trans 'Dodaj klasyfikację' %}</button>
        </p>
    </form>
    {% for classification, value_form, vocab_form, using in classification_forms %}
        <div class="classification">
            <div class="classification-controls">
                <form action="" method="post" class="add-value">
                    {% csrf_token %}
                    {{ value_form.as_p }}
                    <p>
                        <button type="submit">{% trans 'Dodaj wartość' %}</button>
                    </p>
                </form>
                <div class="vocabs">
                    <p>{% trans 'Używające słowniki' %}:</p>
                    {% if using %}
                        <ul>
                            {% for vocab in using %}
                                <li>{{ vocab.id }}</li>
                            {% endfor %}
                        </ul>
                    {% else %}
                        <p>{% trans 'brak' %}</p>
                    {% endif %}
                    <form action="" method="post">
                        {% csrf_token %}
                        {{ vocab_form.as_p }}
                        <p>
                            <button type="submit">{% trans 'Dodaj słownik' %}</button>
                        </p>
                    </form>
                </div>
            </div>
            <h4>{{ classification.name }}</h4>

            <p>{% trans 'Wartości' %}:</p>
            {% with tree=classification.value_tree %}
                {% if tree %}
                    {% value_tree tree %}
                {% endif %}
            {% endwith %}
        </div>
    {% endfor %}
{% endblock %}