From 7897c4a6332f24719452cacb0844781a6501aea3 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 11 Apr 2015 09:44:55 +0100 Subject: [PATCH] Split upcoming and previous talks --- source/talks.html.twig | 31 ++++++++++++++----- .../_partials/talk-listing-item.html.twig | 2 ++ 2 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 source/themes/opdavies/opdavies/_partials/talk-listing-item.html.twig diff --git a/source/talks.html.twig b/source/talks.html.twig index 4a14d632..fabc9472 100644 --- a/source/talks.html.twig +++ b/source/talks.html.twig @@ -36,11 +36,28 @@ use: {% set now = 'now'|date('U') %} -
- {% for talk in page.talks|reverse if talk.date <= now %} - {% if loop.first %}

Previous Talks

{% endif %} +{% set found = false %} +{% for talk in page.talks|reverse if talk.date >= now %} + {% if loop.first %} +

Upcoming Talks

+
+ {% endif %} -
{{ talk.date|date('F Y') }} - {{ talk.location }}
-
{{ talk.description|raw }}
- {% endfor %} -
\ No newline at end of file + {% include 'talk-listing-item' %} +{% endfor %} +{% if found %} +
+{% endif %} + +{% set found = false %} +{% for talk in page.talks|reverse if talk.date < now %} + {% if loop.first %} +

Previous Talks

+
+ {% endif %} + + {% include 'talk-listing-item' %} +{% endfor %} +{% if found %} +
+{% endif %} diff --git a/source/themes/opdavies/opdavies/_partials/talk-listing-item.html.twig b/source/themes/opdavies/opdavies/_partials/talk-listing-item.html.twig new file mode 100644 index 00000000..341051c4 --- /dev/null +++ b/source/themes/opdavies/opdavies/_partials/talk-listing-item.html.twig @@ -0,0 +1,2 @@ +
{{ talk.date|date('F Y') }} - {{ talk.location }}
+
{{ talk.description|raw }}
\ No newline at end of file