{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "tags/actions.html.twig" as actions %}

{% block page_title %}{{ 'tags'|trans }}{% endblock %}
{% block page_actions %}{{ actions.tag(tag, 'edit') }}{% endblock %}

{% block main %}
    {% set formEditTemplate = app.request.xmlHttpRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig' %}
    {% set formOptions = {
        'title': tag.name|default('create'|trans),
        'form': form,
        'back': path('tags')
    } %}
    {% embed formEditTemplate with formOptions %}
        {% block form_body %}
            <div class="row">
                <div class="col-md-10">
                    {{ form_row(form.name) }}
                </div>
                <div class="col-md-2">
                    {{ form_row(form.color) }}
                </div>
            </div>
        {% endblock %}
    {% endembed %}
{% endblock %}
