manager_view.html
2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{% extends "base.html" %}
{% block extrahead %}
  <script type="text/javascript" src="{{ MEDIA_URL }}js/manager-view.js"></script>
{% endblock %}
{% block title %}Słowniki{% endblock %}
{% block content %}
  <h3>Słowniki</h3>
  <p>
    <input type="text" id="new-vocabulary"/>
    <button id="add-vocabulary">
      dodaj słownik
    </button>
  </p>
  <div id="vocab-accordion">
    {% for vocab, managed, viewers, editors, managers in vocabularies_info %}
      <h3><a href="#">{{ vocab.id }}</a></h3>
      <div>
        <table class="user-privileges" id="vocab-privileges_{{ vocab.pk }}">
          <tr>
            <th></th>
            <th>ogląda</th>
            <th>modyfikuje</th>
            <th>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 }}"
                    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 }}"
                    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 }}"
                    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>
    {% endfor %}
  </div>
{% endblock %}