actix-admin/actix_admin/templates/list.html

94 lines
3.6 KiB
HTML
Raw Normal View History

2022-04-23 20:03:09 +02:00
{% extends "base.html" %}
{% block content %}
2022-07-26 22:34:33 +02:00
2022-07-29 17:53:59 +02:00
{% if not render_partial or render_partial == false %}
2022-07-26 22:34:33 +02:00
<article>
<div class="grid">
<div>
2022-07-29 17:53:59 +02:00
<a href="create" role="button">Create</a>
</div>
<!--
<div>
<details role="list">
<summary aria-haspopup="listbox" role="button">
With selected
</summary>
<ul role="listbox">
<li><a>Delete</a></li>
</ul>
</details>
</div>-->
<div>
<input type="search" id="search" name="search" placeholder="Search"
hx-get="/admin/{{ entity_name }}/list?render_partial=true&entities_per_page={{ entities_per_page }}&page={{ page }}"
hx-trigger="keyup changed delay:500ms, search" hx-target="#{{ entity_name }}table"
>
2022-07-26 22:34:33 +02:00
</div>
</div>
2022-07-29 17:53:59 +02:00
<figure id="{{ entity_name }}table">
{% endif %}
<table role="grid">
<thead>
<tr>
<th>
<!-- Select Checkbox -->
</th>
<th>{{ view_model.primary_key | title }}</th>
{% for model_field in view_model.fields -%}
<th>{{ model_field.field_name | split(pat="_") | join(sep=" ") | title }}</th>
{%- endfor %}
<th>
<!-- Edit Action -->
<!-- Delete Action -->
</th>
</tr>
</thead>
<tbody hx-confirm="Are you sure?" hx-target="closest tr" hx-swap="outerHTML">
{% for entity in entities -%}
<tr>
<td><input type="checkbox" id="entity{{ entity.primary_key }}" name="terms"></td>
<td>{{ entity.primary_key }}</td>
{% for model_field in view_model.fields -%}
<td>{{ entity.values | get(key=model_field.field_name) }}</td>
2022-06-02 18:46:24 +02:00
{%- endfor %}
2022-07-29 17:53:59 +02:00
<td>
<a href="edit/{{ entity.primary_key }}">&#9998;</a>
<a href="#" hx-post="delete/{{ entity.primary_key }}">&#128465;</a>
</td>
</tr>
{%- endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="{{ view_model.fields | length + 3 }}">
<a href="?page={{ page - 1 }}&entities_per_page={{ entities_per_page }}">&laquo;</a>
{% for i in range(end=num_pages) %}
<a href="?page={{ i + 1 }}&entities_per_page={{ entities_per_page }}">{{ i + 1 }}</a>
{%- endfor %}
<a href="?page={{ page + 1 }}&entities_per_page={{ entities_per_page }}">&raquo;</a>
</td>
</tr>
</tfoot>
</table>
{% if not render_partial or render_partial == false %}
</figure>
2022-07-26 22:34:33 +02:00
<div class="grid">
2022-07-29 17:53:59 +02:00
<div></div>
<div></div>
<div></div>
2022-07-26 22:34:33 +02:00
<div>
<form>
<label for="entities_per_page">Entities per Page
<select name="entities_per_page" onchange="this.form.submit()">
{% for a in [10,20,50,100,] %}
2022-07-29 17:53:59 +02:00
<option {% if entities_per_page==a %}selected{% endif %} value="{{ a }}">{{ a }}</option>
2022-07-26 22:34:33 +02:00
{% endfor %}
</select>
</label>
</form>
</div>
</div>
</article>
2022-07-29 17:53:59 +02:00
{% endif %}
2022-04-23 20:03:09 +02:00
{% endblock content %}