{{ form_start(meta_tag_set_form, { attr : { class : 'form-horizontal vm-change-tracking form-html5-validation' } }) }}

{% import 'VisualMTagManagerBundle:ManageMetaTagPreset:form.html.twig' as _meta_tag_preset_form %}
<section class="extra content-padding">
    <nav class="tabs">
        <ul>
            {% block form_tabs %}
                {% block form_tab_algemeen %}<li class="active"><a href="#algemeen" data-toggle="tab">{{ 'meta_tag_set.algemeen'|trans({}, 'forms') }}</a></li>{% endblock %}
                {% block form_tab_tags %}<li><a href="#tags" data-toggle="tab">{{ 'meta_tag_set.tags'|trans({}, 'forms') }}</a></li>{% endblock %}
                {% block form_tab_content_type %}<li><a href="#content_type" data-toggle="tab">{{ 'meta_tag_set.content_type'|trans({}, 'forms') }}</a></li>{% endblock %}
            {% endblock %}
        </ul>
    </nav>
</section>

<section class="content-padding">

    {{ block_position('flashmessages') }}
    {{ form_errors(meta_tag_set_form) }}

    <div class="tab-content">

        {% block form_tab_content %}

            {% block form_algemeen %}
                <div id="algemeen" class="tab-pane active">
                    {{ form_row(meta_tag_set_form.naam) }}
                    {{ form_row(meta_tag_set_form.kiesbaar) }}
                </div>
            {% endblock form_algemeen %}

            {% block form_tags %}
                <div id="tags" class="tab-pane">
                    <p>{{ 'meta_tag_set.meta_tag_presets_info'|trans({}, 'forms') }}</p>

                    <div class="js-meta-tag-preset-container" data-prototype="{{ _meta_tag_preset_form.meta_tag_preset_widget(meta_tag_set_form.metaTagPresets.vars.prototype, data_fields) | e }}">
                        {% for meta_tag_preset_form in meta_tag_set_form.metaTagPresets %}
                            {{ _meta_tag_preset_form.meta_tag_preset_widget(meta_tag_preset_form, data_fields) }}
                            {{ form_errors(meta_tag_preset_form) }}
                        {% endfor %}
                        {{ form_errors(meta_tag_set_form.metaTagPresets) }}
                        {% do meta_tag_set_form.metaTagPresets.setRendered %}
                    </div>


                    <button type="button" class="btn btn-link js-meta-tag-preset-add"><i class="glyphicon glyphicon-plus-sign"></i> {{ 'meta_tag_preset.toevoegen'|trans({}, 'forms') }}</button>

                </div>
            {% endblock form_tags %}

            {% block form_content_type %}
                <div id="content_type" class="tab-pane">
                    <p class="help-block">{{ 'meta_tag_set.content_types.info'|trans({}, 'forms') }}</p>
                    {{ form_widget(meta_tag_set_form.contentTypes) }}
                    {{ form_errors(meta_tag_set_form.contentTypes) }}
                </div>
            {% endblock form_content_type %}

        {% endblock form_tab_content %}

    </div>
        
</section>

        
<div class="form-actions hide">
    <div class="actions-group">
        {% if (meta_tag_set.id is not null and is_granted('ROLE_PERM_DELETE_META_TAG_SET')) %}
            <a href="{{ path('manage_meta_tag_set_delete', { id : meta_tag_set.Id }) }}" data-confirm="{{ 'meta_tag_set.action.delete.confirm'|trans({}, 'backend') }}" data-method="POST" class="btn btn-default" title="{{ 'meta_tag_set.action.delete.title'|trans({}, 'backend') }}"><i class="icon-trash"></i></a>
        {% endif %}
    </div>
    <section class="actions-group">
        {{ form_widget(meta_tag_set_form.save, { attr: { class : 'btn btn-default' } }) }}
    </section>
    <section class="actions-group">
        {{ form_widget(meta_tag_set_form.saveAndClose, { attr: { class : 'btn btn-primary' } }) }}
    </section>
</div>

{{ form_end(meta_tag_set_form) }}


{% stylesheets
    'bundles/visualmtagmanager/codemirror-4.5/lib/codemirror.css'
    'bundles/visualmtagmanager/codemirror-4.5/theme/monokai.css'
    'bundles/visualmtagmanager/css/meta_tag_set/form.css'
%}
    <link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}

{% set js %}
    {% javascripts
        'bundles/visualmtagmanager/codemirror-4.5/lib/codemirror.js'
        'bundles/visualmtagmanager/codemirror-4.5/mode/javascript/javascript.js'
        'bundles/visualmtagmanager/js/meta_tag_set/form.js'
    %}
        <script type="text/javascript" src="{{ asset_url }}"></script>
    {% endjavascripts %}
{% endset %}
{{ append_javascript(js, 'meta_tag_set_form') }}
