{% extends 'base.html' %}

{% block menuapp %}

{% endblock menuapp %}

{% block content %}

<div class="container-xl">
    <div class="position-relative mb-3">
        <div class="row g-3 justify-content-between">
            <div class="col-auto">
                <h1 class="app-page-title">Noticias</h1>
            </div>
        </div>
    </div>


                {% for noticia in noticias %}
    <div class="app-card app-card-notification shadow-sm mb-4">
        <div class="app-card-header px-4 py-3">
            <div class="row g-3 align-items-center">
                <div class="col-12 col-lg-auto text-center text-lg-start">
                    <img class="profile-image" src="{{ noticia.autor.foto.url}}" alt="">
                </div><!--//col-->

                <div class="col-12 col-lg-auto text-center text-lg-start">
                    <!--<div class="notification-type mb-2"><span class="badge bg-info">Project</span></div>-->
                        <h4 class="notification-title mb-1">{{ noticia.titulo }}</h4>

                        <ul class="notification-meta list-inline mb-0">
                            <li class="list-inline-item">{{ noticia.fecha_publicacion|date:"d M Y" }}</li>
                            <li class="list-inline-item">|</li>
                            <li class="list-inline-item">{{ noticia.autor.nombre }}</li>
                        </ul>

                </div><!--//col-->
            </div><!--//row-->
        </div><!--//app-card-header-->


        <div class="app-card-body p-4">
            <p>{{ noticia.contenido|truncatewords:20 }}</p> <!-- Muestra solo 20 palabras del contenido -->
        </div><!--//app-card-body-->

        <div class="app-card-footer px-4 py-3">
            <a class="action-link" href="{% url 'eventos:detalle_noticia' noticia.id %}">Leer más<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-arrow-right ms-2" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
            <path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z"/>
            svg></a>
        </div><!--//app-card-footer-->
    </div><!--//app-card-->
            {% empty %}
                <p>No hay noticias disponibles.</p>
            {% endfor %}
</div><!--//container-fluid-->

{% endblock %}
