From 82fdfc6ee63b0b05588ec86e4aa3f31ff54db544 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 11 Aug 2015 07:02:26 +0100 Subject: [PATCH] Less variables --- source/_partials/availability.html.twig | 28 ++++++++++++------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/source/_partials/availability.html.twig b/source/_partials/availability.html.twig index fb20606a..0e39a1a3 100644 --- a/source/_partials/availability.html.twig +++ b/source/_partials/availability.html.twig @@ -2,42 +2,40 @@

Availability

- {% set output, now = '', "now"|date('U') %} + {% set now = "now"|date('U') %} {% for type, data in site.availability %} - {% set text, status, start, end = '', data.available, data.start, data.end %} - {% if type == 'day' %} - {% if status == 'yes' %} + {% if data.available == 'yes' %} {% set text = 'Available for day contract work' %} - {% elseif status == 'no' %} + {% elseif data.available == 'no' %} {% set text = 'Not available for day contract work' %} {% endif %} {% elseif type == 'evenings' %} - {% if status == 'yes' %} + {% if data.available == 'yes' %} {% set text = 'Available for weekend/evening freelance work' %} - {% elseif status == 'limited' %} + {% elseif data.available == 'limited' %} {% set text = 'Limited availability for weekend/evening freelance work' %} - {% elseif status == 'no' %} + {% elseif data.available == 'no' %} {% set text = 'Not available for weekend/evening freelance work' %} {% endif %} {% endif %} - {% if start %} - {% if start|date('U') > now %} - {% set text = text ~ ' starting ' ~ start|date('F Y') %} + {% if data.start %} + {% if data.start|date('U') > now %} + {% set text = text ~ ' starting ' ~ data.start|date('F Y') %} - {% if end %} + {% if data.end %} {% set text = text ~ ',' %} {% endif %} {% endif %} {% endif %} - {% if end %} - {% set text = text ~ ' until ' ~ end|date('F Y') %} + {% if data.end %} + {% set text = text ~ ' until ' ~ data.end|date('F Y') %} {% endif %} -

{{ text }}.

+

{{ text }}.

{% endfor %}