{% extends "wagtailadmin/base.html" %}
{% load i18n wagtailadmin_tags %}
{% block titletag %}{% blocktrans with snippet_type_name=model_opts.verbose_name %}New  {{ snippet_type_name }}{% endblocktrans %}{% endblock %}
{% block content %}
    {% trans "New" as new_str %}
    {% include "wagtailadmin/shared/header_with_locale_selector.html" with title=new_str subtitle=model_opts.verbose_name icon="snippet" tabbed=1 merged=1 %}

    <form action="{% url 'wagtailsnippets:add' model_opts.app_label model_opts.model_name %}{% if locale %}?locale={{ locale.language_code }}{% endif %}" method="POST" novalidate{% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
        {% csrf_token %}
        {{ edit_handler.render_form_content }}

        <footer class="footer">
            <nav aria-label="{% trans 'Actions' %}">
                <ul>
                    <li class="actions actions--primary footer__container">
                        <div class="dropdown dropup dropdown-button match-width">
                            {{ action_menu.render_html }}
                        </div>
                    </li>
                </ul>
            </nav>
        </footer>
    </form>

{% endblock %}

{% block extra_css %}
    {{ block.super }}
    {% include "wagtailadmin/pages/_editor_css.html" %}
    {{ edit_handler.form.media.css }}
{% endblock %}
{% block extra_js %}
    {{ block.super }}
    {% include "wagtailadmin/pages/_editor_js.html" %}
    {{ edit_handler.form.media.js }}
    {{ edit_handler.html_declarations }}

    <script>
        // Set wagtailConfig.ACTIVE_CONTENT_LOCALE if this is a translated page
        // This value may be used by JS widgets on the form
        {% if locale %}
            window.wagtailConfig = window.wagtailConfig || {};
            window.wagtailConfig.ACTIVE_CONTENT_LOCALE = '{{ locale.language_code|escapejs }}';
        {% endif %}
    </script>
{% endblock %}
