This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git
The following commit(s) were added to refs/heads/main by this push:
new f3bf76b Update the upload a KEYS file form, and simplify the form
macros
f3bf76b is described below
commit f3bf76b3524895fb38f70d14d636ef493ac159c7
Author: Sean B. Palmer <[email protected]>
AuthorDate: Tue May 13 19:17:58 2025 +0100
Update the upload a KEYS file form, and simplify the form macros
---
atr/routes/keys.py | 13 +++++-
atr/templates/announce-selected.html | 6 +--
atr/templates/check-selected-candidate-forms.html | 8 ++--
atr/templates/finish-selected.html | 4 +-
atr/templates/keys-add.html | 6 +--
atr/templates/keys-upload.html | 50 +++++++----------------
atr/templates/macros/forms.html | 14 +++++--
atr/templates/release-policy-form.html | 14 +++----
8 files changed, 55 insertions(+), 60 deletions(-)
diff --git a/atr/routes/keys.py b/atr/routes/keys.py
index accd485..d674e71 100644
--- a/atr/routes/keys.py
+++ b/atr/routes/keys.py
@@ -429,7 +429,14 @@ async def upload(session: routes.CommitterSession) -> str:
user_committees = await data.committee(name_in=project_list).all()
class UploadKeyForm(util.QuartFormTyped):
- key = wtforms.FileField("KEYS file")
+ key = wtforms.FileField(
+ "KEYS file",
+ description=(
+ "Upload a KEYS file containing multiple PGP public keys."
+ " The file should contain keys in ASCII-armored format,
starting with"
+ ' "-----BEGIN PGP PUBLIC KEY BLOCK-----".'
+ ),
+ )
submit = wtforms.SubmitField("Upload KEYS file")
selected_committees = wtforms.SelectMultipleField(
"Associate keys with committees",
@@ -438,6 +445,10 @@ async def upload(session: routes.CommitterSession) -> str:
option_widget=wtforms.widgets.CheckboxInput(),
widget=wtforms.widgets.ListWidget(prefix_label=False),
validators=[wtforms.validators.InputRequired("You must select at
least one committee")],
+ description=(
+ "Select the committees with which to associate these keys."
+ " You must be a member of the selected committees."
+ ),
)
form = await UploadKeyForm.create_form()
diff --git a/atr/templates/announce-selected.html
b/atr/templates/announce-selected.html
index b2a4c2e..89d2bfe 100644
--- a/atr/templates/announce-selected.html
+++ b/atr/templates/announce-selected.html
@@ -72,7 +72,7 @@
{{ announce_form.hidden_tag() }}
<div class="row mb-3 pb-3 border-bottom">
- {{ forms.label(announce_form.mailing_list, high=True) }}
+ {{ forms.label(announce_form.mailing_list, col="sm3-high") }}
<div class="col-md-9">
<div class="d-flex gap-4 mb-3">
{% for subfield in announce_form.mailing_list %}
@@ -95,14 +95,14 @@
</div>
<div class="row mb-3 pb-3 border-bottom">
- {{ forms.label(announce_form.subject, col=True) }}
+ {{ forms.label(announce_form.subject, col="sm3") }}
<div class="col-md-9">
{{ forms.widget(announce_form.subject) }}
{{ forms.errors(announce_form.subject, classes="invalid-feedback
d-block") }}
</div>
</div>
<div class="row mb-3 pb-3 border-bottom">
- {{ forms.label(announce_form.body, col=True) }}
+ {{ forms.label(announce_form.body, col="sm3") }}
<div class="col-md-9">
<ul class="nav nav-tabs" id="announceBodyTab" role="tablist">
<li class="nav-item" role="presentation">
diff --git a/atr/templates/check-selected-candidate-forms.html
b/atr/templates/check-selected-candidate-forms.html
index e5b0328..0466b90 100644
--- a/atr/templates/check-selected-candidate-forms.html
+++ b/atr/templates/check-selected-candidate-forms.html
@@ -15,7 +15,7 @@
{{ form.hidden_tag() }}
<div class="row mb-3 pb-3 border-bottom">
- {{ forms.label(form.vote_value, col=True, classes="col-md-3 text-md-end")
}}
+ {{ forms.label(form.vote_value, col="md3") }}
<div class="col-md-9">
<div class="btn-group" role="group" aria-label="Vote options">
{% for subfield in form.vote_value %}
@@ -34,7 +34,7 @@
</div>
</div>
<div class="row mb-3">
- {{ forms.label(form.vote_comment, col=True, classes="col-md-3
text-md-end") }}
+ {{ forms.label(form.vote_comment, col="md3") }}
<div class="col-md-9">
{{ forms.widget(form.vote_comment, rows="3") }}
{{ forms.errors(form.vote_comment, classes="text-danger small mt-1") }}
@@ -59,7 +59,7 @@
<input type="hidden" name="candidate_name" value="{{ release.name }}" />
<div class="mb-3 pb-3 row border-bottom">
- {{ forms.label(resolve_form.vote_result, col=True, classes="col-sm-3
text-sm-end") }}
+ {{ forms.label(resolve_form.vote_result, col="md3") }}
<div class="col-sm-9 pt-2">
{% for subfield in resolve_form.vote_result %}
<div class="form-check form-check-inline">
@@ -71,7 +71,7 @@
</div>
</div>
<div class="row">
- {{ forms.label(resolve_form.resolution_body, col=True, classes="col-sm-3
text-sm-end") }}
+ {{ forms.label(resolve_form.resolution_body, col="md3") }}
<div class="col-sm-9">
{{ forms.widget(resolve_form.resolution_body, rows="3") }}
{{ forms.errors(resolve_form.resolution_body) }}
diff --git a/atr/templates/finish-selected.html
b/atr/templates/finish-selected.html
index 21b62de..691c16e 100644
--- a/atr/templates/finish-selected.html
+++ b/atr/templates/finish-selected.html
@@ -84,12 +84,12 @@
{{ form.hidden_tag() }}
<div class="mb-3">
- {{ forms.label(form.source_file, classes="pb-2") }}
+ {{ forms.label(form.source_file) }}
{{ forms.widget(form.source_file, classes="form-select
form-select-sm font-monospace") }}
{{ forms.errors(form.source_file, classes="invalid-feedback
d-block") }}
</div>
<div class="mb-3">
- {{ forms.label(form.target_directory, classes="pb-2") }}
+ {{ forms.label(form.target_directory) }}
{{ forms.widget(form.target_directory, classes="form-select
form-select-sm font-monospace") }}
{{ forms.errors(form.target_directory, classes="invalid-feedback
d-block") }}
</div>
diff --git a/atr/templates/keys-add.html b/atr/templates/keys-add.html
index 2347fd5..887a05f 100644
--- a/atr/templates/keys-add.html
+++ b/atr/templates/keys-add.html
@@ -27,7 +27,7 @@
<div class="mb-4">
<div class="row mb-3 pb-3 border-bottom">
- {{ forms.label(form.public_key, mcol=True, classes="col-form-label")
}}
+ {{ forms.label(form.public_key, col="md3") }}
<div class="col-md-9">
{{ forms.widget(form.public_key, classes="form-control
font-monospace", rows=10) }}
{{ forms.description(form.public_key) }}
@@ -36,7 +36,7 @@
</div>
<div class="row mb-3 pb-3 border-bottom">
- {{ forms.label(form.selected_committees, mcol=True) }}
+ {{ forms.label(form.selected_committees, col="md3") }}
<div class="col-md-9">
<div class="row">
{% for subfield in form.selected_committees %}
@@ -59,7 +59,7 @@
</div>
</div>
- <div class="mt-4 col-md-9 offset-md-2">
+ <div class="mt-4 col-md-9 offset-md-3 px-1">
{{ form.submit(class_='btn btn-primary') }}
<a href="{{ as_url(routes.keys.keys) }}"
class="btn btn-link text-secondary">Cancel</a>
diff --git a/atr/templates/keys-upload.html b/atr/templates/keys-upload.html
index 53f2b9c..34743e0 100644
--- a/atr/templates/keys-upload.html
+++ b/atr/templates/keys-upload.html
@@ -84,14 +84,7 @@
<h1>Upload a KEYS file</h1>
<p>Upload a KEYS file containing multiple GPG public keys.</p>
- {% if form.errors %}
- <h2 class="text-danger">Form errors</h2>
- <div class="mt-3 mb-3">
- {% for field, errors in form.errors.items() %}
- {% for error in errors %}<p class="text-danger mb-1">{{ field }}: {{
error }}</p>{% endfor %}
- {% endfor %}
- </div>
- {% endif %}
+ {{ forms.errors_summary(form) }}
{% if results and submitted_committees %}
<h2>KEYS processing results</h2>
@@ -152,39 +145,30 @@
<form method="post"
class="atr-canary py-4 px-5"
- enctype="multipart/form-data">
+ enctype="multipart/form-data"
+ novalidate>
{{ form.hidden_tag() }}
<div class="mb-4">
<div class="row mb-3 pb-3 border-bottom">
- <div class="col-md-2 text-md-end fw-medium pt-2">{{
form.key.label(class="form-label") }}</div>
+ {{ forms.label(form.key, col="md2") }}
<div class="col-md-9">
- {{ form.key(class="form-control", aria_describedby="keys-help") }}
- <small id="keys-help" class="form-text text-muted mt-2">
- Upload a KEYS file containing multiple PGP public keys. The file
should contain keys in ASCII-armored format, starting with "-----BEGIN PGP
PUBLIC KEY BLOCK-----".
- </small>
- {% if form.key.errors %}
- <div class="invalid-feedback d-block">
- {% for error in form.key.errors %}{{ error }}{% endfor %}
- </div>
- {% endif %}
+ {{ forms.widget(form.key, id=form.key.id) }}
+ {{ forms.errors(form.key, classes="invalid-feedback d-block") }}
+ {{ forms.description(form.key, classes="form-text text-muted mt-2")
}}
</div>
</div>
{% if user_committees %}
<div class="row mb-3 pb-3 border-bottom">
- <div class="col-md-2 text-md-end fw-medium pt-2">Associate keys with
committees</div>
+ {{ forms.label(form.selected_committees, col="md2") }}
<div class="col-md-9">
<div class="row">
- {% for value, label in form.selected_committees.choices %}
+ {% for subfield in form.selected_committees %}
<div class="col-sm-12 col-md-6 col-lg-4">
<div class="form-check mb-2">
- <input type="checkbox"
- name="selected_committees"
- value="{{ value }}"
- id="committee_{{ loop.index }}"
- class="form-check-input" />
- <label for="committee_{{ loop.index }}"
class="form-check-label">{{ label }}</label>
+ {{ forms.widget(subfield, classes="form-check-input") }}
+ {{ forms.label(subfield, classes="form-check-label") }}
</div>
</div>
{% else %}
@@ -196,14 +180,8 @@
id="toggleCommitteesBtn"
class="btn btn-sm btn-outline-secondary">Select
all</button>
</div>
- <small class="form-text text-muted mt-2">
- Select the committees with which to associate these keys. You
must be a member of the selected committees.
- </small>
- {% if form.selected_committees.errors %}
- <div class="invalid-feedback d-block">
- {% for error in form.selected_committees.errors %}{{ error
}}{% endfor %}
- </div>
- {% endif %}
+ {{ forms.errors(form.selected_committees,
classes="invalid-feedback d-block") }}
+ {{ forms.description(form.selected_committees, classes="form-text
text-muted mt-2") }}
</div>
</div>
{% else %}
@@ -216,7 +194,7 @@
</div>
<div class="mt-4 col-md-9 offset-md-2">
- {{ form.submit(class="btn btn-primary") }}
+ {{ form.submit(class_="btn btn-primary") }}
<a href="{{ as_url(routes.keys.keys) }}"
class="btn btn-link text-secondary">Cancel</a>
</div>
diff --git a/atr/templates/macros/forms.html b/atr/templates/macros/forms.html
index 8fecf77..bf06a5b 100644
--- a/atr/templates/macros/forms.html
+++ b/atr/templates/macros/forms.html
@@ -1,12 +1,18 @@
-{% macro label(field, classes=None, col=False, high=False, mcol=False) %}
+{% macro label(field, classes=None, col="") %}
{% if field.label %}
{% set base_structural_classes = "" %}
- {% if col %}
+ {% if col == "sm3" %}
{% set base_structural_classes = "col-sm-3 col-form-label text-sm-end" %}
- {% elif high %}
+ {% elif col == "sm3-high" %}
{% set base_structural_classes = "col-sm-3 text-sm-end" %}
- {% elif mcol %}
+ {% elif col == "md2" %}
+ {% set base_structural_classes = "col-md-2 col-form-label text-md-end" %}
+ {% elif col == "md2-high" %}
{% set base_structural_classes = "col-md-2 text-md-end" %}
+ {% elif col == "md3" %}
+ {% set base_structural_classes = "col-md-3 col-form-label text-md-end" %}
+ {% elif col == "md3-high" %}
+ {% set base_structural_classes = "col-md-3 text-md-end" %}
{% endif %}
{% set final_class_list = [] %}
{% if base_structural_classes %}
diff --git a/atr/templates/release-policy-form.html
b/atr/templates/release-policy-form.html
index dee7c57..fb3bab4 100644
--- a/atr/templates/release-policy-form.html
+++ b/atr/templates/release-policy-form.html
@@ -13,7 +13,7 @@
</div>
<div class="mb-3 pb-3 row border-bottom">
- {{ forms.label(form.mailto_addresses.entries[0], col=True) }}
+ {{ forms.label(form.mailto_addresses.entries[0], col="md3") }}
<div class="col-sm-8">
{{ forms.widget(form.mailto_addresses.entries[0]) }}
{{ forms.errors(form.mailto_addresses.entries[0]) }}
@@ -27,7 +27,7 @@
</div>
<div class="mb-3 pb-3 row border-bottom">
- {{ forms.label(form.manual_vote, high=True) }}
+ {{ forms.label(form.manual_vote, col="md3-high") }}
<div class="col-sm-8">
<div class="form-check">
{{ forms.widget(form.manual_vote, classes="form-check-input") }}
@@ -39,7 +39,7 @@
</div>
<div class="mb-3 pb-3 row border-bottom">
- {{ forms.label(form.min_hours, col=True) }}
+ {{ forms.label(form.min_hours, col="md3") }}
<div class="col-sm-8">
{{ forms.widget(form.min_hours) }}
{{ forms.errors(form.min_hours) }}
@@ -48,7 +48,7 @@
</div>
<div class="mb-3 pb-3 row border-bottom">
- {{ forms.label(form.release_checklist, col=True) }}
+ {{ forms.label(form.release_checklist, col="md3") }}
<div class="col-sm-8">
{{ forms.widget(form.release_checklist) }}
{{ forms.errors(form.release_checklist) }}
@@ -57,7 +57,7 @@
</div>
<div class="mb-3 pb-3 row border-bottom">
- {{ forms.label(form.start_vote_template, col=True) }}
+ {{ forms.label(form.start_vote_template, col="md3") }}
<div class="col-sm-8">
{{ forms.widget(form.start_vote_template) }}
{{ forms.errors(form.start_vote_template) }}
@@ -66,7 +66,7 @@
</div>
<div class="mb-3 pb-3 row border-bottom">
- {{ forms.label(form.announce_release_template, col=True) }}
+ {{ forms.label(form.announce_release_template, col="md3") }}
<div class="col-sm-8">
{{ forms.widget(form.announce_release_template) }}
{{ forms.errors(form.announce_release_template) }}
@@ -75,7 +75,7 @@
</div>
<div class="mb-3 pb-3 row border-bottom">
- {{ forms.label(form.pause_for_rm, high=True) }}
+ {{ forms.label(form.pause_for_rm, col="md3-high") }}
<div class="col-sm-8">
<div class="form-check">
{{ forms.widget(form.pause_for_rm, classes="form-check-input") }}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]