Disable session purpose/timeslot type hiding on schedule editor when only 0 or 1 options

- Legacy-Id: 19439
This commit is contained in:
Jennifer Richards 2021-10-19 14:39:17 +00:00
parent b6ac3d4b1d
commit 446ac7a47e
2 changed files with 24 additions and 18 deletions

View file

@ -737,9 +737,10 @@ jQuery(document).ready(function () {
timeslots.filter(checked.join(",")).removeClass('hidden-timeslot-type');
timeslots.not(checked.join(",")).addClass('hidden-timeslot-type');
}
if (timeSlotTypeInputs.length > 0) {
timeSlotTypeInputs.on("click", updateTimeSlotTypeToggling);
updateTimeSlotTypeToggling();
}
// Toggling session purposes
let sessionPurposeInputs = content.find('.session-purpose-toggles input');
@ -752,9 +753,10 @@ jQuery(document).ready(function () {
sessions.filter(checked.join(",")).removeClass('hidden-purpose');
sessions.not(checked.join(",")).addClass('hidden-purpose');
}
if (sessionPurposeInputs.length > 0) {
sessionPurposeInputs.on("click", updateSessionPurposeToggling);
updateSessionPurposeToggling();
}
// toggling visible timeslots
let timeslotGroupInputs = content.find("#timeslot-group-toggles-modal .modal-body input");

View file

@ -199,19 +199,23 @@
{% endfor %}
</span>
{% if session_purposes|length > 1 %}
<span class="toggle-inputs session-purpose-toggles">
Purpose:
{% for purpose in session_purposes %}
<label class="purpose-{{ purpose.slug }}"><input type="checkbox" checked value="{{ purpose.slug }}"> {{ purpose }}</label>
{% endfor %}
</span>
{% endif %}
{% if timeslot_types|length > 1 %}
<span class="toggle-inputs timeslot-type-toggles">
Type:
{% for type in timeslot_types %}
<label class="timeslot-type-{{ type.slug }}"><input type="checkbox" checked value="{{ type.slug }}"> {{ type }}</label>
{% endfor %}
</span>
{% endif %}
</div>
</div>
</div>