Less variables

This commit is contained in:
Oliver Davies 2015-08-11 07:02:26 +01:00
parent 0f2c83d995
commit 82fdfc6ee6

View file

@ -2,42 +2,40 @@
<h2>Availability</h2> <h2>Availability</h2>
<div class="content"> <div class="content">
{% set output, now = '', "now"|date('U') %} {% set now = "now"|date('U') %}
{% for type, data in site.availability %} {% for type, data in site.availability %}
{% set text, status, start, end = '', data.available, data.start, data.end %}
{% if type == 'day' %} {% if type == 'day' %}
{% if status == 'yes' %} {% if data.available == 'yes' %}
{% set text = 'Available for day contract work' %} {% set text = 'Available for day contract work' %}
{% elseif status == 'no' %} {% elseif data.available == 'no' %}
{% set text = 'Not available for day contract work' %} {% set text = 'Not available for day contract work' %}
{% endif %} {% endif %}
{% elseif type == 'evenings' %} {% elseif type == 'evenings' %}
{% if status == 'yes' %} {% if data.available == 'yes' %}
{% set text = 'Available for weekend/evening freelance work' %} {% set text = 'Available for weekend/evening freelance work' %}
{% elseif status == 'limited' %} {% elseif data.available == 'limited' %}
{% set text = 'Limited availability for weekend/evening freelance work' %} {% 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' %} {% set text = 'Not available for weekend/evening freelance work' %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if start %} {% if data.start %}
{% if start|date('U') > now %} {% if data.start|date('U') > now %}
{% set text = text ~ ' starting ' ~ start|date('F Y') %} {% set text = text ~ ' starting ' ~ data.start|date('F Y') %}
{% if end %} {% if data.end %}
{% set text = text ~ ',' %} {% set text = text ~ ',' %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if end %} {% if data.end %}
{% set text = text ~ ' until ' ~ end|date('F Y') %} {% set text = text ~ ' until ' ~ data.end|date('F Y') %}
{% endif %} {% endif %}
<p class="availability__{{ status }}">{{ text }}.</p> <p class="availability__{{ data.available }}">{{ text }}.</p>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>