Allow basic searching of users and events
Issue: #12 Signed-Off-By: Cara Salter <cara@devcara.com>
This commit is contained in:
parent
4d56b40c5a
commit
83b3eef3bd
3 changed files with 27 additions and 2 deletions
12
acmsite/static/js/tableutils.js
Normal file
12
acmsite/static/js/tableutils.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
var $rows = $('#searchable tr');
|
||||||
|
$('#search').keyup(function() {
|
||||||
|
|
||||||
|
var val = '^(?=.*\\b' + $.trim($(this).val()).split(/\s+/).join('\\b)(?=.*\\b') + ').*$',
|
||||||
|
reg = RegExp(val, 'i'),
|
||||||
|
text;
|
||||||
|
|
||||||
|
$rows.show().filter(function() {
|
||||||
|
text = $(this).text().replace(/\s+/g, ' ');
|
||||||
|
return !reg.test(text);
|
||||||
|
}).hide();
|
||||||
|
});
|
|
@ -4,6 +4,11 @@
|
||||||
{% block app_content %}
|
{% block app_content %}
|
||||||
<h1>Event list</h1>
|
<h1>Event list</h1>
|
||||||
|
|
||||||
|
<div class="mt-2">
|
||||||
|
<label for="search">Search</label>
|
||||||
|
<input type="text" id="search" class="form-control w-25"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -15,7 +20,7 @@
|
||||||
data-bs-target="#editModal" data-id="0">New</button></th>
|
data-bs-target="#editModal" data-id="0">New</button></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody id="searchable">
|
||||||
{% for e in e_list %}
|
{% for e in e_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ e.name }}</td>
|
<td>{{ e.name }}</td>
|
||||||
|
@ -126,6 +131,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="{{ url_for('static', filename='js/jquery-3.6.3.min.js') }}" charset="utf-8"></script>
|
<script src="{{ url_for('static', filename='js/jquery-3.6.3.min.js') }}" charset="utf-8"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/tableutils.js') }}"></script>
|
||||||
<script charset="utf-8">
|
<script charset="utf-8">
|
||||||
const deleteButton = document.getElementById("delete")
|
const deleteButton = document.getElementById("delete")
|
||||||
const editButton = document.getElementById("edit-save")
|
const editButton = document.getElementById("edit-save")
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
|
|
||||||
{% block app_content %}
|
{% block app_content %}
|
||||||
<h1>Member List</h1>
|
<h1>Member List</h1>
|
||||||
|
<div>
|
||||||
<a href="{{ url_for('admin.users_csv') }}" target="_blank">CSV for ACM</a>
|
<a href="{{ url_for('admin.users_csv') }}" target="_blank">CSV for ACM</a>
|
||||||
|
</div>
|
||||||
|
<div class="mt-2">
|
||||||
|
<label for="search">Search</label>
|
||||||
|
<input type="text" id="search" class="form-control w-25"/>
|
||||||
|
</div>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -14,7 +20,7 @@
|
||||||
<th>Options</th>
|
<th>Options</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody id="searchable">
|
||||||
{% for u in u_list %}
|
{% for u in u_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ u.email }}</td>
|
<td>{{ u.email }}</td>
|
||||||
|
@ -51,6 +57,7 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<script src="{{ url_for('static', filename='js/jquery-3.6.3.min.js') }}" charset="utf-8"></script>
|
<script src="{{ url_for('static', filename='js/jquery-3.6.3.min.js') }}" charset="utf-8"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/tableutils.js') }}"></script>
|
||||||
<script charset="utf-8">
|
<script charset="utf-8">
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
$('a.toggle-admin').click((e) => {
|
$('a.toggle-admin').click((e) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue