1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-24 19:20:29 +02:00

Comment code

This commit is contained in:
Yohann D'ANELLO
2020-04-06 08:58:39 +02:00
parent 9d584ae87a
commit f833f1c46c
16 changed files with 201 additions and 40 deletions

View File

@ -118,7 +118,6 @@
});
$("#validate_activity").click(function () {
console.log(42);
$.ajax({
url: "/api/activity/activity/{{ activity.pk }}/",
type: "PATCH",

View File

@ -36,7 +36,6 @@ function getInfo() {
if (asked.length >= 1) {
$.getJSON("/api/members/club/?format=json&search="+asked, function(buttons){
let selected_id = buttons.results.map((a => "#row-"+a.id));
console.log(selected_id.join());
$(".table-row,"+selected_id.join()).show();
$(".table-row").not(selected_id.join()).hide();

View File

@ -7,7 +7,13 @@
<hr>
<div id="user_table">
{% render_table 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 %}

View File

@ -37,7 +37,6 @@ function getInfo() {
if (asked.length >= 1) {
$.getJSON("/api/note/transaction/template/?format=json&search="+asked, function(buttons){
let selected_id = buttons.results.map((a => "#row-"+a.id));
console.log(selected_id.join());
$(".table-row,"+selected_id.join()).show();
$(".table-row").not(selected_id.join()).hide();

View File

@ -5,24 +5,49 @@
{% block content %}
<a href="{% url 'registration:signup' %}"><button class="btn btn-primary btn-block">{% trans "New user" %}</button></a>
<hr>
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note/section ...">
<hr>
{% if table.data %}
<div id="user_table">
<div id="user_table">
{% if table.data %}
{% render_table table %}
</div>
{% else %}
<div class="alert alert-warning">
{% trans "There is no pending user." %}
</div>
{% endif %}
{% 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">
$(".table-row").click(function() {
window.document.location = $(this).data("href");
$(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 %}