You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by tn...@apache.org on 2025/03/12 19:57:31 UTC

(tooling-trusted-release) branch main updated: apply bootstrap to vote policy form

This is an automated email from the ASF dual-hosted git repository.

tn 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 cde6f9a  apply bootstrap to vote policy form
cde6f9a is described below

commit cde6f9a9d437a1f9a47620ee18437e9250e91b70
Author: Thomas Neidhart <tn...@apache.org>
AuthorDate: Wed Mar 12 20:56:44 2025 +0100

    apply bootstrap to vote policy form
---
 atr/routes/project.py                |   2 +-
 atr/templates/vote-policy-add.html   |  94 +++++++++++++++
 atr/templates/voting-policy-add.html | 221 -----------------------------------
 3 files changed, 95 insertions(+), 222 deletions(-)

diff --git a/atr/routes/project.py b/atr/routes/project.py
index da22cb1..784fc4d 100644
--- a/atr/routes/project.py
+++ b/atr/routes/project.py
@@ -88,7 +88,7 @@ async def root_project_voting_policy_add(project_name: str) -> response.Response
 
     # For GET requests, show the form
     return await quart.render_template(
-        "voting-policy-add.html",
+        "vote-policy-add.html",
         asf_id=web_session.uid,
         project=pmc,
         form=form,
diff --git a/atr/templates/vote-policy-add.html b/atr/templates/vote-policy-add.html
new file mode 100644
index 0000000..aba00cb
--- /dev/null
+++ b/atr/templates/vote-policy-add.html
@@ -0,0 +1,94 @@
+{% extends "layouts/base.html" %}
+
+{% block title %}
+  Edit a voting policy ~ ATR
+{% endblock title %}
+
+{% block description %}
+  Create a new vote policy.
+{% endblock description %}
+
+{% block theme_css %}
+  <link rel="stylesheet"
+        href="{{ url_for('static', filename='css/atr-small.css') }}" />
+{% endblock theme_css %}
+
+{% block stylesheets %}
+  {{ super() }}
+{% endblock stylesheets %}
+
+{% block content %}
+  <h1>Add vote policy</h1>
+  <p>
+    Welcome, <strong>{{ asf_id }}</strong>!
+    Use this form to create a vote policy candidate for your project.
+  </p>
+
+  <form method="post"
+        enctype="multipart/form-data"
+        class="striking py-4 px-5">
+    <input type="hidden" name="form_type" value="single" />
+
+    <div class="mb-3 pb-3 row border-bottom">
+      <label for="project_name_text" class="col-sm-3 col-form-label text-sm-end">Project:</label>
+      <div class="col-sm-8">
+        <p id="project_name_text" class="form-control-plaintext">{{ project.display_name }}</p>
+      </div>
+    </div>
+
+    <div class="mb-3 pb-3 row border-bottom">
+      <label for="{{ form.mailto_addresses.id }}"
+             class="col-sm-3 col-form-label text-sm-end">{{ form.mailto_addresses.label.text }}</label>
+      <div class="col-sm-8">
+        <div>{{ form.mailto_addresses(size=30, class_="form-control") }}</div>
+        {% if form.mailto_addresses.errors -%}
+          <span class="error-message">{{ form.mailto_addresses.errors[0] }}</span>
+        {%- endif %}
+      </div>
+    </div>
+
+    <div class="mb-3 pb-3 row border-bottom">
+      <label for="{{ form.manual_vote.id }}"
+             class="col-sm-3 col-form-label text-sm-end">{{ form.manual_vote.label.text }}</label>
+      <div class="col-sm-8">
+        {{ form.manual_vote(class_="form-check-input") }}
+        <label class="form-check-label">Manual</label>
+        <br />
+        <span id="manual_vote-help" class="form-text text-muted">If this is set then the vote will be completely manual and following policy is ignored.</span>
+      </div>
+    </div>
+
+    <div class="mb-3 pb-3 row border-bottom">
+      <label for="{{ form.min_hours.id }}"
+             class="col-sm-3 col-form-label text-sm-end">{{ form.min_hours.label.text }}</label>
+      <div class="col-sm-8">
+        {{ form.min_hours(class_="form-control") }}
+        <span id="min_hours-help" class="form-text text-muted">The minimum time to run the vote. If set to 0 then wait until 3 +1 votes and more +1 than -1.</span>
+      </div>
+    </div>
+
+    <div class="mb-3 pb-3 row border-bottom">
+      <label for="{{ form.release_checklist.id }}"
+             class="col-sm-3 col-form-label text-sm-end">{{ form.release_checklist.label.text }}</label>
+      <div class="col-sm-8">
+        {{ form.release_checklist(rows=10, style='resize: vertical', class_="form-control") }}
+        <span id="release_checklist-help" class="form-text text-muted">Markdown text describing how to test release candidates.</span>
+      </div>
+    </div>
+
+    <div class="mb-3 pb-3 row border-bottom">
+      <label for="{{ form.pause_for_rm.id }}"
+             class="col-sm-3 col-form-label text-sm-end">{{ form.pause_for_rm.label.text }}</label>
+      <div class="col-sm-8">
+        {{ form.pause_for_rm(class_="form-check-input") }}
+        <label class="form-check-label">Enabled</label>
+        <br />
+        <span id="pause_for_rm-help" class="form-text text-muted">If enabled, RM can confirm manually if the vote has passed.</span>
+      </div>
+    </div>
+
+    <div class="row">
+      <div class="col-sm-9 offset-sm-3">{{ form.submit(class_="btn btn-primary mt-2") }}</div>
+    </div>
+  </form>
+{% endblock content %}
diff --git a/atr/templates/voting-policy-add.html b/atr/templates/voting-policy-add.html
deleted file mode 100644
index 9e9ed97..0000000
--- a/atr/templates/voting-policy-add.html
+++ /dev/null
@@ -1,221 +0,0 @@
-{% extends "layouts/base.html" %}
-
-{% block title %}
-  Edit a voting policy ~ ATR
-{% endblock title %}
-
-{% block description %}
-  Add a package to an existing release.
-{% endblock description %}
-
-{% block stylesheets %}
-  {{ super() }}
-  <style>
-      .form-table {
-          width: 100%;
-      }
-
-      .form-table th {
-          width: 200px;
-          text-align: right;
-          padding-right: 1rem;
-          vertical-align: top;
-          font-weight: 500;
-      }
-
-      .form-table td {
-          vertical-align: top;
-      }
-
-      .form-table label {
-          border-bottom: none;
-          padding-bottom: 0;
-      }
-
-      select,
-      input[type="file"] {
-          display: block;
-          margin-bottom: 0.5rem;
-      }
-
-      .help-text {
-          color: #666;
-          font-size: 0.9em;
-          display: block;
-          margin-top: 0.25rem;
-      }
-
-      .error-message {
-          color: #dc3545;
-          margin-top: 0.25rem;
-      }
-
-      button {
-          margin-top: 1rem;
-      }
-
-      button:disabled {
-          opacity: 0.5;
-          cursor: not-allowed;
-      }
-
-      .radio-group {
-          margin-bottom: 0.5rem;
-      }
-
-      .radio-group div {
-          margin: 0.5rem 0;
-      }
-
-      .radio-group label {
-          margin-left: 0.5rem;
-          cursor: pointer;
-      }
-
-      .radio-group input[type="radio"] {
-          cursor: pointer;
-      }
-
-      .checkbox-group {
-          margin-bottom: 0.5rem;
-      }
-
-      .checkbox-group div {
-          margin: 0.5rem 0;
-      }
-
-      .checkbox-group label {
-          margin-left: 0.5rem;
-          cursor: pointer;
-      }
-
-      .checkbox-group input[type="checkbox"] {
-          cursor: pointer;
-      }
-
-      .form-separator {
-          margin: 2rem 0;
-          border-top: 1px solid #ddd;
-          text-align: center;
-          position: relative;
-      }
-
-      .form-separator span {
-          background: #fff;
-          padding: 0 1rem;
-          color: #666;
-          position: relative;
-          top: -0.75rem;
-      }
-
-      input[type="url"],
-      input[type="number"] {
-          width: 100%;
-          max-width: 600px;
-          padding: 0.375rem;
-          border: 1px solid #ced4da;
-          border-radius: 0.25rem;
-      }
-
-      input[type="number"] {
-          width: 100px;
-      }
-
-      input[type="submit"] {
-          margin-top: 1rem;
-          padding: 0.5rem 1rem;
-          background: #004477;
-          color: white;
-          border: none;
-          border-radius: 4px;
-          cursor: pointer;
-          font-weight: 500;
-      }
-  </style>
-{% endblock stylesheets %}
-
-{% block content %}
-  <h1>Add vote policy</h1>
-  <p class="intro">
-    Welcome, <strong>{{ asf_id }}</strong>!
-  </p>
-
-  <form method="post" enctype="multipart/form-data" class="striking">
-    <input type="hidden" name="form_type" value="single" />
-
-    {{ form.hidden_tag() }}
-    {% for field, errors in form.errors.items() %}
-      <div class="alert alert-error">{{ form[field].label }}: {{ ', '.join(errors) }}</div>
-    {% endfor %}
-
-    <table class="form-table">
-      <tbody>
-        <tr>
-          <th>
-            <label>Project:</label>
-          </th>
-          <td>
-            <p id="project_name_text">{{ project.display_name }}</p>
-          </td>
-        </tr>
-
-        <tr>
-          <th>{{ form.mailto_addresses.label }}</th>
-          <td>
-            <div>{{ form.mailto_addresses(size=30) }}</div>
-            {% if form.mailto_addresses.errors -%}
-              <span class="error-message">{{ form.mailto_addresses.errors[0] }}</span>
-            {%- endif %}
-          </td>
-        </tr>
-
-        <tr>
-          <th>{{ form.manual_vote.label }}</th>
-          <td>
-            <div class="checkbox-group">
-              <div>
-                {{ form.manual_vote() }}
-                <label>Manual</label>
-                <span id="manual_vote-help" class="help-text">If this is set then the vote will be completely manual and following policy is ignored.</span>
-              </div>
-            </div>
-          </td>
-        </tr>
-
-        <tr>
-          <th>{{ form.min_hours.label }}</th>
-          <td>
-            {{ form.min_hours() }}
-            <span id="min_hours-help" class="help-text">The minimum time to run the vote. If set to 0 then wait until 3 +1 votes and more +1 than -1.</span>
-          </td>
-        </tr>
-
-        <tr>
-          <th>{{ form.release_checklist.label }}</th>
-          <td>
-            {{ form.release_checklist(rows=10, style='resize: vertical') }}
-            <span id="release_checklist-help" class="help-text">Markdown text describing how to test release candidates.</span>
-          </td>
-        </tr>
-
-        <tr>
-          <th>{{ form.pause_for_rm.label }}</th>
-          <td>
-            <div class="checkbox-group">
-              <div>
-                {{ form.pause_for_rm() }}
-                <label>Enabled</label>
-                <span id="pause_for_rm-help" class="help-text">If enabled, RM can confirm manually if the vote has passed.</span>
-              </div>
-            </div>
-          </td>
-        </tr>
-
-        <tr>
-          <td></td>
-          <td>{{ form.submit() }}</td>
-        </tr>
-      </tbody>
-    </table>
-  </form>
-{% endblock content %}


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