<commit_before>{% block type_collection %}

    <div class="type_collection" id="type_collection_{{ field }}">
        {{- echo_twig("form_widget(form['" ~ field ~ "'])") -}}

        {% if builder.Columns[field].formOptions['allow_add'] %}
        <ul class="actions">
            <li>
                <a class="new">{{ echo_trans('form.type_collection.add') }}</a>
            </li>
        </ul>
        {% endif %}
    </div>

    {% if builder.Columns[field].formOptions['allow_add'] or builder.Columns[field].formOptions['allow_delete'] %}
    <script type="text/javascript">
    $(document).ready(function() {

        {% if builder.Columns[field].formOptions['allow_add'] %}
        type_collection_{{ field }}_nextId = $('#{{ builder.YamlKey }}_{{ builder.ModelClass|lower }}_{{ field }} > div').length;

        $('#type_collection_{{ field }} .new').click(function() {
           var prototype = $('#{{ builder.YamlKey }}_{{ builder.ModelClass|lower }}_{{ field }}').attr('data-prototype');
           prototype = prototype.replace(/__name__label__/g, "{{ builder.Columns[field].extras.new_label is defined ? builder.Columns[field].extras.new_label : 'type_collection_' ~ field ~ '_nextId' }}");
           prototype = prototype.replace(/__name__/g, type_collection_{{ field }}_nextId);
           type_collection_{{ field }}_nextId++;
           $('#{{ builder.YamlKey }}_{{ builder.ModelClass|lower }}_{{ field }}').append(prototype);

           {% if builder.Columns[field].formOptions['allow_delete'] %}
           $('#{{ builder.YamlKey }}_{{ builder.ModelClass|lower }}_{{ field }} > div:last').append("<a class=\"delete\"> </a>");

           $('#{{ builder.YamlKey }}_{{ builder.ModelClass|lower }}_{{ field }} .delete').click(function() { //@todo make a function for this
               $(this).parent('div').remove();
            });
           {% endif %}
        });
        {% endif %}

        {% if builder.Columns[field].formOptions['allow_delete'] %}<commit_msg>Fix #170 use data() instead of attr('data-') in jquery for collection field<commit_after>{% block type_collection %}

    <div class="type_collection" id="type_collection_{{ field }}">
        {{- echo_twig("form_widget(form['" ~ field ~ "'])") -}}

        {% if builder.Columns[field].formOptions['allow_add'] %}
        <ul class="actions">
            <li>
                <a class="new">{{ echo_trans('form.type_collection.add') }}</a>
            </li>
        </ul>
        {% endif %}
    </div>

    {% if builder.Columns[field].formOptions['allow_add'] or builder.Columns[field].formOptions['allow_delete'] %}
    <script type="text/javascript">
    $(document).ready(function() {

        {% if builder.Columns[field].formOptions['allow_add'] %}
        type_collection_{{ field }}_nextId = $('#{{ builder.YamlKey }}_{{ builder.ModelClass|lower }}_{{ field }} > div').length;

        $('#type_collection_{{ field }} .new').click(function() {
           var prototype = $('#{{ builder.YamlKey }}_{{ builder.ModelClass|lower }}_{{ field }}').data('prototype');
           prototype = prototype.replace(/__name__label__/g, "{{ builder.Columns[field].extras.new_label is defined ? builder.Columns[field].extras.new_label : 'type_collection_' ~ field ~ '_nextId' }}");
           prototype = prototype.replace(/__name__/g, type_collection_{{ field }}_nextId);
           type_collection_{{ field }}_nextId++;
           $('#{{ builder.YamlKey }}_{{ builder.ModelClass|lower }}_{{ field }}').append(prototype);

           {% if builder.Columns[field].formOptions['allow_delete'] %}
           $('#{{ builder.YamlKey }}_{{ builder.ModelClass|lower }}_{{ field }} > div:last').append("<a class=\"delete\"> </a>");

           $('#{{ builder.YamlKey }}_{{ builder.ModelClass|lower }}_{{ field }} .delete').click(function() { //@todo make a function for this
               $(this).parent('div').remove();
            });
           {% endif %}
        });
        {% endif %}

        {% if builder.Columns[field].formOptions['allow_delete'] %}
{'fraction_non_alphanumeric': 0.20178261946026244, 'fraction_numerical': 0.0007427581084426838, 'mean_word_length': 3.0643863179074446, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 29, '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': '7250627', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1141, 'n_words': 193}