From e1dbd21ef2873c595ac2c5fb1125841ea18609b1 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 5 Sep 2017 18:37:41 +0100 Subject: [PATCH] Split talk layout into partials --- source/_includes/talk/events.html.twig | 20 ++++++++++++ source/_includes/talk/slides.html.twig | 8 +++++ source/_includes/talk/video.html.twig | 9 ++++++ source/_layouts/talk.html.twig | 42 ++------------------------ 4 files changed, 40 insertions(+), 39 deletions(-) create mode 100644 source/_includes/talk/events.html.twig create mode 100644 source/_includes/talk/slides.html.twig create mode 100644 source/_includes/talk/video.html.twig diff --git a/source/_includes/talk/events.html.twig b/source/_includes/talk/events.html.twig new file mode 100644 index 00000000..a43848a6 --- /dev/null +++ b/source/_includes/talk/events.html.twig @@ -0,0 +1,20 @@ +
+

Events

+ + {% set events = [] %} + {% for date in site.events.dates %} + {% set key = (date.talk.id is defined) ? date.talk.id : date.talk %} + {% set talk = (page.id is defined) ? page.id : page.url|split('/')|last %} + {% if key == talk %} + {% set events = events|merge([{ + date: date, + event: site.events.events[date.event], + }]) %} + {% endif %} + {% endfor %} + + {% include 'talks-table' with { + events: events, + talk_page: true, + } %} +
diff --git a/source/_includes/talk/slides.html.twig b/source/_includes/talk/slides.html.twig new file mode 100644 index 00000000..0821e562 --- /dev/null +++ b/source/_includes/talk/slides.html.twig @@ -0,0 +1,8 @@ +{% if page.slides.embed %} +
+

Slides

+
+ {{ page.slides.embed|raw }} +
+
+{% endif %} diff --git a/source/_includes/talk/video.html.twig b/source/_includes/talk/video.html.twig new file mode 100644 index 00000000..981bd8d1 --- /dev/null +++ b/source/_includes/talk/video.html.twig @@ -0,0 +1,9 @@ +{% if page.video.embed %} +
+

Video

+ +
+ {{ page.video.embed|raw }} +
+
+{% endif %} diff --git a/source/_layouts/talk.html.twig b/source/_layouts/talk.html.twig index 15190273..5fcb715b 100644 --- a/source/_layouts/talk.html.twig +++ b/source/_layouts/talk.html.twig @@ -5,45 +5,9 @@ {% block content %}{% endblock %} - {% if page.slides.embed %} -
-

Slides

-
- {{ page.slides.embed|raw }} -
-
- {% endif %} - - {% if page.video.embed %} -
-

Video

- -
- {{ page.video.embed|raw }} -
-
- {% endif %} - -
-

Events

- - {% set events = [] %} - {% for date in site.events.dates %} - {% set key = (date.talk.id is defined) ? date.talk.id : date.talk %} - {% set talk = (page.id is defined) ? page.id : page.url|split('/')|last %} - {% if key == talk %} - {% set events = events|merge([{ - date: date, - event: site.events.events[date.event], - }]) %} - {% endif %} - {% endfor %} - - {% include 'talks-table' with { - events: events, - talk_page: true, - } %} -
+ {% include 'talk/slides' %} + {% include 'talk/video' %} + {% include 'talk/events' %} {% endblock %} {% block stylesheets %}