{% extends base_template|default:"base.html" %}

{% load cms_tags allink_cms_tags sekizai_tags i18n allink_image_tags allink_meta_tags thumbnail inline_static_tags %}

{% block meta_tags %}
    {% render_meta_og object %}
{% endblock meta_tags %}

{% block body_class %}tpl-app-detail{% endblock %}

{% block content %}

    {% include "modals/modal-header-markup.html" with title=object.title modal_type="softpage" %}

    <article class="app-detail {% block app_class %}{% endblock app_class %}">

        {% comment %}
            Check if header placeholder containers plugins
        {% endcomment %}
        {% placeholder_has_content placeholder=object.header_placeholder as header_placeholder_has_content %}

        {% comment %}
            Header
        {% endcomment %}
        <header class="content-section app-detail__header container-enabled {% if not header_placeholder_has_content and not object.preview_image %}app-detail__header--empty{% endif %}">
            <div class="content-section__container">
                <div class="app-detail__col-container">

                    <div class="app-detail__header-col">

                        {# render placeholder #}
                        {% render_placeholder object.header_placeholder %}

                        {# fallback: use preview image #}
                        {% if object.preview_image and not header_placeholder_has_content %}
                            <div class="image-container app-detail__header-image-container">
                                {% render_image image=object.preview_image width_alias="2-of-3" %}
                            </div>
                        {% endif %}

                    </div>

                </div>
            </div>
        </header>

        {% comment %}
            Content
        {% endcomment %}
        <article class="content-section app-detail__content container-enabled">
            <div class="content-section__container">

                <header class="app-detail__heading-container">
                    {% if object.created %}
                        <time class="app-detail__created" datetime="{{ object.created|date:"c" }}">
                            {{object.created|date:"j.n.Y"}}
                        </time>
                    {% endif %}
                    <h2 class="app-detail__heading">
                        {% render_model_ajax object "title" %}
                    </h2>
                </header>

                <div class="app-detail__col-container app-detail__template__col-1">

                    <div class="app-detail__col app-detail__col-1">
                        {% if object.lead %}
                            <div class="app-detail__lead">
                                {{object.lead}}
                            </div>
                        {% endif %}
                        <div class="app-detail__content-container">
                            {% placeholder_has_content placeholder=object.content_placeholder as content_placeholder_has_content %}
                            {% if content_placeholder_has_content %}
                                <div class="app-detail__content-container">
                            {% endif %}
                                {% render_placeholder object.content_placeholder %}
                            {% if content_placeholder_has_content %}
                                </div>
                            {% endif %}
                        </div>
                        {% block newsletter_teaser %}{% endblock %}
                        {% block overview_link %}{% endblock %}

                    </div>{# end .app-detail__col #}

                </div>{# end .app-detail__col-container #}

            </div>{# end .content-section__container #}
        </article>{# end .content-section #}

    </article>

{% endblock %}
