From c98283695630d74e828cda26551f74667d50047b Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Sat, 21 Dec 2024 19:53:14 +0100 Subject: [PATCH] Rethink how form.media.js is loaded. --- .../templates/determinations/base_determination_form.html | 1 + hypha/apply/funds/templates/funds/application_base.html | 2 +- .../funds/templates/funds/applicationsubmission_form.html | 2 +- .../funds/templates/funds/includes/delegated_form_base.html | 6 ++---- .../funds/templates/funds/includes/dialog_form_base.html | 6 ++---- .../funds/includes/translate_application_form.html | 1 + .../templates/funds/includes/update_reviewer_form.html | 1 + .../templates/application_projects/invoice_form.html | 5 ++++- .../modals/report_frequency_config.html | 2 +- .../templates/application_projects/project_form.html | 5 ++++- .../templates/application_projects/report_form.html | 2 +- hypha/apply/review/templates/review/review_edit_form.html | 2 +- hypha/apply/review/templates/review/review_form.html | 2 +- hypha/apply/users/templates/wagtailusers/users/edit.html | 2 ++ hypha/templates/base.html | 2 +- 15 files changed, 24 insertions(+), 17 deletions(-) diff --git a/hypha/apply/determinations/templates/determinations/base_determination_form.html b/hypha/apply/determinations/templates/determinations/base_determination_form.html index 9c30976016..95b811cc3d 100644 --- a/hypha/apply/determinations/templates/determinations/base_determination_form.html +++ b/hypha/apply/determinations/templates/determinations/base_determination_form.html @@ -86,6 +86,7 @@

{{ value }}

{% endblock %} {% block extra_js %} + {{ form.media.js }} {{ field_blocks_ids|json_script:"block-ids" }} {% endblock %} diff --git a/hypha/apply/funds/templates/funds/application_base.html b/hypha/apply/funds/templates/funds/application_base.html index 5f357c8d4f..3459ef23db 100644 --- a/hypha/apply/funds/templates/funds/application_base.html +++ b/hypha/apply/funds/templates/funds/application_base.html @@ -40,7 +40,6 @@

{% blocktrans %}Sorry this {{ page|verbose_name }} is not accepting applicat {% endif %}
{% csrf_token %} - {% for field in form %} {% if field.field %} {% if field.field.multi_input_field %} @@ -86,6 +85,7 @@

{% blocktrans %}Sorry this {{ page|verbose_name }} is not accepting applicat {% endblock %} {% block extra_js %} + {{ form.media.js }} diff --git a/hypha/apply/funds/templates/funds/applicationsubmission_form.html b/hypha/apply/funds/templates/funds/applicationsubmission_form.html index ed5b5d7a21..645d4940b7 100644 --- a/hypha/apply/funds/templates/funds/applicationsubmission_form.html +++ b/hypha/apply/funds/templates/funds/applicationsubmission_form.html @@ -14,7 +14,6 @@
{% csrf_token %} - {% for field in form %} {% if field.field %} {% if field.field.multi_input_field %} @@ -45,6 +44,7 @@ {% endblock %} {% block extra_js %} + {{ form.media.js }} diff --git a/hypha/apply/funds/templates/funds/includes/delegated_form_base.html b/hypha/apply/funds/templates/funds/includes/delegated_form_base.html index 881b0a404d..55a147953f 100644 --- a/hypha/apply/funds/templates/funds/includes/delegated_form_base.html +++ b/hypha/apply/funds/templates/funds/includes/delegated_form_base.html @@ -1,4 +1,4 @@ -{% load i18n static %} +{% load i18n %} {% csrf_token %} - + {{ form.media.js }} {% for hidden in form.hidden_fields %} {{ hidden }} {% endfor %} @@ -42,5 +42,3 @@
- - diff --git a/hypha/apply/funds/templates/funds/includes/dialog_form_base.html b/hypha/apply/funds/templates/funds/includes/dialog_form_base.html index b5d073d373..a4b496bb39 100644 --- a/hypha/apply/funds/templates/funds/includes/dialog_form_base.html +++ b/hypha/apply/funds/templates/funds/includes/dialog_form_base.html @@ -1,4 +1,4 @@ -{% load i18n static %} +{% load i18n %}
{% csrf_token %} - + {{ form.media.js }} {% for hidden in form.hidden_fields %} {{ hidden }} {% endfor %} @@ -40,5 +40,3 @@ >{% trans "Cancel" %}
- - diff --git a/hypha/apply/funds/templates/funds/includes/translate_application_form.html b/hypha/apply/funds/templates/funds/includes/translate_application_form.html index f7552c8180..b5c9d7cb2f 100644 --- a/hypha/apply/funds/templates/funds/includes/translate_application_form.html +++ b/hypha/apply/funds/templates/funds/includes/translate_application_form.html @@ -8,6 +8,7 @@ hx-post="{{ request.path }}" > {% csrf_token %} + {{ form.media.js }} {% for hidden in form.hidden_fields %} {{ hidden }} {% endfor %} diff --git a/hypha/apply/funds/templates/funds/includes/update_reviewer_form.html b/hypha/apply/funds/templates/funds/includes/update_reviewer_form.html index ad9536e521..b7e3ea256c 100644 --- a/hypha/apply/funds/templates/funds/includes/update_reviewer_form.html +++ b/hypha/apply/funds/templates/funds/includes/update_reviewer_form.html @@ -9,6 +9,7 @@ hx-post="{{ request.path }}" > {% csrf_token %} + {{ form.media.js }} {% for hidden in form.hidden_fields %} {{ hidden }} {% endfor %} diff --git a/hypha/apply/projects/templates/application_projects/invoice_form.html b/hypha/apply/projects/templates/application_projects/invoice_form.html index 392d083de6..7e9f299d45 100644 --- a/hypha/apply/projects/templates/application_projects/invoice_form.html +++ b/hypha/apply/projects/templates/application_projects/invoice_form.html @@ -33,7 +33,6 @@
{% csrf_token %} - {% for field in form %} {% if field.field %} {% include "forms/includes/field.html" %} @@ -48,3 +47,7 @@
{% endblock %} + +{% block extra_js %} + {{ form.media.js }} +{% endblock %} diff --git a/hypha/apply/projects/templates/application_projects/modals/report_frequency_config.html b/hypha/apply/projects/templates/application_projects/modals/report_frequency_config.html index 34064c7790..d571a8f793 100644 --- a/hypha/apply/projects/templates/application_projects/modals/report_frequency_config.html +++ b/hypha/apply/projects/templates/application_projects/modals/report_frequency_config.html @@ -42,7 +42,7 @@ enctype="multipart/form-data" > {% csrf_token %} - + {{ form.media.js }} {% for hidden in form.hidden_fields %} {{ hidden }} {% endfor %} diff --git a/hypha/apply/projects/templates/application_projects/project_form.html b/hypha/apply/projects/templates/application_projects/project_form.html index 55d71623e7..338932cbcb 100644 --- a/hypha/apply/projects/templates/application_projects/project_form.html +++ b/hypha/apply/projects/templates/application_projects/project_form.html @@ -16,7 +16,6 @@
{% csrf_token %} - {% for field in form %} {% if field.field %} {% include "forms/includes/field.html" %} @@ -37,3 +36,7 @@
{% endblock %} + +{% block extra_js %} + {{ form.media.js }} +{% endblock %} diff --git a/hypha/apply/projects/templates/application_projects/report_form.html b/hypha/apply/projects/templates/application_projects/report_form.html index 197aa6d2e9..c350b2837d 100644 --- a/hypha/apply/projects/templates/application_projects/report_form.html +++ b/hypha/apply/projects/templates/application_projects/report_form.html @@ -34,7 +34,6 @@ {% csrf_token %} - {% for field in form %} {% if field.field %} {% if field.field.multi_input_field %} @@ -77,5 +76,6 @@ {% endblock %} {% block extra_js %} + {{ form.media.js }} {% endblock %} diff --git a/hypha/apply/review/templates/review/review_edit_form.html b/hypha/apply/review/templates/review/review_edit_form.html index 41deebbc07..c287fe968b 100644 --- a/hypha/apply/review/templates/review/review_edit_form.html +++ b/hypha/apply/review/templates/review/review_edit_form.html @@ -32,7 +32,6 @@ {% csrf_token %} - {% for hidden in form.hidden_fields %} {{ hidden }} {% endfor %} @@ -81,5 +80,6 @@

{{ value }}

{% endblock %} {% block extra_js %} + {{ form.media.js }} {% endblock %} diff --git a/hypha/apply/review/templates/review/review_form.html b/hypha/apply/review/templates/review/review_form.html index 18bf5096a5..4c253a516d 100644 --- a/hypha/apply/review/templates/review/review_form.html +++ b/hypha/apply/review/templates/review/review_form.html @@ -42,7 +42,6 @@ {% if not has_submitted_review %} {% csrf_token %} - {% for hidden in form.hidden_fields %} {{ hidden }} {% endfor %} @@ -102,5 +101,6 @@

{{ value }}

{% endblock %} {% block extra_js %} + {{ form.media.js }} {% endblock %} diff --git a/hypha/apply/users/templates/wagtailusers/users/edit.html b/hypha/apply/users/templates/wagtailusers/users/edit.html index 2974e108ac..5a1aa4547b 100644 --- a/hypha/apply/users/templates/wagtailusers/users/edit.html +++ b/hypha/apply/users/templates/wagtailusers/users/edit.html @@ -110,7 +110,9 @@ {{ block.super }} {% endblock %} + {% block extra_js %} {{ block.super }} {% include "wagtailadmin/pages/_editor_js.html" %} + {{ form.media.js }} {% endblock %} diff --git a/hypha/templates/base.html b/hypha/templates/base.html index 0f2a659266..5adc66e7ea 100644 --- a/hypha/templates/base.html +++ b/hypha/templates/base.html @@ -26,6 +26,7 @@ + {{ form.media.css }} {% block extra_css %}{% endblock %} @@ -126,7 +127,6 @@ - {{ form.media.js }} {% block extra_js %}{% endblock %} {% block sentry_sdk %}