{% extends 'layout.html.twig' %}
{% block layout %}
<div class="row">
<div class="d-lg-block col-lg-3">
<div class="list-group">
<a href="{{ path('news_list', {category: null}) }}" class="list-group-item list-group-item-action {{ (null == categoryRequest) ? "active" : "" }}">
Toutes les catégories
</a>
{% for category in categories %}
<a href="{{ path('news_list', {category: category.id}) }}" class="list-group-item list-group-item-action {{ (categoryRequest != null and category.id == categoryRequest.id) ? "active" : "" }}">
{{ category.name }}
</a>
{% endfor %}
</div>
</div>
<div class="col-lg-9 col-12">
<div class="row">
{% for data in news %}
<div class="col-sm-12 col-lg-6" style="padding-bottom:30px;">
<div class="card" style="border: 1px solid black;height: 100%;min-height:215px">
<h5 class="card-header">
<strong>
{{ data.title }}
</strong>
</h5>
<div class="card-body">
{% if data.category is not null and data.category.name != 'Tutos' %}
<p class="card-text">
<i>
{{ data.content|length > 200 ? data.content|slice(0,200)|raw : data.content|raw }}
{{ data.content|length > 200 ? '...' : ''}}
</i>
</p>
{% endif %}
</div>
<div class="card-footer">
{% if data.category is not null and data.category.name == 'Tutos' %}
<a href="{{ path('tuto_read', {tutoId: (null == data.content) ? '0' : data.content}) }}" style="float:right" class="btn btn-primary">
Lire le tuto
</a>
{% else %}
<a href="{{ path('news_read', {actuId: data.id}) }}" style="float:right" class="btn btn-primary">
Lire
</a>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
<div class="navigation">
{{ knp_pagination_render(news) }}
</div>
</div>
</div>
{% endblock %}