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
This commit is contained in:
parent
dd66187362
commit
75634e6ba6
|
@ -6,6 +6,10 @@
|
|||
<script type="text/javascript" src="{% static 'secr/js/utils.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'secr/js/sessions.js' %}"></script>
|
||||
{{ form.media }}
|
||||
<style>
|
||||
.hidden {display: none !important;}
|
||||
div.form-group {display: inline;}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}{{ block.super }}
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
<script type="text/javascript" src="{% static 'secr/js/utils.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'secr/js/sessions.js' %}"></script>
|
||||
{{ form.media }}
|
||||
<style>
|
||||
.hidden {display: none !important;}
|
||||
div.form-group {display: inline;}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}{{ block.super }}
|
||||
|
|
|
@ -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) ?
|
||||
|
|
|
@ -2,15 +2,20 @@
|
|||
<div class="session-details-form" data-prefix="{{ form.prefix }}">
|
||||
{% if hidden %}{{ form.name.as_hidden }}{{ form.purpose.as_hidden }}{{ form.type.as_hidden }}{{ form.requested_duration.as_hidden }}
|
||||
{% else %}
|
||||
<table>
|
||||
<tr>
|
||||
<table>{% 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 %}
|
||||
<tr class="form-group">
|
||||
<th>{{ form.name.label_tag }}</th>
|
||||
<td>{{ form.name }}{{ form.purpose.errors }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="form-group">
|
||||
<th>{{ form.purpose.label_tag }}</th>
|
||||
<td>
|
||||
{{ form.purpose }} {{ form.type }}
|
||||
{{ form.purpose }} <div class="form-group">{{ form.type }}</div>
|
||||
{{ form.purpose.errors }}{{ form.type.errors }}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue