Visual enhancement for custom JS tree widget
* adds proper css behaviour for collapsed icon * adds minor js comments
This commit is contained in:
parent
2c2075fe4a
commit
18789c231d
@ -262,4 +262,13 @@ Similar to bootstraps 'shadow-lg'
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
*/
|
||||
*/
|
||||
.collapse-icn > i{
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.collapsed .collapse-icn > i{
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
.tree-label.badge{
|
||||
font-size: 90%;
|
||||
}
|
@ -2,11 +2,13 @@
|
||||
|
||||
{% for code in codes %}
|
||||
<div class="ml-4 tree-element">
|
||||
<label class="tree-label" role="{% if not code.is_leaf%}button{% endif %}" for="input_{{code.pk|unlocalize}}" id="{{code.pk|unlocalize}}" data-toggle="collapse" data-target="#children_{{code.pk|unlocalize}}" aria-expanded="true" aria-controls="children_{{code.pk|unlocalize}}">
|
||||
<label class="tree-label collapsed" role="{% if not code.is_leaf%}button{% endif %}" for="input_{{code.pk|unlocalize}}" id="{{code.pk|unlocalize}}" data-toggle="collapse" data-target="#children_{{code.pk|unlocalize}}" aria-expanded="true" aria-controls="children_{{code.pk|unlocalize}}">
|
||||
{% if code.is_leaf%}
|
||||
<input class="tree-input" id="input_{{code.pk|unlocalize}}" name="{{ widget.name }}" type="checkbox" value="{{code.pk|unlocalize}}" {% if code.pk|unlocalize in widget.value %}checked{% endif %}/>
|
||||
{% else %}
|
||||
{% fa5_icon 'angle-right' %}
|
||||
<span class="collapse-icn">
|
||||
{% fa5_icon 'angle-down' %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{{code.long_name}}
|
||||
</label>
|
||||
|
@ -47,9 +47,12 @@
|
||||
}
|
||||
);
|
||||
if(val.length > 0){
|
||||
// Hide everything
|
||||
allTreeElements.hide()
|
||||
// Now show again everything matching the query
|
||||
allTreeElementsContain.show()
|
||||
}else{
|
||||
// Show everything if no query exists
|
||||
allTreeElements.show()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user