aurweb/templates/pkgbase/request.html
Kevin Morris 1c031638c6
feat(FastAPI): add /pkgbase/{name}/request (post)
This change implements the FastAPI version of the
/pkgbase/{name}/request form's action.

Changes from PHP:

- Additional errors are now displayed for the **merge_into** field,
  which are only displayed when the Merge type is selected.
    - If the **merge_into** field is empty, a new error is displayed:
      'The "Merge into" field must not be empty.'
    - If the **merge_into** field is given the name of a package base
      which does not exist, a new error is displayed:
      "The package base you want to merge into does not exist."
    - If the **merge_into** field is given the name of the package
      base that a request is being created for, a new error is
      displayed: "You cannot merge a package base into itself."
- When an error is encountered, users are now brought back to
  the request form which they submitted and an error is displayed
  at the top of the page.
- If an invalid type is provided, users are returned to a BAD_REQUEST
  status rendering of the request form.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-02 22:46:49 -07:00

97 lines
3.8 KiB
HTML

{% extends "partials/layout.html" %}
{% block pageContent %}
{% if errors %}
<ul class="errorlist">
{% for error in errors %}
<li>{{ error | tr }}</li>
{% endfor %}
</ul>
{% endif %}
<div class="box">
<h2>{{ "Submit Request" | tr }}: {{ pkgbase.Name }}</h2>
<p>
{{ "Use this form to file a request against package base "
"%s%s%s which includes the following packages:"
| tr | format("<strong>", pkgbase.Name, "</strong>") | safe }}
</p>
<ul>
{% for package in pkgbase.packages %}
<li>{{ package.Name }}</li>
{% endfor %}
</ul>
{# Request form #}
<form id="request-form" action="/pkgbase/{{ pkgbase.Name }}/request"
method="post">
<fieldset>
<p>
<label for="id_type">{{ "Request type" | tr }}:</label>
<select id="id_type" name="type">
<option value="deletion">{{ "Deletion" | tr }}</option>
<option value="merge">{{ "Merge" | tr }}</option>
<option value="orphan">{{ "Orphan" | tr }}</option>
</select>
</p>
{# Javascript included for HTML-changing triggers depending
on the selected type (above). #}
<script type="text/javascript"
src="/static/js/typeahead-pkgbase-request.js"></script>
<p id="merge_section" style="display: none">
<label for="id_merge_into">{{ "Merge into" | tr }}:</label>
<input id="id_merge_into" type="text" name="merge_into"
autocomplete="off" />
</p>
<p>
<label for="id_comments">{{ "Comments" | tr }}:</label>
<textarea id="id_comments" name="comments"
rows="5" cols="50"></textarea>
</p>
<p id="deletion_hint">
{{
"By submitting a deletion request, you ask a Trusted "
"User to delete the package base. This type of "
"request should be used for duplicates, software "
"abandoned by upstream, as well as illegal and "
"irreparably broken packages." | tr
}}
</p>
<p id="merge_hint" style="display: none">
{{
"By submitting a merge request, you ask a Trusted "
"User to delete the package base and transfer its "
"votes and comments to another package base. "
"Merging a package does not affect the corresponding "
"Git repositories. Make sure you update the Git "
"history of the target package yourself." | tr
}}
</p>
<p id="orphan_hint" style="display: none">
{{
"By submitting an orphan request, you ask a Trusted "
"User to disown the package base. Please only do this "
"if the package needs maintainer action, the "
"maintainer is MIA and you already tried to contact "
"the maintainer previously." | tr
}}
</p>
<p>
<button class="button" type="submit">
{{ "Submit Request" | tr }}
</button>
</p>
</fieldset>
</form>
</div>
{% endblock %}