{% extends 'base.html.twig' %}
{% block title %}{{ category.name }} - ActuFake{% endblock %}
{% block body %}
<div class="container my-5">
<div class="category-header mb-5 text-center">
{% if category.icon %}
<i class="fas {{ category.icon }} fa-3x mb-3" style="color: {{ category.color ?? '#000' }};"></i>
{% endif %}
<h1 class="display-4 mb-3">{{ category.name }}</h1>
{% if category.description %}
<p class="lead text-muted">{{ category.description }}</p>
{% endif %}
</div>
<div class="row">
{% for article in articles %}
<div class="col-md-4 mb-4">
<div class="card article-card h-100">
{% if article.featuredImage %}
{% set image_path = article.featuredImage.path starts with '/' ? article.featuredImage.path|slice(1) : article.featuredImage.path %}
<img src="{{ base_path }}/{{ image_path }}" class="card-img-top" alt="{{ article.title }}">
{% else %}
<div class="card-img-top bg-secondary text-white d-flex align-items-center justify-content-center" style="height: 200px;">
<i class="fas fa-newspaper fa-3x opacity-25"></i>
</div>
{% endif %}
<div class="card-body">
<h5 class="card-title">
<a href="{{ path('article_show', {slug: article.slug}) }}" class="text-decoration-none text-dark">
{{ article.title }}
</a>
</h5>
<p class="card-text">{{ article.excerpt|slice(0, 120) }}...</p>
<p class="card-text">
<small class="text-muted">
<i class="fas fa-calendar"></i> {{ article.publishedAt|date('d/m/Y') }}
<i class="fas fa-eye ms-2"></i> {{ article.viewCount }}
</small>
</p>
</div>
</div>
</div>
{% else %}
<div class="col-12">
<p class="text-center text-muted">Aucun article dans cette catégorie.</p>
</div>
{% endfor %}
</div>
{% if articles.pageCount > 1 %}
<div class="navigation mt-4">
{{ knp_pagination_render(articles) }}
</div>
{% endif %}
</div>
{% endblock %}