{% extends 'layout.html' %}
{% load post_helpers %}

{% block content %}
<div class="grid-container">
    <div class="grid-x grid-margin-x">
        <div class="cell medium-8">
        {% for message in messages %}
            <p id="messages" style="background-color: red">{{message}}</p>
        {% endfor %}
        </div>
    </div>

    <form action="" method="post">
    {% csrf_token %}
        <div class="grid-x grid-margin-x padding-top-1">

            {{ formset.management_form }}

            {% for form in formset %}
            <div class="cell medium-3 large-2 small-10">
                {{ form.label }}
                {{ form }}
            </div>
            {% endfor %}

            <div class="cell medium-3 large-2 small-10 align-self-middle">          
                <input type="checkbox" id="compact_view" name="checkbox" value="compact_view" {% if compact_view %} checked {% endif %}>
                <label for="compact_view">kompakte Ansicht</label>

                <input type="checkbox" id="fet_meeting_only" name="checkbox" value="fet_meeting_only" {% if fet_meeting_only %} checked {% endif %}>
                <label for="fet_meeting_only">nur FET Sitzung</label>
            </div>

            <div class="cell medium-3 large-2 small-10 align-self-bottom">
                <input type="submit" class="button" name="btn_input" value="Suchen">
            </div>
        </div>
    </form>

    <div class="grid-x">
        <div class="cell medium-8">
        
        {% if compact_view %}
            {% for post in posts %}
                {% include 'posts/partials/_posts_hero_compact.html' %}
            {% endfor %}        
        {% else %}
            {% for post in posts %}
                {% include 'posts/partials/_posts_hero.html' %}
            {% endfor %}
        {% endif %}

        </div>
    </div>
</div>
{% endblock %}
