|
|
|
@ -26,25 +26,35 @@
|
|
|
|
|
{% endmacro %}
|
|
|
|
|
{% block maincontent %}
|
|
|
|
|
|
|
|
|
|
<div class="float-end">
|
|
|
|
|
<a href="/app/new" class="btn btn-secondary">→ Add a Riddle</a>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col">
|
|
|
|
|
<div class="form-check form-switch">
|
|
|
|
|
<input class="form-check-input" type="checkbox" role="switch" id="autoRefresh">
|
|
|
|
|
<label class="form-check-label" for="autoRefresh">Refresh for new messages</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col">
|
|
|
|
|
{{pagination()}}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col">
|
|
|
|
|
<a href="/app/new" class="btn btn-secondary">→ Add a Riddle</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{{pagination()}}
|
|
|
|
|
|
|
|
|
|
<table class="table table-striped">
|
|
|
|
|
<thead>
|
|
|
|
|
{% for item in db.iterate(**db_args) %}
|
|
|
|
|
{% set field_names = ['id'] + item.__fields__.keys()|list %}
|
|
|
|
|
|
|
|
|
|
{% if loop.index == 1 %}
|
|
|
|
|
<tr id="row_0">
|
|
|
|
|
{% for field in item.__fields__.keys() %}
|
|
|
|
|
{% for field in field_names %}
|
|
|
|
|
<th>
|
|
|
|
|
{% if field == 'time' %}
|
|
|
|
|
<input type="text" class="value_filter" name="filter_time_before" value="{{db_args.time_before}}" class="form-control" placeholder="Before">
|
|
|
|
|
<input type="text" class="value_filter" name="filter_time_after" value="{{db_args.time_after}}" class="form-control" placeholder="After">
|
|
|
|
|
<input type="text" class="value_filter" name="filter_time_before" value="{{timestamp2date(db_args.time_before)}}" class="form-control" placeholder="Before"><br />
|
|
|
|
|
<input type="text" class="value_filter" name="filter_time_after" value="{{timestamp2date(db_args.time_after)}}" class="form-control" placeholder="After"><br />
|
|
|
|
|
{% elif field not in ('message', 'count') %}
|
|
|
|
|
<input type="text" class="value_filter" name="filter_{{field}}" value="{{db_args[field]}}" class="form-control" placeholder="Filter">
|
|
|
|
|
<input type="text" class="value_filter" name="filter_{{field}}" value="{{db_args[field]}}" class="form-control" placeholder="Filter"><br />
|
|
|
|
|
{% endif %}
|
|
|
|
|
{{ field.title() }}
|
|
|
|
|
</th>
|
|
|
|
@ -54,7 +64,7 @@
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
<tr id="row_{{loop.index}}">
|
|
|
|
|
{% for field in item.__fields__.keys() %}
|
|
|
|
|
{% for field in field_names %}
|
|
|
|
|
{% if field == "message" %}
|
|
|
|
|
<td>
|
|
|
|
|
<button type="button" class="btn btn-outline-secondary btn-outline" data-bs-toggle="modal" data-bs-target="#row_message_{{loop.index}}">
|
|
|
|
@ -74,6 +84,8 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
{% elif field == "id" %}
|
|
|
|
|
<td>{{ item.message.id }}</td>
|
|
|
|
|
{% elif field == "time" %}
|
|
|
|
|
<td ts="item[field]">{{ timestamp2date(item[field]) }}</td>
|
|
|
|
|
{% else %}
|
|
|
|
@ -83,27 +95,43 @@
|
|
|
|
|
</tr>
|
|
|
|
|
{% else %}
|
|
|
|
|
<div class="alert alert-warning" role="alert">
|
|
|
|
|
No items found, reset offset, limit, filter, ...!
|
|
|
|
|
No items found, reset offset, limit, filter, ...!<br />
|
|
|
|
|
<a class="btn btn-warning" href="/app/table">Reset</a>
|
|
|
|
|
</div>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
<div class="float-end">
|
|
|
|
|
<div class="input-group">
|
|
|
|
|
<label class="input-group-text" for="items-per-page">Items per page</label>
|
|
|
|
|
<select class="form-select" id="items-per-page" onchange="location = this.value;">
|
|
|
|
|
<option value="?{{ pagination_link(limit=5) }}" {% if db_args.limit == 5 %}selected{% endif %}>5</option>
|
|
|
|
|
<option value="?{{ pagination_link(limit=10) }}" {% if db_args.limit == 10 %}selected{% endif %}>10</option>
|
|
|
|
|
<option value="?{{ pagination_link(limit=25) }}" {% if db_args.limit == 25 %}selected{% endif %}>25</option>
|
|
|
|
|
<option value="?{{ pagination_link(limit=100) }}" {% if db_args.limit == 100 %}selected{% endif %}>100</option>
|
|
|
|
|
{% if db_args.limit not in (5, 10, 25, 100) %}
|
|
|
|
|
<option value="?{{ pagination_link(limit=db_args.limit) }}" selected>{{db_args.limit}}</option>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</select>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col">
|
|
|
|
|
{{pagination()}}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col">
|
|
|
|
|
<div class="input-group">
|
|
|
|
|
<label class="input-group-text" for="total-items">Total items</label>
|
|
|
|
|
<input class="form-control" id="total-items" disabled value="{{ db.len(**db_args) }}" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col">
|
|
|
|
|
<div class="input-group">
|
|
|
|
|
<label class="input-group-text" for="items-per-page">Items per page</label>
|
|
|
|
|
<select class="form-select" id="items-per-page" onchange="window.location = this.value;">
|
|
|
|
|
<option value="?{{ pagination_link(limit=5) }}" {% if db_args.limit == 5 %}selected{% endif %}>5</option>
|
|
|
|
|
<option value="?{{ pagination_link(limit=10) }}" {% if db_args.limit == 10 %}selected{% endif %}>10</option>
|
|
|
|
|
<option value="?{{ pagination_link(limit=25) }}" {% if db_args.limit == 25 %}selected{% endif %}>25</option>
|
|
|
|
|
<option value="?{{ pagination_link(limit=100) }}" {% if db_args.limit == 100 %}selected{% endif %}>100</option>
|
|
|
|
|
{% if db_args.limit not in (5, 10, 25, 100) %}
|
|
|
|
|
<option value="?{{ pagination_link(limit=db_args.limit) }}" selected>{{db_args.limit}}</option>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{{pagination()}}
|
|
|
|
|
|
|
|
|
|
{% endblock %}
|
|
|
|
|
{% block morehead %}
|
|
|
|
|
<script>
|
|
|
|
|
const db_args = JSON.parse('{{ db_args|tojson }}');
|
|
|
|
|
const db_total = {{ db.len(**db_args) }};
|
|
|
|
|
</script>
|
|
|
|
|
{% endblock %}
|