{% extends 'base.html.twig' %}
{% block body_id 'homepage' %}
{% block javascripts %}
{{ parent() }}
{{ encore_entry_script_tags('showGallery') }}
{% endblock %}
{#
the homepage is a special page which displays neither a header nor a footer.
this is done with the 'trick' of defining empty Twig blocks without any content
#}
{% block header %}{% endblock %}
{% block footer %}{% endblock %}
{% set heroImgPath = '/build/images/heroes/' %}
{% block body %}
<div class="galeria">
<div class="header-template">
<h2> Наші Герої</h1>
<p class="lead mb-0">Борися з <s>хамами</s> порушниками любими законними методами. Побачив порушника - скинь фотку :)</p>
</div>
<div class="row mb-4 ms-2 me-2 justify-content-between">
{% for hero in heros %}
<div class="card">
{% if is_mobile() %}
<a href="{{ heroImgPath ~ hero.heroFileName }}" class="col-sm-4 parking-data-toggle-lightbox">
<img src="{{ heroImgPath ~ hero.heroFileName }}" class="img-fluid card-img-top hero">
</a>
{% else %}
<a href="{{ heroImgPath ~ hero.heroFileName }}" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4 parking-data-toggle-lightbox">
<img src="{{ heroImgPath ~ hero.heroFileName }}" class="img-fluid card-img-top hero">
</a>
{% endif %}
<div class="card-body d-flex flex-column">
<h5 class="card-title"><b>{{ hero.heroName }}</b></h5>
{% if(hero.heroDescription|length < 100) %}
<p>{{ hero.heroDescription }} </p>
{% else %}
{% set left_text = hero.heroDescription|slice(100, -1) %}
{% set small_text = hero.heroDescription|slice(0, 100) %}
<span> {{ small_text }} </span>
<div class="collapse" id="collapseExample-{{loop.index}}">
<span class="smart">
{{ left_text }}
</span>
</div>
<a data-bs-toggle="collapse" href="#collapseExample-{{loop.index}}" role="button" aria-expanded="false" aria-controls="collapseExample">
</a>
{% endif %}
<p class="card-text">
<small class="text-muted">Змінено {{ hero.updatedAt|ago }}</small>
</p>
<a href="/hero/{{hero.id}}" class="btn btn-primary show-details mt-auto">Деталі</a>
</div>
</div>
{% if loop.index % 3 == 0 %}
</div>
<div class="row mb-4 ms-2 me-2 justify-content-between">
{% endif %}
{% endfor %}
<div class="card" onclick="window.location='/hero/new'">
<div class="card-body d-flex align-items-center">
<img src="{{ asset('build/images/file_plus_icon.png') }}" class="card-img-bottom">
</div>
</div>
</div>
{% endblock %}