Refactor existing event paragraph template

References #241
This commit is contained in:
Oliver Davies 2020-10-24 20:06:21 +01:00
parent d1c7cc01a7
commit 79445b8641

View file

@ -47,26 +47,30 @@
] ]
%} %}
{% block paragraph %} {% block paragraph %}
{% set date = paragraph.field_date.0.value %}
{% set is_remote = paragraph.field_remote.0.value %}
{% set location = paragraph.field_location.0.value %}
{% set name = paragraph.field_name.0.value %}
{% set url = paragraph.field_link.0.url %}
<div{{ attributes.addClass(classes).addClass('') }}> <div{{ attributes.addClass(classes) }}>
{% block content %} {% block content %}
{% set url = paragraph.field_link.0.url %} {% if url %}
{% if url %} {{ link(name, url) -}}
{{ link(paragraph.field_name.0.value, url) -}} {% else %}
{% else %} {{ name -}}
{{ content.field_name -}} {% endif -%}
{% endif -%}
{%- if content.field_location is not empty %} {%- if location is not empty %}
{{ 'in'|t }} {{ 'in'|t }}
{{ content.field_location }} {{ location }}
{%- endif %} {%- endif %}
{% if paragraph.field_remote.0.value %} {% if is_remote %}
{{ '(Remote)'|t }} {{ '(Remote)'|t }}
{% endif %} {% endif %}
<span>- {{ paragraph.field_date.0.value|date('jS F Y') }}</span> <span>- {{ date|date('jS F Y') }}</span>
{{ content.without('field_remote') }} {{ content.without('field_remote') }}
{% endblock %} {% endblock %}