<commit_before>{% extends 'site/base.twig' %}

{% block content %}
    <div class="page-header">
        <h1>{{ translate('Registration') }}</h1>
    </div>

    {% include 'secretary/registration/partials/navigation.twig' %}

    <div class="row page">
        <div class="span12">
            {% if form %}
                {% import 'site/partials/form.twig' as forms %}
                {{ forms.renderForm(form) }}
            {% else %}
                <div style="text-align: center;">
                    <p style="text-align: center;">
                        {% autoescape false %}
                            {{ translate('To register, please login first with your KU Leuven account') }}
                        {% endautoescape %}
                    </p>
                    <a class="btn btn-info" href="{{ registerShibbolethUrl }}">{% autoescape false %}{{ translate('KU Leuven&mdash;Central Login') }}{% endautoescape  %}</a>
                </div>
            {% endif %}
        </div>
    </div>

    <div id="modalMemberWarning" class="modal fade">
        <div class="modal-header">
            <a class="close" data-dismiss="modal">&times;</a>
            <h3>{{ translate('Become A Member') }}</h3>
        </div>
        <div class="modal-body">
            <p>
                {{ translate('You haven\'t checked the option to become a member. Being a member has many advantages.') }}
            </p>
            <p>
                {{ translate('Are you sure you want to continue?') }}
            </p>
        </div>
        <div class="modal-footer">
            <button class="btn btn-primary confirm">{{ translate('Yes') }}</button>
            <button class="btn" data-dismiss="modal">{{ translate('No') }}</button>
        </div>
    </div>

    <div id="modalTermsAndCoditions" class="modal fade">
        <div class="modal-header">
            <a class="close" data-dismiss="modal">&times;</a>
            <h3>{{ translate('Terms And Conditions') }}</h3>
        </div>
        <div class="modal-body">
            <p>
                {{ markdown(terms_and_conditions) }}
            </p>
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal">{{ translate('Close') }}</button>
        </div>
    </div>
{% endblock %}

{% block content_script %}
    <script type="text/javascript">
        $(document).ready(function () {
            $('#conditions').parent().append(
                link = $('<a>', {'href': '#'}).html('&mdash;{{ translate('Read Them') }}')
            );
            link.click(function (e) {
                e.preventDefault();
                $('#modalTermsAndCoditions').modal();
            });

            $('#register').click(function (e) {
                e.preventDefault();
                console.log($('form#register_form'));
                if (!$('#become_member').is(':checked')) {
                    $('#modalMemberWarning').modal();
                    $('#modalMemberWarning .confirm').one('click', function () {
                        $('#register_form').submit();
                    });
                } else {
                    $('#register_form').submit();
                }
            });

            $('#primary_address_address_city').change(cityChange);
            $('#become_member').change(toggleMember);
            toggleMember();
            cityChange();

            $('#university_email').wrap('<div class=\"input-append\" />');
            $('#university_email').after('<span class=\"add-on\">@<EMAIL></span>');

            $('#first_name').blur(nameChange);
            $('#last_name').blur(nameChange);
        });

        function nameChange() {
            $('#university_email').val($('#first_name').val().toLowerCase() + "." + $('#last_name').val().toLowerCase());
        }

        function cityChange() {
            var city = $('#primary_address_address_city option:selected').val();
            $('.primary_address_address_street, #primary_address_address_number, #primary_address_address_mailbox, #primary_address_address_postal_other, #primary_address_address_city_other, #primary_address_address_street_other').closest('.control-group').hide();
            if (city != 0)
                $('#primary_address_address_street_' + city + ',#primary_address_address_postal_' + city + ',#primary_address_address_city_' + city + ', #primary_address_address_number, #primary_address_address_mailbox').closest('.control-group').show();
        }

        function toggleMember() {
            if ($('#become_member').is(':checked'))
                $('#organization_info .control-group').show();
            else
                $('#organization_info .control-group').hide();
            $('#become_member, #conditions').closest('.control-group').show();
        }
    </script>
{% endblock %}<commit_msg>Fix: no spaces in email<commit_after>{% extends 'site/base.twig' %}

{% block content %}
    <div class="page-header">
        <h1>{{ translate('Registration') }}</h1>
    </div>

    {% include 'secretary/registration/partials/navigation.twig' %}

    <div class="row page">
        <div class="span12">
            {% if form %}
                {% import 'site/partials/form.twig' as forms %}
                {{ forms.renderForm(form) }}
            {% else %}
                <div style="text-align: center;">
                    <p style="text-align: center;">
                        {% autoescape false %}
                            {{ translate('To register, please login first with your KU Leuven account') }}
                        {% endautoescape %}
                    </p>
                    <a class="btn btn-info" href="{{ registerShibbolethUrl }}">{% autoescape false %}{{ translate('KU Leuven&mdash;Central Login') }}{% endautoescape  %}</a>
                </div>
            {% endif %}
        </div>
    </div>

    <div id="modalMemberWarning" class="modal fade">
        <div class="modal-header">
            <a class="close" data-dismiss="modal">&times;</a>
            <h3>{{ translate('Become A Member') }}</h3>
        </div>
        <div class="modal-body">
            <p>
                {{ translate('You haven\'t checked the option to become a member. Being a member has many advantages.') }}
            </p>
            <p>
                {{ translate('Are you sure you want to continue?') }}
            </p>
        </div>
        <div class="modal-footer">
            <button class="btn btn-primary confirm">{{ translate('Yes') }}</button>
            <button class="btn" data-dismiss="modal">{{ translate('No') }}</button>
        </div>
    </div>

    <div id="modalTermsAndCoditions" class="modal fade">
        <div class="modal-header">
            <a class="close" data-dismiss="modal">&times;</a>
            <h3>{{ translate('Terms And Conditions') }}</h3>
        </div>
        <div class="modal-body">
            <p>
                {{ markdown(terms_and_conditions) }}
            </p>
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal">{{ translate('Close') }}</button>
        </div>
    </div>
{% endblock %}

{% block content_script %}
    <script type="text/javascript">
        $(document).ready(function () {
            $('#conditions').parent().append(
                link = $('<a>', {'href': '#'}).html('&mdash;{{ translate('Read Them') }}')
            );
            link.click(function (e) {
                e.preventDefault();
                $('#modalTermsAndCoditions').modal();
            });

            $('#register').click(function (e) {
                e.preventDefault();
                console.log($('form#register_form'));
                if (!$('#become_member').is(':checked')) {
                    $('#modalMemberWarning').modal();
                    $('#modalMemberWarning .confirm').one('click', function () {
                        $('#register_form').submit();
                    });
                } else {
                    $('#register_form').submit();
                }
            });

            $('#primary_address_address_city').change(cityChange);
            $('#become_member').change(toggleMember);
            toggleMember();
            cityChange();

            $('#university_email').wrap('<div class=\"input-append\" />');
            $('#university_email').after('<span class=\"add-on\"><EMAIL></span>');

            $('#first_name').blur(nameChange);
            $('#last_name').blur(nameChange);
        });

        function nameChange() {
            $('#university_email').val($('#first_name').val().toLowerCase() + "." + $('#last_name').val().toLowerCase().replace(/ /g, ""));
        }

        function cityChange() {
            var city = $('#primary_address_address_city option:selected').val();
            $('.primary_address_address_street, #primary_address_address_number, #primary_address_address_mailbox, #primary_address_address_postal_other, #primary_address_address_city_other, #primary_address_address_street_other').closest('.control-group').hide();
            if (city != 0)
                $('#primary_address_address_street_' + city + ',#primary_address_address_postal_' + city + ',#primary_address_address_city_' + city + ', #primary_address_address_number, #primary_address_address_mailbox').closest('.control-group').show();
        }

        function toggleMember() {
            if ($('#become_member').is(':checked'))
                $('#organization_info .control-group').show();
            else
                $('#organization_info .control-group').hide();
            $('#become_member, #conditions').closest('.control-group').show();
        }
    </script>
{% endblock %}
{'fraction_non_alphanumeric': 0.17907382688161003, 'fraction_numerical': 0.0018482390389156997, 'mean_word_length': 1.9822412737293325, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 117, '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': '4942262', 'n_tokens_mistral': 2704, 'n_tokens_neox': 2590, 'n_words': 467}