From 89a11ac5582e6a70bf2c6afca3135d009b973e85 Mon Sep 17 00:00:00 2001 From: Joel Addison Date: Sun, 15 Dec 2019 14:46:11 +1000 Subject: [PATCH] Update mobile schedule Display track details on talks if available. Show day end time slot as per desktop view. --- .../templates/symposion/schedule/_mobile.html | 44 +++++++++++++------ pinaxcon/templatetags/lca2018_tags.py | 3 ++ pinaxcon/templatetags/lca2019_tags.py | 4 +- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/pinaxcon/templates/symposion/schedule/_mobile.html b/pinaxcon/templates/symposion/schedule/_mobile.html index dd23f4a8..14d1157b 100644 --- a/pinaxcon/templates/symposion/schedule/_mobile.html +++ b/pinaxcon/templates/symposion/schedule/_mobile.html @@ -3,9 +3,9 @@ {% load waffle_tags %} +{% with timetable|day_has_tracks:timetable.day as has_tracks %} + {% for row in timetable %} -{% if forloop.last %} -{% else %} {% for slot in row.slots %}
{% if forloop.first %} @@ -13,31 +13,47 @@ {% endif %} {% with slot.kind.label.lower as label %} {% if label == "talk" or label == "tutorial" %} - {% if slot.content %} -

- {{ slot.content.title }} -
- {{ slot.content.speakers|join:", "}} -

- {% listlookup timetable.rooms forloop.counter0 as room_names %} -

{{ room_names }}
ends {{ slot.end }}

- {% endif %} + {% if slot.content %} +

+ {{ slot.content.title }} +
+ {{ slot.content.speakers|join:", "}} +

+ {% endif %} {% elif label == "shortbreak" %} {% else %} {% if slot.content_override %} {{ slot.content_override_html|safe }} - {% else %} + {% else %}
-

{{ slot.kind.label }}

+

{{ slot.kind.label }}

- {% endif %} + {% endif %} {% endif %} {% endwith %} +

+ {% if has_tracks %} + {% with slot.rooms|listlookup:forloop.counter0|trackname:timetable.day as track_name %} + {% if track_name %}{{ track_name }} — {% endif %} + {% endwith %} + {% endif %} + {{ slot.rooms|join:", "}} +
+ ends {{ slot.end }} +

+ {% if edit_schedule %} Edit {% endif %}
{% endfor %} +{% if forloop.last %} +
+

{{ row.time|date:"h:iA" }}

+

Day End

+
{% endif %} {% endfor %} + +{% endwith %} diff --git a/pinaxcon/templatetags/lca2018_tags.py b/pinaxcon/templatetags/lca2018_tags.py index b032f426..98d1bc1c 100644 --- a/pinaxcon/templatetags/lca2018_tags.py +++ b/pinaxcon/templatetags/lca2018_tags.py @@ -103,6 +103,9 @@ def day_has_tracks(timetable, day): @register.filter() def trackname(room, day): + if not room: + return None + try: track_name = room.track_set.get(day=day).name except Track.DoesNotExist: diff --git a/pinaxcon/templatetags/lca2019_tags.py b/pinaxcon/templatetags/lca2019_tags.py index 4ef7349a..c82bf67d 100644 --- a/pinaxcon/templatetags/lca2019_tags.py +++ b/pinaxcon/templatetags/lca2019_tags.py @@ -48,12 +48,12 @@ def any_is_void(invoices): return False -@register.simple_tag +@register.filter def listlookup(lookup, target): try: return lookup[target] except IndexError: - return '' + return None @register.filter