1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-29 20:02:59 +00:00
nk20/templates/member/user_list.html

46 lines
1.1 KiB
HTML
Raw Normal View History

2019-09-23 10:50:14 +00:00
{% extends "base.html" %}
{% load render_table from django_tables2 %}
{% load crispy_forms_tags%}
{% block content %}
2020-04-01 18:14:16 +00:00
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note/section ...">
2019-09-23 10:50:14 +00:00
2020-04-01 18:14:16 +00:00
<hr>
2019-09-23 10:50:14 +00:00
2020-04-01 18:14:16 +00:00
<div id="user_table">
{% render_table table %}
2019-09-23 10:50:14 +00:00
</div>
{% endblock %}
{% block extrajavascript %}
<script type="text/javascript">
2020-04-01 18:14:16 +00:00
$(document).ready(function() {
let old_pattern = null;
let searchbar_obj = $("#searchbar");
2019-09-23 10:50:14 +00:00
2020-04-01 18:14:16 +00:00
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");
});
}
2019-09-23 10:50:14 +00:00
2020-04-01 18:14:16 +00:00
searchbar_obj.keyup(reloadTable);
function init() {
$(".table-row").click(function() {
window.document.location = $(this).data("href");
});
}
init();
});
2019-09-23 10:50:14 +00:00
</script>
{% endblock %}