diff --git a/wafer/schedule/templates/wafer.schedule/embed_schedule.html b/wafer/schedule/templates/wafer.schedule/embed_schedule.html new file mode 100644 index 00000000..4ae77fce --- /dev/null +++ b/wafer/schedule/templates/wafer.schedule/embed_schedule.html @@ -0,0 +1,79 @@ +{% load static from staticfiles %} +{% load i18n %} + + + + {% block title %}{% trans "Schedule" %} - {{ WAFER_CONFERENCE_NAME }}{% endblock %} + + + + + + + + {% block extra_head %}{% endblock %} + + +{% block content %} +
+
+ {% if not schedule_days %} + {# Schedule is incomplete / invalid, so show nothing #} + {% blocktrans %} +

The final schedule has not been published yet.

+ {% endblocktrans %} + {% else %} + {% if next_day or prev_day %} +
+ {% url 'wafer_full_schedule' as schedule_url %} + {% if prev_day %} + {% trans "Previous Day" %} + {% endif %} + {% if next_day %} + {% trans "Next Day" %} + {% endif %} +
+ {% endif %} + {% for schedule_day in schedule_days %} + + {# We assume that the admin has created a valid timetable #} + + + + + + {% for venue in schedule_day.venues %} + + {% endfor %} + + {% for row in schedule_day.rows %} + + + {% for item in row.get_sorted_items %} + {% if item.item == "unavailable" %} + {# Venue isn't available, so we add an empty table element with the 'unavailable' class #} + + {% else %} + {# Add item details #} + + {% endif %} + {% endfor %} + + {% endfor %} +
+ + {{ schedule_day.day.date|date:"l (d b)" }} + +
{% trans "Time" %}{{ venue.name }}
{{ row.slot.get_start_time|time:"H:i" }} - {{ row.slot.end_time|time:"H:i" }} + {% include "wafer.schedule/schedule_item.html" with item=item.item %} +
+ {% endfor %} + {% endif %} +
+
+{% endblock %} + + diff --git a/wafer/schedule/urls.py b/wafer/schedule/urls.py index 4887c3ee..c327fdb5 100644 --- a/wafer/schedule/urls.py +++ b/wafer/schedule/urls.py @@ -4,7 +4,7 @@ from wafer.schedule.views import ( CurrentView, ScheduleView, ScheduleItemViewSet, ScheduleXmlView, - VenueView, ICalView) + ScheduleEmbedView, VenueView, ICalView) router = routers.DefaultRouter() router.register(r'scheduleitems', ScheduleItemViewSet) @@ -12,6 +12,7 @@ urlpatterns = [ url(r'^$', ScheduleView.as_view(), name='wafer_full_schedule'), url(r'^venue/(?P\d+)/$', VenueView.as_view(), name='wafer_venue'), + url(r'^embed/$', ScheduleEmbedView.as_view(), name='wafer_current'), url(r'^current/$', CurrentView.as_view(), name='wafer_current'), url(r'^pentabarf\.xml$', ScheduleXmlView.as_view(), name='wafer_pentabarf_xml'), diff --git a/wafer/schedule/views.py b/wafer/schedule/views.py index 37f97914..04430d0e 100644 --- a/wafer/schedule/views.py +++ b/wafer/schedule/views.py @@ -171,6 +171,10 @@ def get_context_data(self, **kwargs): return context +class ScheduleEmbedView(ScheduleView): + template_name = 'wafer.schedule/embed_schedule.html' + + class CurrentView(TemplateView): template_name = 'wafer.schedule/current.html'