<commit_before>{% extends 'forms/base_widget.html' %}

{% macro render_section(id, title=none, placeholder=none) %}
    {% if title is not none %}
        <div id="{{ id }}-list-title-{{ field.id }}" class="titled-rule">
            {{ title }}
        </div>
    {% endif %}
    {% if placeholder is not none %}
        <div id="no-{{ id }}-placeholder-{{ field.id }}" class="nobody-placeholder">
            {{ placeholder }}
        </div>
    {% endif %}
    <div id="{{ id }}-list-{{ field.id }}" class="person-list"></div>
{% endmacro %}

{% block html %}
    <input type="hidden" id="{{ field.id }}" name="{{ field.name }}" value="{{ field._value()|tojson|forceescape }}">
    <div id="people-list-{{ field.id }}" class="person-link-list {% if field.allow_authors %}no-border-top{% endif %}" data-tooltip-anchor>
        {% block sections %}{% endblock %}
        <div class="i-box-footer" style="text-align: right;">
            <i class="info-helper"
               title="{% trans %}Added people can be modified by moving the cursor over them.{% endtrans %}"></i>
            <span id="add-existing-{{ field.id }}" class="i-button highlight">
                {% trans %}Choose{% endtrans %}
            </span>
            <span id="add-new-{{ field.id }}" class="i-button"
                  title="{% trans %}Enter a person manually{% endtrans %}">
                {% trans %}Enter{% endtrans %}
            </span>
        </div>
    </div>
{% endblock %}

{% block javascript %}
    <script>
        $(function() {
            'use strict';

            var $field = $('#{{ field.id }}');
            var $fieldDisplay = $('#people-list-{{ field.id }}');
            var $authorList = $fieldDisplay.find('#author-list-{{ field.id }}');
            var $noAuthorPlaceholder = $fieldDisplay.find('#no-author-placeholder-{{ field.id }}');
            var $coauthorList = $fieldDisplay.find('#coauthor-list-{{ field.id }}');
            var $coauthorListTitle = $fieldDisplay.find('#coauthor-list-title-{{ field.id }}');
            var $noCoauthorPlaceholder = $fieldDisplay.find('#no-coauthor-placeholder-{{ field.id }}');
            var $otherList = $fieldDisplay.find('#other-list-{{ field.id }}');
            var $otherListTitle = $fieldDisplay.find('#other-list-title-{{ field.id }}');
            var $noOtherPlaceholder = $fieldDisplay.find('#no-other-placeholder-{{ field.id }}');
            var $buttonAddExisting = $('#add-existing-{{ field.id }}');
            var $buttonAddNew = $('#add-new-{{ field.id }}');
            var authorTypes = {{ (field.author_types or none)|tojson }};

            function renderPeople(people) {
                $authorList.html('');
                $coauthorList.html('');
                $otherList.html('');
                _.each(people, renderPerson);
                $noAuthorPlaceholder.toggle($authorList.is(':empty'));
                {% if not field.show_empty_coauthors %}
                    $coauthorListTitle.toggle($coauthorList.is(':not(:empty)'));
                {% else %}
                    $noCoauthorPlaceholder.toggle($coauthorList.is(':empty'));
                {% endif %}
                $otherListTitle.toggle($otherList.is(':not(:empty)'));
                $noOtherPlaceholder.toggle($otherList.is(':empty'));
            }

            function renderPerson(person) {
                var $personRow = $('<div>').addClass('person-row');
                var $personName = $('<div>').addClass('name').text(person.name);
                var $personStatus = $('<div>').addClass('person-status');
                var $personRoles = $('<span>').addClass('person-roles');
                var $personButtons = $('<span>').addClass('person-buttons');
                var $buttonRemove = $('<a>').addClass('i-button-icon danger icon-close').attr('title', $T.gettext("Remove person"));
                var $buttonEdit = $('<a>').addClass('i-button-icon icon-edit').attr('title', $T.gettext("Edit information"));
                var $buttonConfig = $('<a>').addClass('i-button-icon icon-settings').attr('title', $T.gettext("Configure roles"));

                setPersonDefaults(person);
                $personRow.append($personName).append($personStatus);
                $personStatus.append($personRoles).append($personButtons);
                $personButtons.append($buttonRemove).append($buttonEdit);

                {% if field.allow_submitters %}
                    if (person.isSubmitter) {
                        $personRoles.append($('<span>').addClass('i-label').text($T.gettext("Submitter")));
                    }
                {% endif %}

                {% if field.allow_authors %}
                    if (person.isSpeaker) {
                        $personRoles.prepend($('<span>').addClass('i-label').text($T.gettext("Speaker")));
                    }
                {% endif %}

                if (!authorTypes || person.authorType == authorTypes.none) {
                    $otherList.append($personRow);
                } else if (person.authorType == authorTypes.primary) {
                    $authorList.append($personRow);
                } else if (person.authorType == authorTypes.secondary) {
                    $coauthorList.append($personRow);
                }

                {% if field.allow_submitters or field.allow_authors %}
                    $personButtons.append($buttonConfig);
                    setupPersonConfig(person, $buttonConfig);
                {% endif %}
                $buttonEdit.on('click', function() {
                    $field.principalfield('edit', person.id);
                });
                $buttonRemove.on('click', function() {
                    $field.principalfield('removeOne', person.id);
                });
            }

            function setPersonDefaults(person) {
                if (person.authorType === undefined) {
                    person.authorType = {{ (field.default_author_type.value if field.default_author_type else 0)|tojson }};<commit_msg>Show speakers even if they are authors in meetings<commit_after>{% extends 'forms/base_widget.html' %}

{% macro render_section(id, title=none, placeholder=none) %}
    {% if title is not none %}
        <div id="{{ id }}-list-title-{{ field.id }}" class="titled-rule">
            {{ title }}
        </div>
    {% endif %}
    {% if placeholder is not none %}
        <div id="no-{{ id }}-placeholder-{{ field.id }}" class="nobody-placeholder">
            {{ placeholder }}
        </div>
    {% endif %}
    <div id="{{ id }}-list-{{ field.id }}" class="person-list"></div>
{% endmacro %}

{% block html %}
    <input type="hidden" id="{{ field.id }}" name="{{ field.name }}" value="{{ field._value()|tojson|forceescape }}">
    <div id="people-list-{{ field.id }}" class="person-link-list {% if field.allow_authors %}no-border-top{% endif %}" data-tooltip-anchor>
        {% block sections %}{% endblock %}
        <div class="i-box-footer" style="text-align: right;">
            <i class="info-helper"
               title="{% trans %}Added people can be modified by moving the cursor over them.{% endtrans %}"></i>
            <span id="add-existing-{{ field.id }}" class="i-button highlight">
                {% trans %}Choose{% endtrans %}
            </span>
            <span id="add-new-{{ field.id }}" class="i-button"
                  title="{% trans %}Enter a person manually{% endtrans %}">
                {% trans %}Enter{% endtrans %}
            </span>
        </div>
    </div>
{% endblock %}

{% block javascript %}
    <script>
        $(function() {
            'use strict';

            var $field = $('#{{ field.id }}');
            var $fieldDisplay = $('#people-list-{{ field.id }}');
            var $authorList = $fieldDisplay.find('#author-list-{{ field.id }}');
            var $noAuthorPlaceholder = $fieldDisplay.find('#no-author-placeholder-{{ field.id }}');
            var $coauthorList = $fieldDisplay.find('#coauthor-list-{{ field.id }}');
            var $coauthorListTitle = $fieldDisplay.find('#coauthor-list-title-{{ field.id }}');
            var $noCoauthorPlaceholder = $fieldDisplay.find('#no-coauthor-placeholder-{{ field.id }}');
            var $otherList = $fieldDisplay.find('#other-list-{{ field.id }}');
            var $otherListTitle = $fieldDisplay.find('#other-list-title-{{ field.id }}');
            var $noOtherPlaceholder = $fieldDisplay.find('#no-other-placeholder-{{ field.id }}');
            var $buttonAddExisting = $('#add-existing-{{ field.id }}');
            var $buttonAddNew = $('#add-new-{{ field.id }}');
            var allowAuthors = {{ (field.allow_authors or none)|tojson }};
            var authorTypes = {{ (field.author_types or none)|tojson }};

            function renderPeople(people) {
                $authorList.html('');
                $coauthorList.html('');
                $otherList.html('');
                _.each(people, renderPerson);
                $noAuthorPlaceholder.toggle($authorList.is(':empty'));
                {% if not field.show_empty_coauthors %}
                    $coauthorListTitle.toggle($coauthorList.is(':not(:empty)'));
                {% else %}
                    $noCoauthorPlaceholder.toggle($coauthorList.is(':empty'));
                {% endif %}
                $otherListTitle.toggle($otherList.is(':not(:empty)'));
                $noOtherPlaceholder.toggle($otherList.is(':empty'));
            }

            function renderPerson(person) {
                var $personRow = $('<div>').addClass('person-row');
                var $personName = $('<div>').addClass('name').text(person.name);
                var $personStatus = $('<div>').addClass('person-status');
                var $personRoles = $('<span>').addClass('person-roles');
                var $personButtons = $('<span>').addClass('person-buttons');
                var $buttonRemove = $('<a>').addClass('i-button-icon danger icon-close').attr('title', $T.gettext("Remove person"));
                var $buttonEdit = $('<a>').addClass('i-button-icon icon-edit').attr('title', $T.gettext("Edit information"));
                var $buttonConfig = $('<a>').addClass('i-button-icon icon-settings').attr('title', $T.gettext("Configure roles"));

                setPersonDefaults(person);
                $personRow.append($personName).append($personStatus);
                $personStatus.append($personRoles).append($personButtons);
                $personButtons.append($buttonRemove).append($buttonEdit);

                {% if field.allow_submitters %}
                    if (person.isSubmitter) {
                        $personRoles.append($('<span>').addClass('i-label').text($T.gettext("Submitter")));
                    }
                {% endif %}

                {% if field.allow_authors %}
                    if (person.isSpeaker) {
                        $personRoles.prepend($('<span>').addClass('i-label').text($T.gettext("Speaker")));
                    }
                {% endif %}

                if (!authorTypes || person.authorType == authorTypes.none || (!allowAuthors && person.isSpeaker)) {
                    $otherList.append($personRow);
                } else if (person.authorType == authorTypes.primary) {
                    $authorList.append($personRow);
                } else if (person.authorType == authorTypes.secondary) {
                    $coauthorList.append($personRow);
                }

                {% if field.allow_submitters or field.allow_authors %}
                    $personButtons.append($buttonConfig);
                    setupPersonConfig(person, $buttonConfig);
                {% endif %}
                $buttonEdit.on('click', function() {
                    $field.principalfield('edit', person.id);
                });
                $buttonRemove.on('click', function() {
                    $field.principalfield('removeOne', person.id);
                });
            }

            function setPersonDefaults(person) {
                if (person.authorType === undefined) {
                    person.authorType = {{ (field.default_author_type.value if field.default_author_type else 0)|tojson }};
{'fraction_non_alphanumeric': 0.17560815791629125, 'fraction_numerical': 0.00016381358014579407, 'mean_word_length': 2.0275229357798166, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, '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': '2649089', 'n_tokens_mistral': 3468, 'n_tokens_neox': 3191, 'n_words': 577}