2020-04-05 04:40:03 +00:00
|
|
|
{% extends "base.html" %}
|
|
|
|
{% load render_table from django_tables2 %}
|
|
|
|
{% load crispy_forms_tags %}
|
|
|
|
{% load i18n %}
|
|
|
|
|
|
|
|
{% block content %}
|
2020-04-05 06:01:51 +00:00
|
|
|
<a href="{% url 'registration:signup' %}"><button class="btn btn-primary btn-block">{% trans "New user" %}</button></a>
|
2020-04-06 06:58:39 +00:00
|
|
|
<hr>
|
|
|
|
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note/section ...">
|
2020-04-05 04:40:03 +00:00
|
|
|
<hr>
|
|
|
|
|
2020-04-06 06:58:39 +00:00
|
|
|
<div id="user_table">
|
|
|
|
{% if table.data %}
|
2020-04-05 06:01:51 +00:00
|
|
|
{% render_table table %}
|
2020-04-06 06:58:39 +00:00
|
|
|
{% else %}
|
|
|
|
<div class="alert alert-warning">
|
|
|
|
{% trans "There is no pending user with this pattern." %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2020-04-05 04:40:03 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block extrajavascript %}
|
|
|
|
<script type="text/javascript">
|
2020-04-06 06:58:39 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
let old_pattern = null;
|
|
|
|
let searchbar_obj = $("#searchbar");
|
|
|
|
|
|
|
|
function reloadTable() {
|
|
|
|
let pattern = searchbar_obj.val();
|
|
|
|
|
|
|
|
if (pattern === old_pattern || pattern === "")
|
|
|
|
return;
|
|
|
|
|
2020-07-30 13:49:59 +00:00
|
|
|
$("#user_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #user_table", init);
|
2020-04-06 06:58:39 +00:00
|
|
|
|
|
|
|
$(".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();
|
2020-04-05 04:40:03 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|