This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
oliverdavies.uk-old-sculpin/source/_partials/availability.html.twig
2015-08-10 23:28:33 +01:00

45 lines
1.6 KiB
Twig

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