Fix people not added to newly created groups, Fix #73

This commit is contained in:
Götz 2019-05-15 16:53:27 +02:00
parent f50a232d9c
commit 809c1d5f3e
5 changed files with 42 additions and 19 deletions

View File

@ -1,8 +1,8 @@
// make the table a dataTable and show all entries by default
const TABLE_CLASS = '.data-table';
const TABLE_CLASS_NO_PAGING = '.data-table-npaging';
$(document).ready(function () {
// if ($(TABLE_CLASS)) {
const data_table = $(TABLE_CLASS).DataTable({
"paging": true,
"pageLength": 10,
@ -30,7 +30,6 @@ $(document).ready(function () {
},
responsive: true,
});
// }
$('#data-table-search-input').keyup(function () {
data_table.search($(this).val()).draw();
});
@ -45,5 +44,13 @@ $(document).ready(function () {
$(".menu-toggle").click(function () {
$(".wrapper").toggleClass("toggled");
})
});
$('form').submit(function () {
data_table.search('').draw();
data_table.rows().nodes().page.len(-1).draw(false);
$('#data-table-search-input input').val('');
return true; // return false to cancel form action
});
});

View File

@ -1,5 +1,6 @@
{% extends 'realm/realm_detailed.jinja2' %}
{% import 'macros/form_macros.jinja2' as mform %}
{% import 'macros/utils_macros.jinja2' as uform %}
{% block detail_content %}
<h2>Gruppe anlegen</h2>
@ -11,12 +12,7 @@
{{ mform.text_input(form.name) }}
{{ mform.textarea_input(form.description) }}
{{ form.members.label }}
<div class="form-group w-25 float-right">
<input type="text"
class="form-control"
id="data-table-search-input">
<label for="data-table-search-input">Suche</label>
</div>
{{ uform.get_data_table_search_field() }}
{{ mform.user_select_table_input(users, field=form.members) }}
<div class="d-flex mt-4">
<button type="submit" class="btn btn-primary mr-auto p-2">Speichern</button>

View File

@ -27,6 +27,7 @@
{{ mform.text_input(form.name) }}
{{ mform.textarea_input(form.description) }}
{{ form.members.label }}
{{ mutils.get_data_table_search_field() }}
{{ mform.user_select_table_input(users, field=form.members) }}
<div class="d-flex mt-4">
<button type="submit" class="btn btn-primary mr-auto p-2">Speichern</button>

View File

@ -288,8 +288,8 @@
</div>
{% endmacro %}
{% macro user_select_table_input(users, deletable_users=[], blocked_users=[], field=None, name=None, css_classes='',show_lastlogin=False, checkbox_label_classes='') -%}
<table class="table table-hover table-striped table-inverse table-bordered data-table">
{% macro user_select_table_input(users, deletable_users=[], blocked_users=[], field=None, name=None, css_classes='',show_lastlogin=False, checkbox_label_classes='',data_table_class='data-table') -%}
<table class="table table-hover table-striped table-inverse table-bordered {{ data_table_class }}">
<thead>
<tr>
<th scope="col" class="text-center">
@ -297,14 +297,10 @@
<input type="checkbox"
class="table-checkbox-control-input"
id="delete-all-checkbox"
><label class="
{% if checkbox_label_classes %}{{ checkbox_label_classes }}{% else %}table-checkbox-control-label table-checkbox-control-label-add{% endif %}"
for="delete-all-checkbox"></label>
>
<label class="
{% if checkbox_label_classes %}{{ checkbox_label_classes }}{% else %}table-checkbox-control-label table-checkbox-control-label-add{% endif %}"
for="delete-all-checkbox"></label>
{% endif %}
</th>
<th scope="col">Nutzername</th>
@ -333,6 +329,20 @@
{% if checkbox_label_classes %}{{ checkbox_label_classes }}{% else %}table-checkbox-control-label table-checkbox-control-label-add{% endif %}"
for="{{ user.username }}_{{ loop.index }}">

View File

@ -125,3 +125,12 @@
{% endif %}
{% endmacro %}
{% macro get_data_table_search_field(input_id="data-table-search-input") -%}
<div class="form-group w-25 float-right">
<input type="text"
class="form-control"
id="{{ input_id }}">
<label for="{{ input_id }}">Suche</label>
</div>
{% endmacro %}