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

{% block content %}
    <h1>Willkommen, {{ user.attribute('givenname', 0) }}</h1>
    <div class="group-chooser">
        <form class="pure-form">
            <fieldset>
                <label for="group">Deine Gruppe&nbsp;</label>
                <select name="group" id="group" onchange="this.form.submit()">
				{% for i in ownedGroups|keys %}
					<option {% if ownedGroups[i]['ou'][0] == group %}selected {% endif %}value="{{ ownedGroups[i]['ou'][0] }}">{{ ownedGroups[i]['cn'][0] }}</option>
				{% endfor %}
                </select>
            </fieldset>
        </form>
    </div>
    <div class="pure-g">
        <div class="pure-u-1 pure-u-md-1-2">
            <form class="pure-form bold-legend">
                <fieldset>
                    <legend>Filtern nach...</legend>
                    <input type="text" class="search" placeholder="Name, Email...">

                    <label for="filter-by-new">
                        <input id="filter-by-new" type="checkbox" name="filter" value="new">
                        Neue Mitglieder
                    </label>

                    <label for="filter-by-group">
                        <input id="filter-by-group" type="checkbox" name="filter" checked value="group">
                        Meine Gruppe
                    </label>
                </fieldset>
            </form>
        </div>
        <div class="pure-u-1 pure-u-md-1-2">
            <p>Hier kannst du neue Mitglieder deiner Gruppe freischalten und dein Passwort ändern. Über das Suchfeld
                kannst du auch andere Mitglieder finden und deiner Gruppe hinzufügen.</p>
        </div>
    </div>
    <div>
        <table class="full-width pure-table pure-table-bordered">
            <thead>
            <tr>
                <th>Name</th>
                <th>Mail</th>
                <th>Aktion</th>
            </tr>
            </thead>
            <tbody class="list">
            {% for person in result %}
                {% if person['displayname'][0] is defined %}
                    <tr>
                        <td class="name">{{ person['displayname'][0] }}</td>
                        <td class="email">{% if person['mail'] is defined %}{{ person['mail'][0] }}{% endif %}</td>
                        <td><a href="#activate"
                               class="{% if person['dn'] in members[0]['member'] %}pure-button button-warning">entfernen{% else %}pure-button button-success">hinzuf&uuml;gen{% endif %}</a>
                        </td>
                        <td class="isMember hidden">{% if person['dn'] in members[0]['member'] %}true{% else %}false{% endif %}</td>
                    </tr>
                {% endif %}
            {% endfor %}
            </tbody>
        </table>
        <ul class="pagination"></ul>
    </div>
{% endblock %}

{% block scripts %}
    {{ parent() }}
    <script>
        var options = {
            valueNames: ['name', 'email'],
            page: 20,
            plugins: [
                ListPagination({})
            ]
        };

        var memberList = new List('members', options);


        /* TODO (doesn't work yet) */
        function filterGroup(cb) {
            personList.filter(function (item) {
                return (item.values().isMember == true);
            });
            return false;
        }
    </script>
{% endblock %}
<commit_msg>List is now filter- and searchable<commit_after>{% extends 'base.twig' %}

{% block content %}
    <h1>Willkommen, {{ user.attribute('givenname', 0) }}</h1>
    <div class="group-chooser">
        <form class="pure-form">
            <fieldset>
                <label for="group">Deine Gruppe&nbsp;</label>
                <select name="group" id="group" onchange="this.form.submit()">
				{% for i in ownedGroups|keys %}
					<option {% if ownedGroups[i]['ou'][0] == group %}selected {% endif %}value="{{ ownedGroups[i]['ou'][0] }}">{{ ownedGroups[i]['cn'][0] }}</option>
				{% endfor %}
                </select>
            </fieldset>
        </form>
    </div>
    <div class="pure-g">
        <div class="pure-u-1 pure-u-md-1-2">
            <form class="pure-form bold-legend">
                <fieldset>
                    <legend>Filtern nach...</legend>
                    <input type="text" class="search" placeholder="Name, Email...">

                    <label for="filter-by-new">
                        <input id="filter-by-new" type="checkbox" name="filter" value="new">
                        Neue Mitglieder
                    </label>

                    <label for="filter-by-group">
                        <input id="filter-by-group" type="checkbox" name="filter" onclick ="filterGroup(this)" checked value="group">
                        Meine Gruppe
                    </label>
                </fieldset>
            </form>
        </div>
        <div class="pure-u-1 pure-u-md-1-2">
            <p>Hier kannst du neue Mitglieder deiner Gruppe freischalten und dein Passwort ändern. Über das Suchfeld
                kannst du auch andere Mitglieder finden und deiner Gruppe hinzufügen.</p>
        </div>
    </div>
    <div>
        <table class="full-width pure-table pure-table-bordered">
            <thead>
            <tr>
                <th class="sort" data-sort="name">Name</th>
                <th class="sort" data-sort="email">E-Mail-Adresse</th>
                <th class="sort" data-sort="isMember">Aktion</th>
            </tr>
            </thead>
            <tbody class="list">
            {% for person in result %}
                {% if person['displayname'][0] is defined %}
                    <tr>
                        <td class="name">{{ person['displayname'][0] }}</td>
                        <td class="email">{% if person['mail'] is defined %}{{ person['mail'][0] }}{% endif %}</td>
                        <td><a href="#activate"
                               class="{% if person['dn'] in members[0]['member'] %}pure-button button-warning">entfernen{% else %}pure-button button-success">hinzuf&uuml;gen{% endif %}</a>
                        </td>
                        <td class="isMember hidden">{% if person['dn'] in members[0]['member'] %}1{% else %}0{% endif %}</td>
                    </tr>
                {% endif %}
            {% endfor %}
            </tbody>
        </table>
        <ul class="pagination"></ul>
    </div>
{% endblock %}

{% block scripts %}
    {{ parent() }}
    <script>
        var options = {
            valueNames: ['name', 'email', 'isMember'],
            page: 20,
            plugins: [
                ListPagination({})
            ]
        };

        var memberList = new List('members', options);

        var memberFilter = function (item) {return (item.values().isMember == '1')};
        
        /* TODO (doesn't work yet) */
        function filterGroup(cb) {
            if (cb.checked){
            	memberList.filter(memberFilter);
            }else{
            	memberList.filter();
            }
            return true;
        }
    </script>
{% endblock %}

{'fraction_non_alphanumeric': 0.16533108393083087, 'fraction_numerical': 0.005764093912554478, 'mean_word_length': 1.5244854506742371, 'pattern_counts': {'":': 0, '<': 137, '<?xml version=': 0, '>': 139, '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': '3362183', 'n_tokens_mistral': 2156, 'n_tokens_neox': 1976, 'n_words': 451}