Skip to content

Commit 5f9868e

Browse files
Fix hiding of name/purpose/type fields when not needed in secr/sreq. Fixes ietf-tools#3531. Commit ready for merge.
- Legacy-Id: 19900
1 parent ea79fe0 commit 5f9868e

4 files changed

Lines changed: 18 additions & 5 deletions

File tree

ietf/secr/templates/sreq/edit.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
<script type="text/javascript" src="{% static 'secr/js/utils.js' %}"></script>
77
<script type="text/javascript" src="{% static 'secr/js/sessions.js' %}"></script>
88
{{ form.media }}
9+
<style>
10+
.hidden {display: none !important;}
11+
div.form-group {display: inline;}
12+
</style>
913
{% endblock %}
1014

1115
{% block breadcrumbs %}{{ block.super }}

ietf/secr/templates/sreq/new.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
<script type="text/javascript" src="{% static 'secr/js/utils.js' %}"></script>
88
<script type="text/javascript" src="{% static 'secr/js/sessions.js' %}"></script>
99
{{ form.media }}
10+
<style>
11+
.hidden {display: none !important;}
12+
div.form-group {display: inline;}
13+
</style>
1014
{% endblock %}
1115

1216
{% block breadcrumbs %}{{ block.super }}

ietf/static/ietf/js/meeting/session_details_form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
const name_elts = [
8080
document.getElementById(id_prefix + 'name'),
8181
document.getElementById(id_prefix + 'short'),
82-
];
82+
].filter(Boolean); // removes null entries
8383
const type_elt = document.getElementById(id_prefix + 'type');
8484
const type_options = type_elt.getElementsByTagName('option');
8585
const allowed_types = (type_elt.dataset.allowedOptions) ?

ietf/templates/meeting/session_details_form.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22
<div class="session-details-form" data-prefix="{{ form.prefix }}">
33
{% if hidden %}{{ form.name.as_hidden }}{{ form.purpose.as_hidden }}{{ form.type.as_hidden }}{{ form.requested_duration.as_hidden }}
44
{% else %}
5-
<table>
6-
<tr>
5+
<table>{% comment %}
6+
The form-group class is used by session_details_form.js to identify the correct element
7+
to hide the name / purpose / type fields when not needed. This is a bootstrap class - the
8+
secr app does not use it, so this (and the hidden class, also needed by session_details_form.js)
9+
are defined in edit.html and new.html as a kludge to make this work.
10+
{% endcomment %}
11+
<tr class="form-group">
712
<th>{{ form.name.label_tag }}</th>
813
<td>{{ form.name }}{{ form.purpose.errors }}</td>
914
</tr>
10-
<tr>
15+
<tr class="form-group">
1116
<th>{{ form.purpose.label_tag }}</th>
1217
<td>
13-
{{ form.purpose }} {{ form.type }}
18+
{{ form.purpose }} <div class="form-group">{{ form.type }}</div>
1419
{{ form.purpose.errors }}{{ form.type.errors }}
1520
</td>
1621
</tr>

0 commit comments

Comments
 (0)