nk20/templates/member/club_list.html

57 lines
1.7 KiB
HTML
Raw Normal View History

2019-08-11 21:25:27 +00:00
{% extends "base.html" %}
2019-08-13 16:22:19 +00:00
{% load render_table from django_tables2 %}
2020-03-11 11:05:29 +00:00
{% load i18n %}
2019-08-11 21:25:27 +00:00
{% block content %}
<div class="row justify-content-center mb-4">
<div class="col-md-10 text-center">
2020-06-21 20:27:32 +00:00
<input class="form-control mx-auto w-25" type="text" id="search_field"/>
<hr>
2020-04-01 18:14:16 +00:00
<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">
<div class="col-md-10">
<div class="card card-border shadow">
<div class="card-header text-center">
<h5> {% trans "Club listing" %}</h5>
</div>
<div class="card-body px-0 py-0" id="club_table">
{% render_table table %}
</div>
</div>
</div>
</div>
2019-08-15 19:49:32 +00:00
{% endblock %}
2019-08-15 21:12:27 +00:00
{% block extrajavascript %}
2019-08-15 19:49:32 +00:00
<script type="text/javascript">
2020-06-21 20:27:32 +00:00
$(document).ready(function() {
let old_pattern = null;
let searchbar_obj = $("#search_field");
var timer_on = false;
var timer;
2019-08-15 19:49:32 +00:00
2020-06-21 20:27:32 +00:00
function reloadTable() {
let pattern = searchbar_obj.val();
2020-07-30 13:49:59 +00:00
$("#club_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #club_table", init);
2020-06-21 20:27:32 +00:00
}
searchbar_obj.keyup(function() {
if (timer_on)
clearTimeout(timer);
timer_on = true;
setTimeout(reloadTable, 0);
});
2020-06-21 20:27:32 +00:00
function init() {
$(".table-row").click(function() {
window.document.location = $(this).data("href");
timer_on = false;
});
}
2019-08-15 19:49:32 +00:00
2020-06-21 20:27:32 +00:00
init();
});
2019-08-15 19:49:32 +00:00
</script>
2019-08-11 21:25:27 +00:00
{% endblock %}