MVC: base_form: allow collapsible headers

This commit is contained in:
Stephan de Wit 2023-04-07 11:26:39 +02:00
parent f59587d7e4
commit 07ce32139e
2 changed files with 18 additions and 2 deletions

View File

@ -85,10 +85,16 @@
</colgroup>
<thead>
<tr {% if field['advanced']|default(false)=='true' %} data-advanced="true"{% endif %}>
<td colspan="3"><div style="padding-bottom: 8px; padding-top: 8px; font-size: 17px;"><b>{{field['label']}}</b></div></td>
<td colspan="3">
<div style="padding-bottom: 5px; padding-top: 5px; font-size: 16px;">
{% if field['collapsible']|default(false)=='true' %}<i class="fa fa-angle-down" aria-hidden="true"></i>{% else %}<i class="fa fa-angle-right" aria-hidden="true"></i>{% endif %}
&nbsp;
<b>{{field['label']}}</b>
</div>
</td>
</tr>
</thead>
<tbody>
<tbody {% if field['collapsible']|default(false)=='true' %}class="collapsible"{% endif %}>
{#- endmacro #}
{% else %}

View File

@ -112,6 +112,16 @@
});
}, 500);
$('.table').on('click', 'thead', function(event) {
let collapse = $(event.currentTarget).next();
let id = collapse.attr('class');
if (collapse != undefined && id !== undefined && id === "collapsible") {
let icon = $('> tr > td > div > i', event.currentTarget);
icon.toggleClass("fa-angle-down fa-angle-right");
$('> tr > td', collapse).fadeToggle(150);
}
});
// hook in live menu search
$.ajax("/api/core/menu/search/", {
type: 'get',