Update mobile schedule

Display track details on talks if available.
Show day end time slot as per desktop view.
This commit is contained in:
Joel Addison 2019-12-15 14:46:11 +10:00
parent 0faf935653
commit 89a11ac558
3 changed files with 35 additions and 16 deletions

View file

@ -3,9 +3,9 @@
{% load waffle_tags %} {% load waffle_tags %}
{% with timetable|day_has_tracks:timetable.day as has_tracks %}
{% for row in timetable %} {% for row in timetable %}
{% if forloop.last %}
{% else %}
{% for slot in row.slots %} {% for slot in row.slots %}
<div class="mobile-slot my-3"> <div class="mobile-slot my-3">
{% if forloop.first %} {% if forloop.first %}
@ -13,31 +13,47 @@
{% endif %} {% endif %}
{% with slot.kind.label.lower as label %} {% with slot.kind.label.lower as label %}
{% if label == "talk" or label == "tutorial" %} {% if label == "talk" or label == "tutorial" %}
{% if slot.content %} {% if slot.content %}
<p> <p>
<a href="{% url "schedule_presentation_detail" slot.content.pk %}">{{ slot.content.title }}</a> <a href="{% url "schedule_presentation_detail" slot.content.pk %}">{{ slot.content.title }}</a>
<br> <br>
{{ slot.content.speakers|join:", "}} {{ slot.content.speakers|join:", "}}
</p> </p>
{% listlookup timetable.rooms forloop.counter0 as room_names %} {% endif %}
<p><em>{{ room_names }}<br />ends {{ slot.end }}</em></p>
{% endif %}
{% elif label == "shortbreak" %} {% elif label == "shortbreak" %}
{% else %} {% else %}
{% if slot.content_override %} {% if slot.content_override %}
{{ slot.content_override_html|safe }} {{ slot.content_override_html|safe }}
{% else %} {% else %}
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<p>{{ slot.kind.label }}</p> <p>{{ slot.kind.label }}</p>
</div> </div>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endwith %} {% endwith %}
<p><em>
{% if has_tracks %}
{% with slot.rooms|listlookup:forloop.counter0|trackname:timetable.day as track_name %}
{% if track_name %}{{ track_name }} &mdash; {% endif %}
{% endwith %}
{% endif %}
{{ slot.rooms|join:", "}}
<br />
ends {{ slot.end }}
</em></p>
{% if edit_schedule %} {% if edit_schedule %}
<a class="btn btn-secondary btn-sm edit-slot" role="button" data-action="{% url "schedule_slot_edit" schedule.section.slug slot.pk %}" href="#">Edit</a> <a class="btn btn-secondary btn-sm edit-slot" role="button" data-action="{% url "schedule_slot_edit" schedule.section.slug slot.pk %}" href="#">Edit</a>
{% endif %} {% endif %}
</div> </div>
{% endfor %} {% endfor %}
{% if forloop.last %}
<div class="mobile-slot my-3">
<h3>{{ row.time|date:"h:iA" }}</h3>
<p><em>Day End</em></p>
</div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endwith %}

View file

@ -103,6 +103,9 @@ def day_has_tracks(timetable, day):
@register.filter() @register.filter()
def trackname(room, day): def trackname(room, day):
if not room:
return None
try: try:
track_name = room.track_set.get(day=day).name track_name = room.track_set.get(day=day).name
except Track.DoesNotExist: except Track.DoesNotExist:

View file

@ -48,12 +48,12 @@ def any_is_void(invoices):
return False return False
@register.simple_tag @register.filter
def listlookup(lookup, target): def listlookup(lookup, target):
try: try:
return lookup[target] return lookup[target]
except IndexError: except IndexError:
return '' return None
@register.filter @register.filter