{% extends 'base.html' %}

{% block content %}
<div class="post-preview">
{% if urls|length > 0 %}
{% for url in urls %}
<!-- Post preview-->
<div class="post-preview">
    <div class="d-flex justify-content-between">
        <div class="p-2">
            <a href="{{ url.url }}">
                <h2 class="post-title">{{ url.title }}</h2>
            </a>
        </div>
        <div class="p-2">
            <a href="/delete/{{ url.id }}"><span class="fa-regular fa-trash-can"></span></a>
        </div>
    </div>
    {% if url.content %}
    <p class="post-meta">
        {{ url.content }}
    </p>
    {% endif %}
    <p class="post-meta">
        <a href="{{ url.url }}">
            {{ url.url }}
        </a>
    </p>
</div>
<!-- Divider-->
<hr class="my-4" />
{% endfor %}
<div class="pagination container row justify-content-end">
    <div></div>
    <div class="step-links col-auto">
        {% if urls.has_previous %}
        <a href="?page=1">&laquo;</a>
        <a href="?page={{ urls.previous_page_number }}">&lsaquo;</a>
        {% endif %}

        <span class="current">
            страница {{ urls.number }} из {{ urls.paginator.num_pages }}
        </span>

        {% if urls.has_next %}
        <a href="?page={{ urls.next_page_number }}">&rsaquo;</a>
        <a href="?page={{ urls.paginator.num_pages }}">&raquo;</a>
        {% endif %}
    </div>
</div>
{% else %}
    <h2 class="post-title">У вас нет ссылок в архиве</h2>
{% endif %}
</div>
{% endblock %}