You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2025/04/10 13:33:37 UTC

(tooling-trusted-release) branch main updated: Move the form to create a new candidate draft to the top of its page

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 b314309  Move the form to create a new candidate draft to the top of its page
b314309 is described below

commit b314309f84f361a54a3ca1570a82f7aa549e0760
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Thu Apr 10 14:33:15 2025 +0100

    Move the form to create a new candidate draft to the top of its page
---
 atr/routes/projects.py       |   5 ++
 atr/templates/draft-add.html | 147 +++++++++++++++++++++----------------------
 2 files changed, 76 insertions(+), 76 deletions(-)

diff --git a/atr/routes/projects.py b/atr/routes/projects.py
index 169ee68..71db8e0 100644
--- a/atr/routes/projects.py
+++ b/atr/routes/projects.py
@@ -31,6 +31,11 @@ import atr.user as user
 import atr.util as util
 
 
+@routes.committer("/project/add", methods=["GET", "POST"])
+async def add(session: routes.CommitterSession) -> response.Response | str:
+    raise NotImplementedError("Not implemented")
+
+
 @routes.public("/projects")
 async def directory() -> str:
     """Main project directory page."""
diff --git a/atr/templates/draft-add.html b/atr/templates/draft-add.html
index f9cc514..9dd6358 100644
--- a/atr/templates/draft-add.html
+++ b/atr/templates/draft-add.html
@@ -19,70 +19,7 @@
     <li>A candidate draft is only editable until submitted for voting</li>
   </ul>
 
-  <div class="row row-cols-1 row-cols-md-2 g-4 mb-5">
-    {% for project in projects %}
-      {% set candidate_drafts = project.candidate_drafts %}
-
-      {# Show card for creating a new release if allowed #}
-      {% if asf_id in project.committee.committee_members %}
-        <div class="col">
-          <div class="card h-100">
-            <div class="card-body position-relative">
-              <div class="position-absolute top-0 end-0 m-2">
-                <span class="badge bg-primary">Potential</span>
-              </div>
-              <h5 class="card-title">{{ project.display_name }}</h5>
-              {% if project.committee %}
-                <h6 class="card-subtitle mb-2 text-muted">{{ project.committee.display_name }}</h6>
-              {% endif %}
-              <p class="card-text">
-                {% if candidate_drafts|length > 0 %}
-                  This project already has {{ candidate_drafts|length }} candidate draft{{ "s" if candidate_drafts|length > 1 else "" }},
-                  but to create another one, use the command below.
-                {% else %}
-                  This project does not have a candidate draft.
-                  To create one and add files, use the command below.
-                {% endif %}
-              </p>
-            </div>
-            <div class="card-footer bg-light border-1 pt-4 pb-4 position-relative">
-              <button class="btn btn-sm btn-outline-secondary atr-copy-btn fs-6 position-absolute top-0 end-0 m-2"
-                      data-clipboard-target="#cmd-newdraft-{{ project.name|slugify }}">
-                <i class="bi bi-clipboard"></i> Copy
-              </button>
-              <pre class="small mb-0" id="cmd-newdraft-{{ project.name|slugify }}">rsync -av -e 'ssh -p 2222' your/files/ \
-    {{ asf_id }}@{{ server_domain }}:/{{ project.name }}/VERSION/</pre>
-            </div>
-          </div>
-        </div>
-      {% else %}
-        <div class="col">
-          <div class="card h-100">
-            <div class="card-body position-relative">
-              <div class="position-absolute top-0 end-0 m-2">
-                <span class="badge bg-secondary">Ask</span>
-              </div>
-              <h5 class="card-title">{{ project.display_name }}</h5>
-              {% if project.committee %}
-                <h6 class="card-subtitle mb-2 text-muted">{{ project.committee.display_name }}</h6>
-              {% endif %}
-              <p class="card-text">
-                {% if candidate_drafts|length > 0 %}
-                  This project already has {{ candidate_drafts|length }} candidate draft{{ "s" if candidate_drafts|length > 1 else "" }},
-                  but to create another one, use the command below.
-                {% else %}
-                  This project does not have a candidate draft.
-                  To create one, you must be a member of the PMC.
-                {% endif %}
-              </p>
-            </div>
-          </div>
-        </div>
-      {% endif %}
-    {% endfor %}
-  </div>
-
-  <p>Or use the following form to create an empty release candidate draft.</p>
+  <h2>Create an empty candidate draft for an existing project</h2>
 
   <form method="post"
         enctype="multipart/form-data"
@@ -98,18 +35,9 @@
           {% if not user_projects %}
             <p class="text-danger">You must be a participant of a project to submit a release candidate.</p>
           {% endif %}
-        </div>
-      </div>
-
-      <div class="mb-3 pb-3 row border-bottom">
-        <label for="{{ form.project_label_suffix.id }}"
-               class="col-sm-3 col-form-label text-sm-end">Project label:</label>
-        <div class="col-sm-8 d-flex align-items-center">
-          <span id="project-label-prefix" class="me-1 fw-bold"></span>
-          {{ form.project_label_suffix(class_="form-control w-auto flex-grow-1") }}
-          {% if form.project_label_suffix.errors %}
-            <div class="invalid-feedback d-block mt-1 ms-1">{{ form.project_label_suffix.errors[0] }}</div>
-          {% endif %}
+          <p class="text-muted">
+            If your project is not listed above, you may need to <a href="{{ as_url(routes.projects.add) }}">add it first</a>.
+          </p>
         </div>
       </div>
 
@@ -126,6 +54,73 @@
           <div class="col-sm-9 offset-sm-3">{{ form.submit(class_="btn btn-primary mt-3") }}</div>
         </div>
       </form>
+
+      <h2>Create or update a candidate draft using rsync</h2>
+
+      <p>Or use one of the commands below to create or update a candidate draft.</p>
+
+      <div class="row row-cols-1 row-cols-md-2 g-4 mb-5">
+        {% for project in projects %}
+          {% set candidate_drafts = project.candidate_drafts %}
+
+          {# Show card for creating a new release if allowed #}
+          {% if asf_id in project.committee.committee_members %}
+            <div class="col">
+              <div class="card h-100">
+                <div class="card-body position-relative">
+                  <div class="position-absolute top-0 end-0 m-2">
+                    <span class="badge bg-primary">Potential</span>
+                  </div>
+                  <h5 class="card-title">{{ project.display_name }}</h5>
+                  {% if project.committee %}
+                    <h6 class="card-subtitle mb-2 text-muted">{{ project.committee.display_name }}</h6>
+                  {% endif %}
+                  <p class="card-text">
+                    {% if candidate_drafts|length > 0 %}
+                      This project already has {{ candidate_drafts|length }} candidate draft{{ "s" if candidate_drafts|length > 1 else "" }},
+                      but to create another one, use the command below.
+                    {% else %}
+                      This project does not have a candidate draft.
+                      To create one and add files, use the command below.
+                    {% endif %}
+                  </p>
+                </div>
+                <div class="card-footer bg-light border-1 pt-4 pb-4 position-relative">
+                  <button class="btn btn-sm btn-outline-secondary atr-copy-btn fs-6 position-absolute top-0 end-0 m-2"
+                          data-clipboard-target="#cmd-newdraft-{{ project.name|slugify }}">
+                    <i class="bi bi-clipboard"></i> Copy
+                  </button>
+                  <pre class="small mb-0" id="cmd-newdraft-{{ project.name|slugify }}">rsync -av -e 'ssh -p 2222' your/files/ \
+    {{ asf_id }}@{{ server_domain }}:/{{ project.name }}/VERSION/</pre>
+                </div>
+              </div>
+            </div>
+          {% else %}
+            <div class="col">
+              <div class="card h-100">
+                <div class="card-body position-relative">
+                  <div class="position-absolute top-0 end-0 m-2">
+                    <span class="badge bg-secondary">Ask</span>
+                  </div>
+                  <h5 class="card-title">{{ project.display_name }}</h5>
+                  {% if project.committee %}
+                    <h6 class="card-subtitle mb-2 text-muted">{{ project.committee.display_name }}</h6>
+                  {% endif %}
+                  <p class="card-text">
+                    {% if candidate_drafts|length > 0 %}
+                      This project already has {{ candidate_drafts|length }} candidate draft{{ "s" if candidate_drafts|length > 1 else "" }},
+                      but to create another one, use the command below.
+                    {% else %}
+                      This project does not have a candidate draft.
+                      To create one, you must be a member of the PMC.
+                    {% endif %}
+                  </p>
+                </div>
+              </div>
+            </div>
+          {% endif %}
+        {% endfor %}
+      </div>
     {% endblock content %}
 
     {% block javascripts %}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org