<commit_before>{#=== INIT ===========================================================================================================#}

{% set attributes = {
    select: {
        name:      'taxonomy[' ~ taxonomy.slug ~ '][]',
        id:        'taxonomy-' ~ taxonomy.slug,
        class:     'form-control pull-left narrow',
    }
} %}

{#=== FIELDSET =======================================================================================================#}

{% extends '_base/_fieldset.twig' %}

{% block fieldset_type 'grouping' %}

{% block fieldset_label_text  taxonomy.name %}
{% block fieldset_label_class 'col-sm-3' %}

{% block fieldset_controls %}
    <div class="col-sm-9">
        <select{{ macro.attr(attributes.select) }}>
            <option value="">{{ __('(no group)') }}</option>
            <option value="" disabled>-----------</option>
            {% for slug, group in taxonomy.options %}
                <option value="{{ slug }}" {% if context.content.taxonomy[taxonomy.slug] is defined and group in context.content.taxonomy[taxonomy.slug] or context.content.taxonomy[taxonomy.slug] is not defined and taxonomy.default is defined and taxonomy.default == slug %}selected{% endif %}>{{ group }}</option>
            {% endfor %}
        </select>

        {% if taxonomy.has_sortorder is defined and taxonomy.has_sortorder == true %}
            <label for="taxonomy-order-{{ taxonomy.slug }}" class=" pull-left" style="margin: 6px 8px 0;">- Order:</label>
            {% if context.content.sortorder %}
                {% set sortorder = context.content.sortorder %}
            {% else %}
                {% set sortorder = 0 %}
            {% endif %}
            <input type="number" name="taxonomy-order[{{ taxonomy.slug }}]" id="taxonomy-order-{{ taxonomy.slug }}" step="1"
                   value="{{ sortorder }}" class="verynarrow form-control pull-left">
        {% endif %}
    </div>
{% endblock fieldset_controls %}
<commit_msg>Refacter taxonomy groupings options generation<commit_after>{#=== INIT ===========================================================================================================#}

{% set attributes = {
    select: {
        name:      'taxonomy[' ~ taxonomy.slug ~ '][]',
        id:        'taxonomy-' ~ taxonomy.slug,
        class:     'form-control pull-left narrow',
    }
} %}

{#=== FIELDSET =======================================================================================================#}

{% extends '_base/_fieldset.twig' %}

{% block fieldset_type 'grouping' %}

{% block fieldset_label_text  taxonomy.name %}
{% block fieldset_label_class 'col-sm-3' %}

{% block fieldset_controls %}
    <div class="col-sm-9">
        <select{{ macro.attr(attributes.select) }}>
            <option value="">{{ __('(no group)') }}</option>
            <option value="" disabled>-----------</option>
            {% for slug, group in taxonomy.options %}
                {% set attr_opt = {
                    value:     slug,
                    selected:  context.content.taxonomy[taxonomy.slug] is defined and
                                  group in context.content.taxonomy[taxonomy.slug] or
                               context.content.taxonomy[taxonomy.slug] is not defined and
                                  taxonomy.default is defined and
                                  taxonomy.default == slug,
                } %}
                <option{{ macro.attr(attr_opt) }}>{{ group }}</option>
            {% endfor %}
        </select>

        {% if taxonomy.has_sortorder is defined and taxonomy.has_sortorder == true %}
            <label for="taxonomy-order-{{ taxonomy.slug }}" class=" pull-left" style="margin: 6px 8px 0;">- Order:</label>
            {% if context.content.sortorder %}
                {% set sortorder = context.content.sortorder %}
            {% else %}
                {% set sortorder = 0 %}
            {% endif %}
            <input type="number" name="taxonomy-order[{{ taxonomy.slug }}]" id="taxonomy-order-{{ taxonomy.slug }}" step="1"
                   value="{{ sortorder }}" class="verynarrow form-control pull-left">
        {% endif %}
    </div>
{% endblock fieldset_controls %}

{'fraction_non_alphanumeric': 0.24613555291319858, 'fraction_numerical': 0.0033293697978596906, 'mean_word_length': 2.413961038961039, 'pattern_counts': {'":': 0, '<': 29, '<?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': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5649549', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1089, 'n_words': 241}