<commit_before>{% extends 'SonataAdminBundle:Form:form_admin_fields.html.twig' %}

{% block form_start %}
    {% set attr = attr | merge({ novalidate: 'novalidate' }) %}

    {{ parent() }}
{% endblock form_start %}

{% block fc_collection_widget %}
    <div id="{{ form.vars.id }}_items">
        {% for field in form %}
            <div class="panel panel-default collection-item">
                <button type="button" class="close"><span>&times;</span>&nbsp;</button>
                <div class="panel-body">
                    {{ form_widget(field) }}
                </div>
            </div>
        {% endfor %}
    </div>

    <button type="button" class="btn btn-primary" id="{{ form.vars.id }}_add" data-prototype="{{ form_widget(form.vars.prototype) | e }}">
        <i class="fa fa-plus-circle"></i>
        Добавить
    </button>

    <script>
        $(function() {
            var $items = $('#{{ form.vars.id }}_items');
            var index  = {{ form.count }};

            $('#{{ form.vars.id }}_add').click(function(e) {
                e.preventDefault();

                var prototype =
                    '<div class="panel panel-default collection-item" data-index="'+ index +'">' +
                        '<button type="button" class="close"><span>&times;</span>&nbsp;</button>' +
                        '<div class="panel-body">' +
                            $(this).data('prototype').replace(/__name__/g, index) +
                        '</div>' +
                    '</div>'
                ;

                $items.append(prototype);

                var $item = $items.find('div.collection-item[data-index="'+ index +'"]');

                Admin.setup_select2($item);
                Admin.setup_icheck($item);

                index++;
            });

            $items.on('click', 'button.close', function(e) {
                e.preventDefault();

                $(this).closest('.collection-item').remove();
            });
        });
    </script>
{% endblock %}

{%- block form_widget_compound -%}
    <div {{ block('widget_container_attributes') }}>
        {%- if form.parent is empty -%}
            {{ block('steps') }}
            {{ form_errors(form) }}
            <div class="step-wrapper current-step" data-step="1">
        {%- endif -%}
        {{- block('form_rows') -}}
        {{- form_rest(form) -}}
        {%- if form.parent is empty -%}
            </div>
        {%- endif -%}
    </div>
{%- endblock form_widget_compound -%}

{% block step_row %}
    {{ form_row(form, { label: false }) }}
    </div>
    <div class="step-wrapper hidden" data-step="{{ form.parent.vars.fc_form.stepNumber(name) + 1 }}">
{% endblock %}

{% block step_widget %}
    {% if form.parent.vars.fc_form.stepNumber(name) > 1 %}
        <button type="button" class="change-step" data-step="{{ form.parent.vars.fc_form.stepNumber(name) - 1 }}">
            {{ button_prev | default('fc.label.admin.field.step.prev_default') | trans({}, translation_domain) }}
        </button>
    {% endif %}

    <button type="button" class="change-step" data-step="{{ form.parent.vars.fc_form.stepNumber(name) + 1 }}">
        {{ button_next | default('fc.label.admin.field.step.next_default') | trans({}, translation_domain) }}
    </button>
{% endblock %}

{%- block submit_row -%}
    <div>
        {% if form.parent.vars.fc_form.stepsCount > 1 %}
            {% set button_prev = form.parent.vars.fc_form.stepField(1).params.prev %}
            <button type="button" class="change-step" data-step="{{ form.parent.vars.fc_form.stepsCount - 1 }}">
                {{ button_prev | default('fc.label.admin.field.step.prev_default') | trans({}, translation_domain) }}
            </button>
        {% endif %}
        {{- form_widget(form) -}}
    </div>
{%- endblock submit_row -%}

{% block steps %}
    {% if fc_form is defined and fc_form.stepsCount > 1 %}
        <div class="form-group">
            <nav>{{ block('steps_list') }}</nav>
        </div>
    {% endif %}
{% endblock steps %}

{% block steps_list %}
    <ul class="pagination steps-list">
        {% for item in 1..fc_form.stepsCount %}
            {{ block('steps_list_item') }}
        {% endfor %}
    </ul>
{% endblock steps_list %}

{% block steps_list_item %}
    <li{{ not loop.index0 ? ' class="active"' }} data-step="{{ item }}">
        <a href="#" class="change-step" data-step="{{ item }}">
            {{ block('steps_list_item_label') }}
        </a>
    </li>
{% endblock steps_list_item %}

{% block steps_list_item_label %}
    {{ item }}
{% endblock steps_list_item_label %}

{%- block form_end -%}
    {% if fc_form is defined %}
        {{ include('FenrizbesFormConstructorBundle:Form:behavior_generator.html.twig') }}
    {% endif %}

    {{ parent() }}
{%- endblock form_end -%}<commit_msg>Templates example<commit_after>{% extends 'SonataAdminBundle:Form:form_admin_fields.html.twig' %}

{% block form_start %}
    {% set attr = attr | merge({ novalidate: 'novalidate' }) %}

    {{ parent() }}
{% endblock form_start %}

{% block fc_collection_widget %}
    <div id="{{ form.vars.id }}_items">
        {% for field in form %}
            <div class="panel panel-default collection-item">
                <button type="button" class="close"><span>&times;</span>&nbsp;</button>
                <div class="panel-body">
                    {{ form_widget(field) }}
                </div>
            </div>
        {% endfor %}
    </div>

    <button type="button" class="btn btn-primary" id="{{ form.vars.id }}_add" data-prototype="{{ form_widget(form.vars.prototype) | e }}">
        <i class="fa fa-plus-circle"></i>
        Добавить
    </button>

    <script>
        $(function() {
            var $items = $('#{{ form.vars.id }}_items');
            var index  = {{ form.count }};

            $('#{{ form.vars.id }}_add').click(function(e) {
                e.preventDefault();

                var prototype =
                    '<div class="panel panel-default collection-item" data-index="'+ index +'">' +
                        '<button type="button" class="close"><span>&times;</span>&nbsp;</button>' +
                        '<div class="panel-body">' +
                            $(this).data('prototype').replace(/__name__/g, index) +
                        '</div>' +
                    '</div>'
                ;

                $items.append(prototype);

                var $item = $items.find('div.collection-item[data-index="'+ index +'"]');

                Admin.setup_select2($item);
                Admin.setup_icheck($item);

                index++;
            });

            $items.on('click', 'button.close', function(e) {
                e.preventDefault();

                $(this).closest('.collection-item').remove();
            });
        });
    </script>
{% endblock %}

{%- block form_widget_compound -%}
    <div {{ block('widget_container_attributes') }}>
        {%- if form.parent is empty -%}
            {{ block('steps') }}
            {{ form_errors(form) }}
            <div class="step-wrapper current-step" data-step="1">
        {%- endif -%}
        {{- block('form_rows') -}}
        {{- form_rest(form) -}}
        {%- if form.parent is empty -%}
            </div>
        {%- endif -%}
    </div>
{%- endblock form_widget_compound -%}

{% block step_row %}
    {{ form_row(form, { label: false }) }}
    </div>
    <div class="step-wrapper hidden" data-step="{{ form.parent.vars.fc_form.stepNumber(name) + 1 }}">
{% endblock %}

{% block step_widget %}
    {% if form.parent.vars.fc_form.stepNumber(name) > 1 %}
        <button type="button" class="change-step" data-step="{{ form.parent.vars.fc_form.stepNumber(name) - 1 }}">
            {{ button_prev | default('fc.label.admin.field.step.prev_default') | trans({}, translation_domain) }}
        </button>
    {% endif %}

    <button type="button" class="change-step" data-step="{{ form.parent.vars.fc_form.stepNumber(name) + 1 }}">
        {{ button_next | default('fc.label.admin.field.step.next_default') | trans({}, translation_domain) }}
    </button>
{% endblock %}

{%- block submit_row -%}
    <div>
        {% if form.parent.vars.fc_form.stepsCount > 1 %}
            {% set button_prev = form.parent.vars.fc_form.stepField(1).params.prev %}
            <button type="button" class="change-step" data-step="{{ form.parent.vars.fc_form.stepsCount - 1 }}">
                {{ button_prev | default('fc.label.admin.field.step.prev_default') | trans({}, translation_domain) }}
            </button>
        {% endif %}
        {{- form_widget(form) -}}
    </div>
{%- endblock submit_row -%}

{% block steps %}
    {% if fc_form is defined and fc_form.stepsCount > 1 %}
        <div class="form-group">
            <nav>{{ block('steps_list') }}</nav>
        </div>
    {% endif %}
{% endblock steps %}

{% block steps_list %}
    <ul class="pagination steps-list">
        {% for item in 1..fc_form.stepsCount %}
            {{ block('steps_list_item') }}
        {% endfor %}
    </ul>
{% endblock steps_list %}

{% block steps_list_item %}
    <li{{ not loop.index0 ? ' class="active"' }} data-step="{{ item }}">
        <a href="#" class="change-step" data-step="{{ item }}">
            {{ block('steps_list_item_label') }}
        </a>
    </li>
{% endblock steps_list_item %}

{% block steps_list_item_label %}
    {{ item }}
{% endblock steps_list_item_label %}

{% block choice_widget %}
    {% if expanded and fc_form is defined and 'inline' in fc_form.fieldTemplates(name) %}
        {% set attr = attr | merge({ class: attr.class | default('') ~' list-inline' }) %}
    {% endif %}

    {{ parent() }}
{% endblock choice_widget %}

{%- block form_end -%}
    {% if fc_form is defined %}
        {{ include('FenrizbesFormConstructorBundle:Form:behavior_generator.html.twig') }}
    {% endif %}

    {{ parent() }}
{%- endblock form_end -%}
{'fraction_non_alphanumeric': 0.18833990098009498, 'fraction_numerical': 0.002424977265838133, 'mean_word_length': 2.1422222222222222, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 105, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4620638', 'n_tokens_mistral': 3220, 'n_tokens_neox': 2972, 'n_words': 537}