housekeep: TU rename - /tu routes

Change /tu to /package-maintainer

Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
moson 2023-09-10 08:49:59 +02:00
parent 9730122da9
commit 49b7fa37f3
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
13 changed files with 68 additions and 62 deletions

View file

@ -0,0 +1,37 @@
<div class="box">
<h2>{% trans %}{{ title }}{% endtrans %}</h2>
<table class="results last-votes">
<thead>
<th>{{ "User" | tr }}</th>
<th>{{ "Last vote" | tr }}</th>
</thead>
<tbody>
{% if not votes %}
<tr>
<td align="center" colspan="0">
{{ "No results found." | tr }}
</td>
<td></td>
</tr>
{% else %}
{% for vote in votes %}
<tr>
<td>
<a href="/account/{{ vote.Username }}">
{{ vote.Username }}
</a>
</td>
<td>
<a href="/package-maintainer/{{ vote.LastVote }}">
{{ vote.LastVote }}
</a>
</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</div>

View file

@ -0,0 +1,112 @@
<h2>{% trans %}Proposal Details{% endtrans %}</h2>
{% if voteinfo.is_running() %}
<p class="vote-running" style="font-weight: bold; color: red">
{% trans %}This vote is still running.{% endtrans %}
</p>
{% endif %}
<!-- The margin style here mimics the margin on the old <p> element. -->
<div class="proposal details">
<div class="field user">
{{ "User" | tr }}:
<strong>
{% if voteinfo.User %}
<a href="{{ '/packages/?K=%s&SeB=m' | format(voteinfo.User)}}">
{{ voteinfo.User }}
</a>
{% else %}
N/A
{% endif %}
</strong>
</div>
<div class="field">
{{ "Active" | tr }} {{ "Package Maintainers" | tr }} {{ "assigned" | tr }}:
{{ voteinfo.ActiveTUs }}
</div>
{% set submitter = voteinfo.Submitter.Username %}
{% set submitter_uri = "/account/%s" | format(submitter) %}
{% set submitter = '<a href="%s">%s</a>' | format(submitter_uri, submitter) %}
<div class="field submitted">
{{
"Submitted: %s by %s" | tr
| format(datetime_display(voteinfo.Submitted), submitter)
| safe
}}
</div>
<div class="field end">
{{ "End" | tr }}:
<strong>
{{ datetime_display(voteinfo.End) }}
</strong>
</div>
{% if not voteinfo.is_running() %}
<div class="field result">
{{ "Result" | tr }}:
{% if not voteinfo.ActiveTUs %}
<span>{{ "unknown" | tr }}</span>
{% elif accepted %}
<span style="color: green; font-weight: bold">
{{ "Accepted" | tr }}
</span>
{% else %}
<span style="color: red; font-weight: bold">
{{ "Rejected" | tr }}
</span>
{% endif %}
</div>
{% endif %}
</div>
<div class="proposal agenda">
<p class="field agenda">
<!-- The `e` filter manually escapes content. -->
{{ voteinfo.Agenda | replace("\n", "<br />\n") | safe | e }}
</p>
</div>
<table class="vote-status">
<tr>
{% if not voteinfo.is_running() %}
<th>{{ "Yes" | tr }}</th>
<th>{{ "No" | tr }}</th>
<th>{{ "Abstain" | tr }}</th>
{% endif %}
<th>{{ "Total" | tr }}</th>
<th>{{ "Voted" | tr }}</th>
<th>{{ "Participation" | tr }}</th>
</tr>
<tr>
{% if not voteinfo.is_running() %}
<td>{{ voteinfo.Yes }}</td>
<td>{{ voteinfo.No }}</td>
<td>{{ voteinfo.Abstain }}</td>
{% endif %}
<td>{{ voteinfo.total_votes() }}</td>
<td>
{% if not has_voted %}
<span style="color: red; font-weight: bold">
{{ "No" | tr }}
</span>
{% else %}
<span style="color: green; font-weight: bold">
{{ "Yes" | tr }}
</span>
{% endif %}
</td>
<td>
{% if voteinfo.ActiveTUs %}
{{ (participation * 100) | number_format(2) }}%
{% else %}
{{ "unknown" | tr }}
{% endif %}
</td>
</tr>
</table>

View file

@ -0,0 +1,14 @@
<form class="action-form" action="/package-maintainer/{{ proposal }}" method="POST">
<!-- Translate each button's text but leave the value alone. -->
<fieldset>
<button type="submit" class="button" name="decision" value="Yes">
{{ "Yes" | tr }}
</button>
<button type="submit" class="button" name="decision" value="No">
{{ "No" | tr }}
</button>
<button type="submit" class="button" name="decision" value="Abstain">
{{ "Abstain" | tr }}
</button>
</fieldset>
</form>

View file

@ -0,0 +1,10 @@
<h2>{{ "Voters" | tr }}</h2>
<ul id="voters">
{% for voter in voters %}
<li>
<a href="/account/{{ voter.Username | quote_plus }}">
{{ voter.Username | e }}
</a>
</li>
{% endfor %}
</ul>

View file

@ -0,0 +1,113 @@
<div class="box">
<h2>{% trans %}{{ title }}{% endtrans %}</h2>
{% if title == "Current Votes" and request.user.has_credential(creds.PM_ADD_VOTE) %}
<ul class="admin-actions">
<li>
<a href="/addvote">
{% trans %}Add Proposal{% endtrans %}
</a>
</li>
</ul>
{% endif %}
{% if not results %}
<p>
{% trans %}No results found.{% endtrans %}
</p>
{% else %}
<table class="results {{ table_class }}">
<thead>
<tr>
<th>{{ "Proposal" | tr }}</th>
<th>
{% set off_qs = "%s=%d" | format(off_param, off) %}
{% set by_qs = "%s=%s" | format(by_param, by_next | quote_plus) %}
<a href="?{{ q | extend_query([off_param, off], [by_param, by_next]) | urlencode }}">
{{ "Start" | tr }}
</a>
</th>
<th>{{ "End" | tr }}</th>
<th>{{ "User" | tr }}</th>
{% if title != "Current Votes" %}
<th>{{ "Yes" | tr }}</th>
<th>{{ "No" | tr }}</th>
{% endif %}
<th>{{ "Voted" | tr }}</th>
</tr>
</thead>
<tbody>
{% for result in results %}
<tr>
<td>
<!-- Truncate the agenda back to prev_len. -->
{% set agenda = result.Agenda[:prev_len] %}
<a href="/package-maintainer/{{ result.ID }}">{{ agenda }}</a>
</td>
<td>{{ date_display(result.Submitted) }}</td>
<td>{{ date_display(result.End) }}</td>
<td>
{% if not result.User %}
N/A
{% else %}
<a href="/packages/?K={{ result.User }}&amp;SeB=m">
{{ result.User }}
</a>
{% endif %}
</td>
{% if title != "Current Votes" %}
<td>{{ result.Yes }}</td>
<td>{{ result.No }}</td>
{% endif %}
{% set vote = (result | get_vote(request)) %}
<td>
{% if vote %}
<span style="color: green; font-weight: bold">
{{ "Yes" | tr }}
</span>
{% else %}
<span style="color: red; font-weight: bold">
{{ "No" | tr }}
</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="pkglist-stats">
<p class="pkglist-nav">
{% if total_votes > pp %}
{% if off > 0 %}
{% set off_qs = "%s=%d" | format(off_param, off - 10) %}
{% set by_qs = "%s=%s" | format(by_param, by | quote_plus) %}
<a class="page"
href="?{{ q | extend_query([off_param, ([off - 10, 0] | max)], [by_param, by]) | urlencode }}">
Back
</a>
{% endif %}
{% if off < total_votes - pp %}
{% set off_qs = "%s=%d" | format(off_param, off + 10) %}
{% set by_qs = "%s=%s" | format(by_param, by | quote_plus) %}
<a class="page"
href="?{{ q | extend_query([off_param, off + pp], [by_param, by]) | urlencode }}">
Next
</a>
{% endif %}
{% endif %}
</p>
</div>
{% endif %}
</div>