mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-12-23 16:02:25 +00:00
52 lines
1.3 KiB
HTML
52 lines
1.3 KiB
HTML
{% extends "base.html" %}
|
|
{% 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 ...">
|
|
|
|
<hr>
|
|
|
|
<div id="user_table">
|
|
{% if table.data %}
|
|
{% render_table table %}
|
|
{% else %}
|
|
<div class="alert alert-warning">
|
|
{% trans "There is no pending user with this pattern." %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
{% block extrajavascript %}
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
let old_pattern = null;
|
|
let searchbar_obj = $("#searchbar");
|
|
|
|
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 %}
|