mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Use a macro for form tags
This will stop us repeatedly forgetting to add `novalidate` and `autocomplete='off'` to our forms (which is how most of them are set up). It uses sensible defaults, based on how we most-commonly configure forms: - most of our forms are `post`ed (but this can be overridden) - `autocomplete` should only be enabled where it makes sense, otherwise it’s more annoying than useful (but this can be overriden) - we should never be using HTML5 form validation because our own error styles and messages are better
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
{% from "components/big-number.html" import big_number_simple %}
|
||||
{% from "components/message-count-label.html" import message_count_label %}
|
||||
{% from "components/status-box.html" import status_box %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
|
||||
{% block per_page_title %}
|
||||
Platform admin
|
||||
@@ -15,12 +16,12 @@
|
||||
</h1>
|
||||
<details {% if form.errors %}open{% endif %}>
|
||||
<summary>Apply filters</summary>
|
||||
<form autocomplete="off" method="get">
|
||||
{% call form_wrapper(method="get") %}
|
||||
{{ textbox(form.start_date, hint="Enter start date in format YYYY-MM-DD") }}
|
||||
{{ textbox(form.end_date, hint="Enter end date in format YYYY-MM-DD") }}
|
||||
</br>
|
||||
<button type="submit" class="button">Filter</button>
|
||||
</form>
|
||||
{% endcall %}
|
||||
</details>
|
||||
|
||||
<div class="grid-row bottom-gutter">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends "views/platform-admin/_base_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
|
||||
{% block per_page_title %}
|
||||
{{ page_title|capitalize }}
|
||||
@@ -11,10 +12,10 @@
|
||||
<div class="grid-row">
|
||||
<div class="column-two-thirds">
|
||||
<h1 class="heading-large">Submit returned letters</h1>
|
||||
<form method="post" novalidate>
|
||||
{% call form_wrapper() %}
|
||||
{{ textbox(form.references, width='1-1', rows=8) }}
|
||||
{{ page_footer("Submit") }}
|
||||
</form>
|
||||
{% endcall %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
{% from "components/big-number.html" import big_number, big_number_with_status %}
|
||||
{% from "components/message-count-label.html" import message_count_label %}
|
||||
{% from "components/table.html" import mapping_table, field, stats_fields, row_group, row, right_aligned_field_heading, hidden_field_heading, text_field %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
|
||||
{% macro stats_fields(channel, data) -%}
|
||||
|
||||
@@ -102,13 +103,13 @@
|
||||
|
||||
<details>
|
||||
<summary>Apply filters</summary>
|
||||
<form autocomplete="off" method="get">
|
||||
{% call form_wrapper(method="get") %}
|
||||
{{ textbox(form.start_date, hint="Enter start date in format YYYY-MM-DD") }}
|
||||
{{ textbox(form.end_date, hint="Enter end date in format YYYY-MM-DD") }}
|
||||
{{ checkbox(form.include_from_test_key) }}
|
||||
</br>
|
||||
<button type="submit" class="button">Filter</button>
|
||||
</form>
|
||||
{% endcall %}
|
||||
</details>
|
||||
|
||||
{% include "views/platform-admin/_global_stats.html" %}
|
||||
|
||||
Reference in New Issue
Block a user