From 75634e6ba68c9ab2848f04db4f7a60af0b89bb43 Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Mon, 31 Jan 2022 21:42:31 +0000 Subject: [PATCH] Merged in [19900] from jennifer@painless-security.com: Fix hiding of name/purpose/type fields when not needed in secr/sreq. Fixes #3531. - Legacy-Id: 19901 Note: SVN reference [19900] has been migrated to Git commit 5f9868e8478a0d455b8f5c0b1fb5f8cd442cf718 --- ietf/secr/templates/sreq/edit.html | 4 ++++ ietf/secr/templates/sreq/new.html | 4 ++++ ietf/static/ietf/js/meeting/session_details_form.js | 2 +- ietf/templates/meeting/session_details_form.html | 13 +++++++++---- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ietf/secr/templates/sreq/edit.html b/ietf/secr/templates/sreq/edit.html index f1b97e834..733226a40 100755 --- a/ietf/secr/templates/sreq/edit.html +++ b/ietf/secr/templates/sreq/edit.html @@ -6,6 +6,10 @@ {{ form.media }} + {% endblock %} {% block breadcrumbs %}{{ block.super }} diff --git a/ietf/secr/templates/sreq/new.html b/ietf/secr/templates/sreq/new.html index fcf9b4607..4acc97f44 100755 --- a/ietf/secr/templates/sreq/new.html +++ b/ietf/secr/templates/sreq/new.html @@ -7,6 +7,10 @@ {{ form.media }} + {% endblock %} {% block breadcrumbs %}{{ block.super }} diff --git a/ietf/static/ietf/js/meeting/session_details_form.js b/ietf/static/ietf/js/meeting/session_details_form.js index 139310e4d..38c794605 100644 --- a/ietf/static/ietf/js/meeting/session_details_form.js +++ b/ietf/static/ietf/js/meeting/session_details_form.js @@ -79,7 +79,7 @@ const name_elts = [ document.getElementById(id_prefix + 'name'), document.getElementById(id_prefix + 'short'), - ]; + ].filter(Boolean); // removes null entries const type_elt = document.getElementById(id_prefix + 'type'); const type_options = type_elt.getElementsByTagName('option'); const allowed_types = (type_elt.dataset.allowedOptions) ? diff --git a/ietf/templates/meeting/session_details_form.html b/ietf/templates/meeting/session_details_form.html index daafdac93..3fe88307b 100644 --- a/ietf/templates/meeting/session_details_form.html +++ b/ietf/templates/meeting/session_details_form.html @@ -2,15 +2,20 @@
{% if hidden %}{{ form.name.as_hidden }}{{ form.purpose.as_hidden }}{{ form.type.as_hidden }}{{ form.requested_duration.as_hidden }} {% else %} - - +
{% comment %} + The form-group class is used by session_details_form.js to identify the correct element + to hide the name / purpose / type fields when not needed. This is a bootstrap class - the + secr app does not use it, so this (and the hidden class, also needed by session_details_form.js) + are defined in edit.html and new.html as a kludge to make this work. + {% endcomment %} + - +
{{ form.name.label_tag }} {{ form.name }}{{ form.purpose.errors }}
{{ form.purpose.label_tag }} - {{ form.purpose }} {{ form.type }} + {{ form.purpose }}
{{ form.type }}
{{ form.purpose.errors }}{{ form.type.errors }}