<div class="events-boxes row">
{% for event in events %}
<article class="events-box col-sm-4">
<a href="{{ path('_slug') ~ '/' ~ slug ~ '/' ~ event.url }}">
<div class="events-box__img">
{% if event.header_img_url and event.header_img_url is not empty %}
{% set img = event.header_img_url %}
{% elseif event.background_img_url and event.background_img_url is not empty %}
{% set img = event.background_img_url %}
{% else %}
{% set img = {
'cropping' : null,
'media' : {
'url' : get_default_article_image(),
},
'mediaAlt' : 'GdyĆskie Centrum Sportu'
} %}
{% endif %}
{% set fullSrc = null %}
{% set previewSrc = null %}
{% if img is defined and img is iterable and img.media is defined and img.media is not empty %}
{% set fullSrc = croppedImgSrc(img.media.url, img.cropping, { w: 450, h: 300, q: 80 }) %}
{% set img = croppedImgSrc(img.media.url, img.cropping, jml_img_large.preview) %}
{% endif %}
<img class="lazy" src="{{ img }}" {% if fullSrc is not null %}data-src="{{ fullSrc }}"{% endif %}
alt="{% if event.header_img_alt %}{{ event.header_img_alt }}{% else %}{{ event.name | striptags }}{% endif %}"/>
</div>
<div class="events-box__description">
<div class="events-box__caption">
<h3 role="heading" aria-level="3">{{ event.name }}</h3>
</div>
<div class="events-box__place">
{% for place in event.places %}
{% if place.name is defined and place.name is not empty %}
<p>
{{ place.name }}
{% if place.address is defined and place.address is not empty %} <span
class="events-box__address">({{ place.address }})</span>{% endif %}
</p>
{% endif %}
{% endfor %}
</div>
</div>
<div class="events-box__date">
<time datetime="{{ event.nearestDate | date("d.m.Y H:i") }}">{{ event.nearestDate | date("d.m.Y H:i") }}</time>
</div>
</a>
</article>
{% endfor %}
</div>