1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 01:48:21 +02:00

Dynamic user research

This commit is contained in:
Yohann D'ANELLO
2020-04-01 20:14:16 +02:00
parent 2853fe252b
commit 5eb08fd822
7 changed files with 59 additions and 58 deletions

View File

@ -9,7 +9,7 @@
</h4>
<input class="form-control mx-auto w-25" type="text" onkeyup="search_field_moved();return(false);" id="search_field"/>
<hr>
<a class="btn btn-primary text-center my-4" href="{% url 'member:club_create' %}">{% trans "Créer un club" %}</a>
<a class="btn btn-primary text-center my-4" href="{% url 'member:club_create' %}">{% trans "Create club" %}</a>
</div>
</div>
<div class="row justify-content-center">

View File

@ -2,28 +2,44 @@
{% load render_table from django_tables2 %}
{% load crispy_forms_tags%}
{% block content %}
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note/section ...">
<a class="btn btn-primary" href="{% url 'member:signup' %}">New User</a>
<hr>
<div class="row">
{% crispy filter.form filter.form.helper %}
</div>
<div class="row">
<div id="replaceable-content" class="col-6">
{% render_table table %}
<div id="user_table">
{% render_table table %}
</div>
</div>
{% endblock %}
{% block extrajavascript %}
<script type="text/javascript">
$(document).ready(function() {
let old_pattern = null;
let searchbar_obj = $("#searchbar");
$(document).ready(function($) {
$(".table-row").click(function() {
window.document.location = $(this).data("href");
function reloadTable() {
let pattern = searchbar_obj.val();
if (pattern === old_pattern || pattern === "")
return;
$("#user_table").load(location.href + "?search=" + pattern.replace(" ", "%20") + " #user_table", init);
$(".table-row").click(function() {
window.document.location = $(this).data("href");
});
}
searchbar_obj.keyup(reloadTable);
function init() {
$(".table-row").click(function() {
window.document.location = $(this).data("href");
});
}
init();
});
});
</script>
{% endblock %}