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 2e26f53 Warn the user if they use an uncapitalised word in a full
project name suffix
2e26f53 is described below
commit 2e26f534fe6062c43c4462597967c721c1714d75
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Apr 10 16:21:12 2025 +0100
Warn the user if they use an uncapitalised word in a full project name
suffix
---
atr/routes/projects.py | 2 +-
atr/templates/includes/sidebar.html | 4 ++++
atr/templates/project-add.html | 26 ++++++++++++++++++++++++--
3 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/atr/routes/projects.py b/atr/routes/projects.py
index 3f40f46..e9032c7 100644
--- a/atr/routes/projects.py
+++ b/atr/routes/projects.py
@@ -57,7 +57,7 @@ async def add(session: routes.CommitterSession) ->
response.Response | str:
wtforms.validators.Length(min=1, max=100),
],
)
- submit = wtforms.SubmitField("Create derived project")
+ submit = wtforms.SubmitField("Add derived project")
form = await AddForm.create_form()
diff --git a/atr/templates/includes/sidebar.html
b/atr/templates/includes/sidebar.html
index a581f08..34ef7ca 100644
--- a/atr/templates/includes/sidebar.html
+++ b/atr/templates/includes/sidebar.html
@@ -96,6 +96,10 @@
<i class="fa-solid fa-diagram-project"></i>
<a href="{{ as_url(routes.projects.directory) }}">Projects</a>
</li>
+ <li>
+ <i class="fa-solid fa-diagram-project"></i>
+ <a href="{{ as_url(routes.projects.add) }}">Add project</a>
+ </li>
</ul>
{% if is_admin_fn(current_user.uid) %}
diff --git a/atr/templates/project-add.html b/atr/templates/project-add.html
index 0793c0b..b5a931c 100644
--- a/atr/templates/project-add.html
+++ b/atr/templates/project-add.html
@@ -31,7 +31,11 @@
{{ form.derived_project_name(class_="form-control") }}
{% if form.derived_project_name.errors -%}
<span class="text-danger small">{{
form.derived_project_name.errors[0] }}</span>{%- endif %}
- <p class="text-muted small mt-1">The desired suffix for the full
project name.</p>
+ <p class="text-muted mt-1">The desired suffix for the full project
name.</p>
+ <p id="capitalisation-warning" class="text-danger small mt-1
d-none">
+ <span class="fa-solid fa-triangle-exclamation"></span>
+ Warning: Ensure all words in the derived name start with a
capital for proper display.
+ </p>
</div>
</div>
@@ -71,8 +75,9 @@
const derivedNameInput = document.getElementById("{{
form.derived_project_name.id }}");
const newNameDisplay =
document.getElementById("new-project-name-display");
const newLabelDisplay =
document.getElementById("new-project-label-display");
+ const capitalisationWarning =
document.getElementById("capitalisation-warning");
- if (!projectSelect || !derivedNameInput || !newNameDisplay ||
!newLabelDisplay) return;
+ if (!projectSelect || !derivedNameInput || !newNameDisplay ||
!newLabelDisplay || !capitalisationWarning) return;
function generateSlug(text) {
return text.toLowerCase().replace(/\s+/g,
"-").replace(/[^a-z0-9-]/g, "");
@@ -84,6 +89,23 @@
const baseFullName = selectedOption ? selectedOption.text :
"";
const derivedNameValue = derivedNameInput.value.trim();
+ let hasCapitalisationIssue = false;
+ if (derivedNameValue) {
+ const words = derivedNameValue.split(/\s+/);
+ for (const word of words) {
+ if (word.length > 0 && !/^[A-Z]/.test(word)) {
+ hasCapitalisationIssue = true;
+ break;
+ }
+ }
+ }
+
+ if (hasCapitalisationIssue) {
+ capitalisationWarning.classList.remove("d-none");
+ } else {
+ capitalisationWarning.classList.add("d-none");
+ }
+
let newFullName = baseFullName;
if (derivedNameValue) {
const match = baseFullName.match(/^(.*?)\s*(\(.*\))?$/);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]