{% extends 'layouts/base.html.twig' %}

{% block title %}{{ trans('home.page_title', { site: site.name }) }}{% endblock %}

{% block main_class %} page-home{% endblock %}

{% block content %}
    <section class="page-header page-header-home">
        <h1>{{ trans('home.title') }}</h1>
        {% if members_only and not user %}
            {% set sign_in_link = '<a href="/login">' ~ trans('home.members_lead_sign_in') ~ '</a>' %}
            {% set register_link = '<a href="/register">' ~ trans('home.members_lead_register') ~ '</a>' %}
            {% if allow_registration %}
                {% set lead = trans('home.members_lead')|replace({
                    (trans('home.members_lead_sign_in')): sign_in_link,
                    (trans('home.members_lead_register')): register_link
                }) %}
            {% else %}
                {% set or_register_phrase = ' or ' ~ trans('home.members_lead_register') %}
                {% set lead = trans('home.members_lead')|replace({
                    (or_register_phrase): '',
                    (trans('home.members_lead_sign_in')): sign_in_link
                }) %}
            {% endif %}
            <p class="lead-muted">{{ lead|raw }}</p>
        {% endif %}
    </section>

    {% if boards is empty %}
        {% if members_only and not user %}
            <div class="callout-card">
                <h2>{{ trans('common.welcome') }}</h2>
                <p>{{ trans('home.welcome_body') }}</p>
                <p><a class="btn btn-primary" href="/login">{{ trans('nav.sign_in') }}</a> <a class="btn" href="/register">{{ trans('nav.register') }}</a></p>
            </div>
        {% else %}
            <p class="empty">{{ trans('home.no_boards') }}</p>
        {% endif %}
    {% else %}
        {% for html in plugin_home_before_boards_html|default([]) %}
            {{ html|raw }}
        {% endfor %}
        <div class="board-panels">
            {% if board_panel_html is defined and board_panel_html is not empty %}
                {% for html in board_panel_html %}
                    {{ html|raw }}
                {% endfor %}
            {% else %}
                {% for board in boards %}
                    {% include 'partials/home_board_panel.html.twig' with { board: board } %}
                {% endfor %}
            {% endif %}
        </div>
    {% endif %}

    {% for html in plugin_home_after_boards_html|default([]) %}
        {{ html|raw }}
    {% endfor %}
{% endblock %}