protocol-tops-include.html 3.84 KB
Newer Older
Robin Sonnabend's avatar
Robin Sonnabend committed
1
{% from "macros.html" import render_likes %}
Robin Sonnabend's avatar
Robin Sonnabend committed
2
3
4
5
<ul>
    {% if not protocol.has_nonplanned_tops() %}
        {% for default_top in protocol.protocoltype.default_tops %}
            {% if not default_top.is_at_end() %}
6
                {% set localtop = default_top.get_localtop(protocol) %}
7
8
9
10
11
12
13
14
15
16
17
18
19
20
                {% if localtop is not none %}
                  <li class="{{localtop.get_css_classes()|join(" ")}}" {% if localtop.is_expandable() %} id="localtop-{{localtop.id}}" title="{{localtop.description}}"{% endif %}>
                      {{default_top.name}}
                      {% if not protocol.is_done() and has_modify_right %}
                          <a href="{{url_for('edit_localtop', localtop_id=localtop.id)}}">Ändern</a>
                      {% endif %}
                      {% if has_private_view_right and localtop.description is not none and localtop.description|length > 0 %}
                          <span class="glyphicon glyphicon-info-sign"></span>
                          <pre id="localtop-{{localtop.id}}-description" class="expansion-text">
                              {{-localtop.description-}}
                          </pre>
                      {% endif %}
                  </li>
                {% endif %}
Robin Sonnabend's avatar
Robin Sonnabend committed
21
22
23
24
            {% endif %}
        {% endfor %}
    {% endif %}
    {% for top in protocol.tops %}
25
        <li{% if has_private_view_right and top.description is not none %} class="expansion-button" id="top-{{top.id}}" title="{{top.description}}"{% endif %}>
Robin Sonnabend's avatar
Robin Sonnabend committed
26
            {{top.name}}
Robin Sonnabend's avatar
Robin Sonnabend committed
27
            {% if not protocol.is_done() and has_modify_right %}
Robin Sonnabend's avatar
Robin Sonnabend committed
28
29
                ({{top.number}})
            {% endif %}
Robin Sonnabend's avatar
Robin Sonnabend committed
30
            {% if not protocol.is_done() and has_modify_right %}
Robin Sonnabend's avatar
Robin Sonnabend committed
31
                <a href="{{url_for('edit_top', top_id=top.id)}}">Ändern</a>
32
33
34
                <a href="{{url_for('move_top', top_id=top.id, diff=1, csrf_token=get_csrf_token())}}">Runter</a>
                <a href="{{url_for('move_top', top_id=top.id, diff=-1, csrf_token=get_csrf_token())}}">Hoch</a>
                <a href="{{url_for('delete_top', top_id=top.id, csrf_token=get_csrf_token())}}" onclick="return confirm('Bist du dir sicher, dass du den TOP {{top.name}} löschen möchtest?');">Löschen</a>
Robin Sonnabend's avatar
Robin Sonnabend committed
35
            {% endif %}
36
            {% if has_private_view_right and top.description is not none and top.description|length > 0 %}
Robin Sonnabend's avatar
Robin Sonnabend committed
37
38
39
40
41
                <span class="glyphicon glyphicon-info-sign"></span>
                <pre id="top-{{top.id}}-description" class="expansion-text">
                    {{-top.description-}}
                </pre>
            {% endif %}
Robin Sonnabend's avatar
Robin Sonnabend committed
42
            {{render_likes(top.likes, top_id=top.id)}}
Robin Sonnabend's avatar
Robin Sonnabend committed
43
44
45
46
47
        </li>
    {% endfor %}
    {% if not protocol.has_nonplanned_tops() %}
        {% for default_top in protocol.protocoltype.default_tops %}
            {% if default_top.is_at_end() %}
48
                {% set localtop = default_top.get_localtop(protocol) %}
49
50
51
52
53
54
55
56
57
58
59
60
61
62
                {% if localtop is not none %}
                  <li class="{{localtop.get_css_classes()|join(" ")}}" {% if localtop.is_expandable() %} id="localtop-{{localtop.id}}" title="{{localtop.description}}"{% endif %}>
                      {{default_top.name}}
                      {% if not protocol.is_done() and has_modify_right %}
                          <a href="{{url_for('edit_localtop', localtop_id=localtop.id)}}">Ändern</a>
                      {% endif %}
                      {% if has_private_view_right and localtop.description is not none and localtop.description|length > 0 %}
                          <span class="glyphicon glyphicon-info-sign"></span>
                          <pre id="localtop-{{localtop.id}}-description" class="expansion-text">
                              {{-localtop.description-}}
                          </pre>
                      {% endif %}
                  </li>
                {% endif %}
Robin Sonnabend's avatar
Robin Sonnabend committed
63
64
65
66
            {% endif %}
        {% endfor %}
    {% endif %}
</ul>