diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/templates/week_schedule.html | 10 | ||||
-rw-r--r-- | program/templates/week_schedule_timeslot.html | 20 | ||||
-rw-r--r-- | program/templatetags/timeslots.py | 17 |
3 files changed, 30 insertions, 17 deletions
diff --git a/program/templates/week_schedule.html b/program/templates/week_schedule.html index ad6b012..d64a0d3 100644 --- a/program/templates/week_schedule.html +++ b/program/templates/week_schedule.html @@ -25,7 +25,12 @@ <div style="height: 60px;">09:00</div> <div style="height: 60px;">10:00</div> <div style="height: 60px;">11:00</div> + {% if current_year == '2020' and current_week >= '05' %} + <div style="height: 30px;">12:00</div> + <div style="height: 55px;">12:05</div> + {% else %} <div style="height: 60px;">12:00</div> + {% endif %} <div style="height: 60px;">13:00</div> <div style="height: 60px;">14:00</div> <div style="height: 60px;">15:00</div> @@ -101,7 +106,12 @@ <div style="height: 60px;">09:00</div> <div style="height: 60px;">10:00</div> <div style="height: 60px;">11:00</div> + {% if current_year == '2020' and current_week >= '05' %} + <div style="height: 30px;">12:00</div> + <div style="height: 55px;">12:05</div> + {% else %} <div style="height: 60px;">12:00</div> + {% endif %} <div style="height: 60px;">13:00</div> <div style="height: 60px;">14:00</div> <div style="height: 60px;">15:00</div> diff --git a/program/templates/week_schedule_timeslot.html b/program/templates/week_schedule_timeslot.html index a96f2bb..532f750 100644 --- a/program/templates/week_schedule_timeslot.html +++ b/program/templates/week_schedule_timeslot.html @@ -1,61 +1,61 @@ {% load timeslots %} {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} - <div class="timeslot bf-{{ default_show.broadcastformat.slug }}" {% duration_until timeslot.start %}> + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}" style="height: {% height_until timeslot.start %}px;"> <div>{{ default_show.name }}</div> </div> {% endif %} {% if forloop.first and timeslot.start == timeslot.get_next_by_start.end and timeslot.start != "06:00" %} - <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" {% duration timeslot.start timeslot.end %}> + <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" style="height: {% height timeslot.start timeslot.end %}px;"> <div><a href="{% url "timeslot-detail" timeslot.id %}">{{ timeslot.show.name }}</a></div> </div> {% endif %} {% if forloop.first and timeslot.start != "06:00" and timeslot.show == default_show %} - <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" {% duration_until timeslot.end %}> + <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" style="height: {% height_until timeslot.end %}px;"> <div><a href="{% url "timeslot-detail" timeslot.id %}">{{ timeslot.show.name }}</a></div> </div> {% endif %} {% if forloop.first and timeslot.start != "06:00" and timeslot.show != default_show %} - <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" {% duration timeslot.start timeslot.end %}> + <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" style="height: {% height timeslot.start timeslot.end %}px;"> <div><a href="{% url "timeslot-detail" timeslot.id %}">{{ timeslot.show.name }}</a></div> </div> {% endif %} {% if forloop.first and timeslot.end != timeslot.get_next_by_start.start %} - <div class="timeslot bf-{{ default_show.broadcastformat.slug }}" {% duration timeslot.end timeslot.get_next_by_start.start %}> + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}" style="height: {% height timeslot.end timeslot.get_next_by_start.start %}px;"> <div>{{ default_show.name }}</div> </div> {% endif %} {% if not forloop.first and not forloop.last %} - <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" {% duration timeslot.start timeslot.end %}> + <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" style="height: {% height timeslot.start timeslot.end %}px;"> <div><a href="{% url "timeslot-detail" timeslot.id %}">{{ timeslot.show.name }}</a></div> </div> {% if timeslot.end != timeslot.get_next_by_start.start %} - <div class="timeslot bf-{{ default_show.broadcastformat.slug }}" {% duration timeslot.end timeslot.get_next_by_start.start %}> + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}" style="height: {% height timeslot.end timeslot.get_next_by_start.start %}px;"> <div>{{ default_show.name }}</div> </div> {% endif %} {% endif %} {% if forloop.last and timeslot.end != "06:00" and timeslot.show == default_show %} - <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" {% duration_since timeslot.start %}> + <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" style="height: {% height_since timeslot.start %}px;"> <div><a href="{% url "timeslot-detail" timeslot.id %}">{{ timeslot.show.name }}</a></div> </div> {% endif %} {% if forloop.last and timeslot.end != "06:00" and timeslot.show != default_show %} - <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" {% duration timeslot.start timeslot.end %}> + <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}" style="height: {% height timeslot.start timeslot.end %}px;"> <div><a href="{% url "timeslot-detail" timeslot.id %}">{{ timeslot.show.name }}</a></div> </div> {% endif %} {% if forloop.last and timeslot.end != timeslot.get_next_by_start.start %} - <div class="timeslot bf-{{ default_show.broadcastformat.slug }}" {% duration_since timeslot.end %}> + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}" style="height: {% height_since timeslot.end %}px;"> <div>{{ default_show.name }}</div> </div> {% endif %} diff --git a/program/templatetags/timeslots.py b/program/templatetags/timeslots.py index 08e45b1..9b6712a 100644 --- a/program/templatetags/timeslots.py +++ b/program/templatetags/timeslots.py @@ -6,20 +6,23 @@ register = template.Library() @register.simple_tag -def duration(start, end): - return 'style="height: %dpx"' % ((end-start).seconds/60) +def height(start, end): + if start.year == 2020 and int(start.strftime('%V')) >= 5 and start.hour == 12 and start.minute == 0: + return '30' + else: + return '%d' % ((end - start).seconds / 60) @register.simple_tag -def duration_until(end): +def height_until(end): start = datetime.combine(end.date(), time(6, 0)) - return 'style="height: %dpx"' % ((end-start).seconds/60) + return '%d' % ((end - start).seconds / 60) @register.simple_tag -def duration_since(start): +def height_since(start): if start.time() < time(23, 59): - end = datetime.combine(start.date()+timedelta(days=1), time(6, 0)) + end = datetime.combine(start.date() + timedelta(days=1), time(6, 0)) else: end = datetime.combine(start.date(), time(6, 0)) - return 'style="height: %dpx"' % ((end-start).seconds/60) + return '%d' % ((end - start).seconds / 60) |