manager_view.html 4.05 KB
{% extends "base.html" %}

{% load staticfiles i18n %}

{% block extrahead %}
    <script type="text/javascript"
            src="{% static 'js/manager-view.js' %}"></script>
{% endblock %}

{% block title %}{% trans 'Słowniki' %}{% endblock %}

{% block content %}
    <h3>{% trans 'Słowniki' %}</h3>
    <p>
        <input type="text" id="new-vocabulary"/>
        <button id="add-vocabulary">
            {% trans 'dodaj słownik' %}
        </button>
    </p>
    <div id="vocab-accordion">
        {% for vocab, managed, viewers, editors, managers in vocabularies_info %}
            {% with forloop.counter as vocab_no %}
            <h3><a href="#">{{ vocab.id }}</a></h3>
            <div>
                <table class="user-privileges"
                       id="vocab-privileges_{{ vocab.pk }}">
                    <tr>
                        <th></th>
                        <th>{% trans 'ogląda' %}</th>
                        <th>{% trans 'modyfikuje' %}</th>
                        <th>{% trans 'zarządza' %}</th>
                    </tr>
                    {% for u in users %}
                        <tr>
                            <td>{{ u.username }}</td>
                            <td>
                                {% if u.usersettings.views_lexeme %}
                                    <input
                                            type="checkbox"
                                            id="view-{{ u.pk }}-{{ vocab_no }}"
                                            class="checkbox-view"
                                            {% if u in viewers %}
                                            checked="checked"
                                            {% endif %}
                                            {% if u.usersettings.views_all_lexemes or not managed %}
                                            disabled="disabled"
                                            {% endif %}/>
                                {% else %}
                                    <input type="checkbox" disabled="disabled"/>
                                {% endif %}
                            </td>
                            <td>
                                {% if u.usersettings.changes_lexeme %}
                                    <input
                                            type="checkbox"
                                            id="change-{{ u.pk }}-{{ vocab_no }}"
                                            class="checkbox-change"
                                            {% if u in editors %}
                                            checked="checked"
                                            {% endif %}
                                            {% if not managed %}disabled="disabled"{% endif %}/>
                                {% else %}
                                    <input type="checkbox" disabled="disabled"/>
                                {% endif %}
                            </td>
                            <td>
                                {% if u.usersettings.manages_vocabulary %}
                                    <input
                                            type="checkbox"
                                            id="manage-{{ u.pk }}-{{ vocab_no }}"
                                            class="checkbox-manage"
                                            {% if u in managers %}
                                            checked="checked"
                                            {% endif %}
                                            {% if u == user or not managed or u.usersettings.manages_all_vocabs %}
                                            disabled="disabled"
                                            {% endif %}/>
                                {% else %}
                                    <input type="checkbox" disabled="disabled"/>
                                {% endif %}
                            </td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
            {% endwith %}
        {% endfor %}
    </div>
{% endblock %}