mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
In terms of performance, most queries on this page win over PHP in query times, with the exception of sorting by Voted or Notify (https://gitlab.archlinux.org/archlinux/aurweb/-/issues/102). Otherwise, there are a few modifications: described below. * Pagination * The `paginate` Python module has been used in the FastAPI project here to implement paging on the packages search page. This changes how pagination is displayed, however it serves the same purpose. We'll take advantage of this module in other places as well. * Form action * The form action for actions now use `POST /packages` to perform. This is currently implemented and will be addressed in a follow-up commit. * Input names and values * Input names and values have been modified to satisfy the snake_case naming convention we'd like to use as much as possible. * Some input names and values were modified to comply with FastAPI Forms: (IDs[<id>]) -> (IDs, <id>). Signed-off-by: Kevin Morris <kevr@0cost.org>
114 lines
4.4 KiB
HTML
114 lines
4.4 KiB
HTML
<table {% if table_id %}id="{{ table_id }}"{% endif %} class="results">
|
|
<thead>
|
|
<tr>
|
|
{% if request.user.is_authenticated() %}
|
|
<th></th>
|
|
{% endif %}
|
|
<th>
|
|
{% set order = SO %}
|
|
{% if SB == "n" %}
|
|
{% set order = "d" if order == "a" else "a" %}
|
|
{% endif %}
|
|
<a href="/packages/?SB=n&SO={{ order }}">
|
|
{{ "Name" | tr }}
|
|
</a>
|
|
</th>
|
|
<th>{{ "Version" | tr }}</th>
|
|
<th>
|
|
{% set order = SO %}
|
|
{% if SB == "v" %}
|
|
{% set order = "d" if order == "a" else "a" %}
|
|
{% endif %}
|
|
<a href="/packages/?SB=v&SO={{ order }}">
|
|
{{ "Votes" | tr }}
|
|
</a>
|
|
</th>
|
|
<th>
|
|
{% set order = SO %}
|
|
{% if SB == "p" %}
|
|
{% set order = "d" if order == "a" else "a" %}
|
|
{% endif %}
|
|
<a href="/packages/?SB=p&SO={{ order }}">{{ "Popularity" | tr }}</a><span title="{{ 'Popularity is calculated as the sum of all votes with each vote being weighted with a factor of %.2f per day since its creation.' | format(0.98) }}" class="hover-help"><sup>?</sup></span>
|
|
</th>
|
|
{% if request.user.is_authenticated() %}
|
|
<th>
|
|
{% set order = SO %}
|
|
{% if SB == "w" %}
|
|
{% set order = "d" if order == "a" else "a" %}
|
|
{% endif %}
|
|
<a href="/packages/?SB=w&SO={{ order }}">
|
|
{{ "Voted" | tr }}
|
|
</a>
|
|
</th>
|
|
<th>
|
|
{% set order = SO %}
|
|
{% if SB == "o" %}
|
|
{% set order = "d" if order == "a" else "a" %}
|
|
{% endif %}
|
|
<a href="/packages/?SB=o&SO={{ order }}">
|
|
{{ "Notify" | tr }}
|
|
</a>
|
|
</th>
|
|
{% endif %}
|
|
<th>{{ "Description" | tr }}</th>
|
|
<th>
|
|
{% set order = SO %}
|
|
{% if SB == "m" %}
|
|
{% set order = "d" if order == "a" else "a" %}
|
|
{% endif %}
|
|
<a href="/packages/?SB=m&SO={{ order }}">
|
|
{{ "Maintainer" | tr }}
|
|
</a>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for pkg in packages %}
|
|
{% set flagged = pkg.PackageBase.OutOfDateTS %}
|
|
<tr>
|
|
{% if request.user.is_authenticated() %}
|
|
<td>
|
|
<input type="checkbox" name="IDs" value="{{ pkg.ID }}" />
|
|
</td>
|
|
{% endif %}
|
|
<td>
|
|
<a href="/packages/{{ pkg.Name }}">
|
|
{{ pkg.Name }}
|
|
</a>
|
|
</td>
|
|
{% if flagged %}
|
|
<td class="flagged">{{ pkg.Version }}</td>
|
|
{% else %}
|
|
<td>{{ pkg.Version }}</td>
|
|
{% endif %}
|
|
<td>{{ pkg.PackageBase.NumVotes }}</td>
|
|
<td>
|
|
{{ pkg.PackageBase.Popularity | number_format(2) }}
|
|
</td>
|
|
{% if request.user.is_authenticated() %}
|
|
<td>
|
|
{% if pkg.PackageBase.ID in voted %}
|
|
{{ "Yes" | tr }}
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if pkg.PackageBase.ID in notified %}
|
|
{{ "Yes" | tr }}
|
|
{% endif %}
|
|
</td>
|
|
{% endif %}
|
|
<td class="wrap">{{ pkg.Description or '' }}</td>
|
|
<td>
|
|
{% set maintainer = pkg.PackageBase.Maintainer %}
|
|
{% if maintainer %}
|
|
<a href="/account/{{ maintainer.Username }}">
|
|
{{ maintainer.Username }}
|
|
</a>
|
|
{% else %}
|
|
<span class="error">{{ "orphan" | tr }}</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|