diff options
| author | Dennis Fink | 2026-11-16 22:21:19 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-16 22:21:19 +0100 |
| commit | 354a5b449077478b141683bafbab47c9dc169d21 (patch) | |
| tree | b2d0be9cb848faf2f9944bb69a63f9fd9a857dbd /webmentions_ssg/templates | |
| parent | f7d846b66ae4286518ecc20537ba19c5afadf7f4 (diff) | |
| download | webmentions-ssg-354a5b449077478b141683bafbab47c9dc169d21.tar.gz webmentions-ssg-354a5b449077478b141683bafbab47c9dc169d21.zip | |
feat(receiver): add sorting and page size controls
Allow received Webmentions to be sorted by status, source, target,
received time, or updated time with stable pagination and accessible
sortable headers.
Add configurable per-page sizing and preserve sorting, filters, and page
size across pagination and administrative actions.
Diffstat (limited to 'webmentions_ssg/templates')
| -rw-r--r-- | webmentions_ssg/templates/received.html | 69 |
1 files changed, 56 insertions, 13 deletions
diff --git a/webmentions_ssg/templates/received.html b/webmentions_ssg/templates/received.html index 9034ca8..8cd952c 100644 --- a/webmentions_ssg/templates/received.html +++ b/webmentions_ssg/templates/received.html @@ -34,6 +34,18 @@ SPDX-License-Identifier: BSD-3-Clause } } %} +{% macro sortable_header(label, column) %} + {% set active = sort_key == column %} + <th scope="col" + aria-sort="{{ ('ascending' if sort_order == 'asc' else 'descending') if active else 'none' }}"> + <a href="{{ sort_urls[column] }}" + class="link-body-emphasis text-decoration-none"> + {{ label }} + {% if active %}<span aria-hidden="true">{{ "↑" if sort_order == "asc" else "↓" }}</span>{% endif %} + </a> + </th> +{% endmacro %} + {% block content %} <div class="d-flex justify-content-between align-items-center mb-3"> <h1 class="mb-0">Received Webmentions</h1> @@ -43,21 +55,52 @@ SPDX-License-Identifier: BSD-3-Clause method="get" class="row g-2 align-items-end mb-4" role="search"> + <input id="sort" name="sort" type="hidden" value="{{ sort_key }}"> + <input id="order" name="order" type="hidden" value="{{ sort_order }}"> <div class="col-sm-6 col-lg"> - {{ filter_form.status.label(class="form-label") }} - {{ filter_form.status(class="form-select") }} + <label class="form-label" for="status">Status</label> + <select class="form-select" id="status" name="status"> + {% for value, label in status_choices.items() %} + <option value="{{ value }}" + {% if filters.get("status", "") == value %} selected{% endif %}>{{ label }}</option> + {% endfor %} + </select> </div> <div class="col-sm-6 col-lg"> - {{ filter_form.q.label(class="form-label") }} - {{ filter_form.q(class="form-control", placeholder="Search URLs") }} + <label class="form-label" for="q">Source or target</label> + <input class="form-control" + id="q" + name="q" + type="search" + value="{{ filters.get('q', '') }}" + placeholder="Search URLs"> </div> <div class="col-sm-6 col-lg"> - {{ filter_form.date_from.label(class="form-label") }} - {{ filter_form.date_from(class="form-control") }} + <label class="form-label" for="date_from">Updated from (UTC)</label> + <input class="form-control" + id="date_from" + name="date_from" + type="date" + value="{{ filters.get('date_from', '') }}"> </div> <div class="col-sm-6 col-lg"> - {{ filter_form.date_to.label(class="form-label") }} - {{ filter_form.date_to(class="form-control") }} + <label class="form-label" for="date_to">Updated to (UTC)</label> + <input class="form-control" + id="date_to" + name="date_to" + type="date" + value="{{ filters.get('date_to', '') }}"> + </div> + <div class="col-sm-6 col-lg-auto"> + <label class="form-label" for="per_page">Rows per page</label> + <input class="form-control" + id="per_page" + name="per_page" + type="number" + value="{{ page_size }}" + min="1" + max="{{ max_received_page_size }}" + step="1"> </div> <div class="col-auto d-flex gap-2 ms-auto"> <button type="submit" class="btn btn-primary">Filter</button> @@ -69,11 +112,11 @@ SPDX-License-Identifier: BSD-3-Clause <table class="table table-bordered table-striped table-hover align-middle"> <thead> <tr> - <th scope="col">Status</th> - <th scope="col">Source</th> - <th scope="col">Target</th> - <th scope="col">Received</th> - <th scope="col">Updated</th> + {{ sortable_header('Status', 'status') }} + {{ sortable_header('Source', 'source') }} + {{ sortable_header('Target', 'target') }} + {{ sortable_header('Received', 'received') }} + {{ sortable_header('Updated', 'updated') }} <th scope="col">Reason</th> <th scope="col">Actions</th> </tr> |
