summaryrefslogtreecommitdiff
path: root/program/templates/week_schedule_timeslot.html
blob: f1f691819cb9cf84219afd0a9352c53c12a87083 (plain)
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
{% load timeslots %}

{% if forloop.first %}
    {% if timeslot.start.hour < 6 %}
        {# the day starts with the first show until its end #}
        <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" {% duration_until timeslot.end %}>
            <div><a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a></div>
        </div>
    {% else %}
        {# the day starts with a default show until the start of first show #}
        <div class="timeslot bf-{{ default_show.broadcastformat.slug }}" {% duration_until timeslot.start %}>
            <div>{{ default_show.name }}</div>
        </div>
        <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" {% duration timeslot.start timeslot.end %}>
            <div><a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a></div>
        </div>
    {% endif %}
    {% if timeslot.end != timeslot.get_next_by_start.start %}
        {# a default show is needed to fill the time until the next show #}
        <div class="timeslot bf-{{ default_show.broadcastformat.slug }}" {% duration timeslot.end timeslot.get_next_by_start.start %}>
            <div>{{ default_show.name }}</div>
        </div>
    {% endif %}
{% elif forloop.last %}
    {% if timeslot.end.hour < 6 %}
        {# the day ends with this show and a default show until 6 #}
        <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" {% duration timeslot.start timeslot.end %}>
            <div><a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a></div>
        </div>
        <div class="timeslot bf-{{ default_show.broadcastformat.slug }}" {% duration_since timeslot.end %}>
            <div>{{ default_show.name }}</div>
        </div>
    {% else %}
        {# the days ends with this show  #}
        <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" {% duration_since timeslot.start %}>
            <div><a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a></div>
        </div>
    {% endif %}
{% else %}
    <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" {% duration timeslot.start timeslot.end %}>
        <div><a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a></div>
    </div>
    {% if timeslot.end != timeslot.get_next_by_start.start %}
        {# a default show is needed to fill the time until the next show #}
        <div class="timeslot bf-{{ default_show.broadcastformat.slug }}" {% duration timeslot.end timeslot.get_next_by_start.start %}>
            <div>{{ default_show.name }}</div>
        </div>
    {% endif %}
{% endif %}