{% extends 'layout.html.twig' %}
{% block layout %}
<div class="row">
<div class="d-lg-block col-lg-3">
<div class="list-group">
<a href="{{ path('la_base', {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('la_base', {category: category.id}) }}" class="list-group-item list-group-item-action color color-{{category.id}} {{ (categoryRequest != null and category.id == categoryRequest.id) ? "active" : "" }}">
{{ category.name }}
</a>
{% endfor %}
</div>
</div>
<div class="col-lg-9 col-12">
<h2><strong>Les derniers articles dans La Base</strong></h2>
<div class="row" style="padding-top:20px">
{% for data in tutos %}
<div class="col-sm-12 col-lg-6 liste">
<div class="card" style="border: 1px solid black;height: 100%;min-height:215px">
<h5 class="card-header color color-{{ data.category.id }}">
<strong>
{{ data.title }}
</strong>
</h5>
<div class="card-body">
<p class="card-text">
<i>
{% if data.chapo != null %}
{{ data.chapo|length > 200 ? data.chapo|slice(0,200)|raw : data.chapo|raw }}
{{ data.chapo|length > 200 ? '...' : ''}}
{% else %}
{{ data.content|length > 200 ? data.content|slice(0,200)|raw : data.content|raw }}
{{ data.content|length > 200 ? '...' : ''}}
{% endif %}
</i>
</p>
</div>
<div class="card-footer" style="display:flex; align-items:center;">
<span> {{data.createdAt|date('d/m/Y')}} </span>
<a style="margin-left:auto; background-color:{{data.category.color}}; border-color:{{data.category.color}};" href="{{ path('tuto_read', {tutoId: data.id}) }}" class="btn btn-primary">
Lire l'article
</a>
</div>
</div>
</div>
{% endfor %}
</div>
<div class="navigation">
{{ knp_pagination_render(tutos) }}
</div>
</div>
</div>
{% endblock %}
{% block stylesheets %}
{{ parent() }}
<style>
.color::before {
content: '';
display: inline-block;
width: .5em;
height: .5em;
-moz-border-radius: .25em;
-webkit-border-radius: .25em;
border-radius: .25em;
}
{% for category in categories %}
.color.color-{{ category.id }}::before {
background-color:{{ category.color }};
}
{% endfor %}
</style>
{% endblock %}