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 1e95895 Update the finish selected release and add GPG key forms
1e95895 is described below
commit 1e95895c1379fceb052d4510841add237de322d9
Author: Sean B. Palmer <[email protected]>
AuthorDate: Tue May 13 18:41:36 2025 +0100
Update the finish selected release and add GPG key forms
---
atr/blueprints/admin/admin.py | 1 +
atr/blueprints/admin/templates/delete-release.html | 2 +-
atr/routes/keys.py | 7 +++-
atr/routes/resolve.py | 3 --
atr/templates/check-selected-candidate-forms.html | 2 +-
atr/templates/finish-selected.html | 20 ++++-------
atr/templates/keys-add.html | 30 +++++------------
atr/templates/macros/forms.html | 39 +++++++++++++---------
8 files changed, 48 insertions(+), 56 deletions(-)
diff --git a/atr/blueprints/admin/admin.py b/atr/blueprints/admin/admin.py
index 9a91437..238a812 100644
--- a/atr/blueprints/admin/admin.py
+++ b/atr/blueprints/admin/admin.py
@@ -52,6 +52,7 @@ class DeleteReleaseForm(util.QuartFormTyped):
wtforms.validators.InputRequired("Confirmation is required"),
wtforms.validators.Regexp("^DELETE$", message="Please type DELETE
to confirm"),
],
+ render_kw={"placeholder": "DELETE"},
description="Please type DELETE exactly to confirm deletion.",
)
submit = wtforms.SubmitField("Delete selected releases permanently")
diff --git a/atr/blueprints/admin/templates/delete-release.html
b/atr/blueprints/admin/templates/delete-release.html
index 8fe2e4a..b732642 100644
--- a/atr/blueprints/admin/templates/delete-release.html
+++ b/atr/blueprints/admin/templates/delete-release.html
@@ -42,7 +42,7 @@
<div class="mb-3">
{{ forms.label(form.confirm_delete) }}
- {{ forms.widget(form.confirm_delete, placeholder="DELETE") }}
+ {{ forms.widget(form.confirm_delete) }}
{{ forms.errors(form.confirm_delete) }}
{{ forms.description(form.confirm_delete) }}
</div>
diff --git a/atr/routes/keys.py b/atr/routes/keys.py
index 724290b..8091929 100644
--- a/atr/routes/keys.py
+++ b/atr/routes/keys.py
@@ -74,7 +74,11 @@ async def add(session: routes.CommitterSession) -> str:
class AddGpgKeyForm(util.QuartFormTyped):
public_key = wtforms.TextAreaField(
- "Public GPG key",
validators=[wtforms.validators.InputRequired("Public key is required")]
+ "Public GPG key",
+ validators=[wtforms.validators.InputRequired("Public key is
required")],
+ render_kw={"placeholder": "Paste your ASCII-armored public GPG key
here..."},
+ description="Your public key should be in ASCII-armored format,
starting with"
+ ' "-----BEGIN PGP PUBLIC KEY BLOCK-----"',
)
selected_committees = wtforms.SelectMultipleField(
"Associate key with committees",
@@ -83,6 +87,7 @@ async def add(session: routes.CommitterSession) -> str:
choices=committee_choices,
option_widget=wtforms.widgets.CheckboxInput(),
widget=wtforms.widgets.ListWidget(prefix_label=False),
+ description="Select the committees with which to associate your
key.",
)
submit = wtforms.SubmitField("Add GPG key")
diff --git a/atr/routes/resolve.py b/atr/routes/resolve.py
index 6c4ca62..8858b1f 100644
--- a/atr/routes/resolve.py
+++ b/atr/routes/resolve.py
@@ -47,9 +47,6 @@ class ResolveForm(util.QuartFormTyped):
"Resolution email body",
validators=[wtforms.validators.Optional()],
description="Enter optional comment for the resolution email (e.g.,
summary of issues if failed).",
- render_kw={
- "placeholder": "Enter optional comment for the resolution email
(e.g., summary of issues if failed)."
- },
)
submit = wtforms.SubmitField("Resolve vote")
diff --git a/atr/templates/check-selected-candidate-forms.html
b/atr/templates/check-selected-candidate-forms.html
index 320ef93..e5b0328 100644
--- a/atr/templates/check-selected-candidate-forms.html
+++ b/atr/templates/check-selected-candidate-forms.html
@@ -73,7 +73,7 @@
<div class="row">
{{ forms.label(resolve_form.resolution_body, col=True, classes="col-sm-3
text-sm-end") }}
<div class="col-sm-9">
- {{ forms.widget(resolve_form.resolution_body, rows="3",
placeholder=resolve_form.resolution_body.description) }}
+ {{ forms.widget(resolve_form.resolution_body, rows="3") }}
{{ forms.errors(resolve_form.resolution_body) }}
{{ forms.description(resolve_form.resolution_body) }}
</div>
diff --git a/atr/templates/finish-selected.html
b/atr/templates/finish-selected.html
index 88caf9f..21b62de 100644
--- a/atr/templates/finish-selected.html
+++ b/atr/templates/finish-selected.html
@@ -84,22 +84,14 @@
{{ form.hidden_tag() }}
<div class="mb-3">
- {{ form.source_file.label(class="form-label") }}
- {{ form.source_file(class="form-select form-select-sm
font-monospace") }}
- {% if form.source_file.errors %}
- <div class="invalid-feedback d-block">
- {% for error in form.source_file.errors %}{{ error }}{% endfor
%}
- </div>
- {% endif %}
+ {{ forms.label(form.source_file, classes="pb-2") }}
+ {{ 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">
- {{ form.target_directory.label(class="form-label") }}
- {{ form.target_directory(class="form-select form-select-sm
font-monospace") }}
- {% if form.target_directory.errors %}
- <div class="invalid-feedback d-block">
- {% for error in form.target_directory.errors %}{{ error }}{%
endfor %}
- </div>
- {% endif %}
+ {{ forms.label(form.target_directory, classes="pb-2") }}
+ {{ forms.widget(form.target_directory, classes="form-select
form-select-sm font-monospace") }}
+ {{ forms.errors(form.target_directory, classes="invalid-feedback
d-block") }}
</div>
{{ form.submit(class="btn btn-primary btn-sm") }}
</form>
diff --git a/atr/templates/keys-add.html b/atr/templates/keys-add.html
index 2bed0c2..2347fd5 100644
--- a/atr/templates/keys-add.html
+++ b/atr/templates/keys-add.html
@@ -27,31 +27,23 @@
<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.public_key.label }}</div>
+ {{ forms.label(form.public_key, mcol=True, classes="col-form-label")
}}
<div class="col-md-9">
- {{ form.public_key(class_='form-control font-monospace', rows=10,
placeholder='Paste your ASCII-armored public GPG key here...') }}
- <small class="form-text text-muted">
- Your public key should be in ASCII-armored format, starting with:
- <br />
- "-----BEGIN PGP PUBLIC KEY BLOCK-----"
- </small>
- {% if form.public_key.errors %}
- <div class="invalid-feedback d-block">
- {% for error in form.public_key.errors %}{{ error }}{% endfor
%}
- </div>
- {% endif %}
+ {{ forms.widget(form.public_key, classes="form-control
font-monospace", rows=10) }}
+ {{ forms.description(form.public_key) }}
+ {{ forms.errors(form.public_key, classes="invalid-feedback
d-block") }}
</div>
</div>
<div class="row mb-3 pb-3 border-bottom">
- <div class="col-md-2 text-md-end fw-medium pt-2">{{
form.selected_committees.label }}</div>
+ {{ forms.label(form.selected_committees, mcol=True) }}
<div class="col-md-9">
<div class="row">
{% for subfield in form.selected_committees %}
<div class="col-sm-12 col-md-6 col-lg-4">
<div class="form-check mb-2">
- {{ subfield(class_='form-check-input') }}
- {{ subfield.label(class_='form-check-label') }}
+ {{ forms.widget(subfield, classes="form-check-input") }}
+ {{ forms.label(subfield, classes="form-check-label") }}
</div>
</div>
{% endfor %}
@@ -61,12 +53,8 @@
id="toggleCommitteesBtn"
class="btn btn-sm btn-outline-secondary">Select
all</button>
</div>
- <small class="form-text text-muted">Select the committees with
which to associate your key.</small>
- {% if form.selected_committees.errors %}
- <div class="invalid-feedback d-block">
- {% for error in form.selected_committees.errors %}{{ error
}}{% endfor %}
- </div>
- {% endif %}
+ {{ forms.description(form.selected_committees) }}
+ {{ forms.errors(form.selected_committees,
classes="invalid-feedback d-block") }}
</div>
</div>
</div>
diff --git a/atr/templates/macros/forms.html b/atr/templates/macros/forms.html
index eadaf23..8ef5a33 100644
--- a/atr/templates/macros/forms.html
+++ b/atr/templates/macros/forms.html
@@ -1,20 +1,29 @@
-{% macro label(field, classes="form-label", col=False, high=False) %}
+{% macro label(field, classes=None, col=False, high=False, mcol=False) %}
{% if field.label %}
- {% set final_classes = classes %}
- {% if col or high %}
- {% set base_col_classes = "col-sm-3 text-sm-end" %}
- {% if col and not high %}
- {% set base_col_classes = "col-sm-3 col-form-label text-sm-end" %}
- {% endif %}
- {% if final_classes and final_classes != "" and final_classes !=
"form-label" %}
- {% set final_classes = base_col_classes + " " + final_classes %}
- {% elif final_classes == "form-label" and base_col_classes != "" %}
- {% set final_classes = base_col_classes %}
- {% else %}
- {% set final_classes = base_col_classes %}
- {% endif %}
+ {% set base_structural_classes = "" %}
+ {% if col %}
+ {% set base_structural_classes = "col-sm-3 col-form-label text-sm-end" %}
+ {% elif high %}
+ {% set base_structural_classes = "col-sm-3 text-sm-end" %}
+ {% elif mcol %}
+ {% set base_structural_classes = "col-md-2 text-md-end" %}
+ {% endif %}
+ {% set final_class_list = [] %}
+ {% if base_structural_classes %}
+ {% set _ = final_class_list.append(base_structural_classes) %}
+ {% endif %}
+ {% if classes %}
+ {% set _ = final_class_list.append(classes) %}
+ {% endif %}
+ {% if not final_class_list %}
+ {% set _ = final_class_list.append("form-label") %}
+ {% endif %}
+ {% set final_classes_str = final_class_list | join(' ') | trim %}
+ {% if final_classes_str %}
+ {{ field.label(class=final_classes_str) }}
+ {% else %}
+ {{ field.label() }}
{% endif %}
- {{ field.label(class=final_classes) }}
{% endif %}
{% endmacro %}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]