<!-- home.html -->

{% extends "base.html" %}

{% block title %}Home | Furaffinity Archive{% endblock %}

{% load custom_filters %}

{% load static %}

{% block content %}
<div class="row mt-2">
    <h1>New Archive's</h1>
    <div class="gallery-container">
        {% for submission in new_archives %}
            <a class="img-holder img-holder-small" href="{% url 'fa:submission_detail' submission_id=submission.submission_id %}">
                <div class="layer">
                    <h3>{{ submission.title }}</h3>
                    <p>{{ submission.date |date:'Y-m-d H:i' }}</p>
                </div>
                {% if submission.file %}
                    {% if submission.file.file.url|is_image %}
                        {% if submission.mature_rating.mature == "Adult" or submission.mature_rating.mature == "Mature" %}
                            <img class="blur" src="{{ submission.file.file.url }}" alt="{{ submission.title }}">
                        {% else %}
                            <img src="{{ submission.file.file.url }}" alt="{{ submission.title }}">
                        {% endif %}
                    {% else %}
                        <img src="{% static 'img/no-image-dark.webp' %}" alt="No image">    
                    {% endif %}
                {% else %}
                    <img src="{% static 'img/no-image-dark.webp' %}" alt="No image">
                {% endif %}
            </a>
        {% endfor %}
    </div>
    <h1>New Submission's</h1>
    <div class="gallery-container">
        {% for submission in new_submissions %}
            <a class="img-holder img-holder-small" href="{% url 'fa:submission_detail' submission_id=submission.submission_id %}">
                <div class="layer">
                    <h3>{{ submission.title }}</h3>
                    <p>{{ submission.date |date:'Y-m-d H:i' }}</p>
                </div>
                {% if submission.file %}
                    {% if submission.file.file.url|is_image %}
                        {% if submission.mature_rating.mature == "Adult" or submission.mature_rating.mature == "Mature" %}
                            <img class="blur" src="{{ submission.file.file.url }}" alt="{{ submission.title }}">
                        {% else %}
                            <img src="{{ submission.file.file.url }}" alt="{{ submission.title }}">
                        {% endif %}
                    {% else %}
                        <img src="{% static 'img/no-image-dark.webp' %}" alt="No image">    
                    {% endif %}
                {% else %}
                    <img src="{% static 'img/no-image-dark.webp' %}" alt="No image">
                {% endif %}
            </a>
        {% endfor %}
    </div>
</div>
{% endblock %}
