{% macro selectBox(groupdata, selected = "", fullpath = "", depth = 0) %}{#
#}{% if fullpath %}{#
#}{% set fullpath = fullpath ~ " › " ~ groupdata.name %}{#
#}{% else %}{#
#}{% set fullpath = groupdata.name %}{#
#}{% endif %}
<option
value="{{ groupdata.groupid|e('html_attr') }}"
data-fullpath="{{ fullpath|e('html_attr') }}"
class="
treeselect
branch_{{ depth|default(0)|e('html_attr') }}
{% if groupdata.children %}
treeselect_parent
{% endif %}"
{% if selected is iterable %}
{% if groupdata.groupid in selected %}
selected="selected"
{% endif %}
{% else %}
{% if groupdata.groupid == selected %}
selected="selected"
{% endif %}
{% endif %}
>
{{ groupdata.name }}
</option>
{% if groupdata.children %}
{% for child in groupdata.children %}
{{ _self.selectBox(child, selected, fullpath, depth + 1) }}
{% endfor %}
{% endif %}
{% endmacro %}
{% macro groupTree(groupdata, depth) %}
<li>
<a
class="pure-button pure-button-primary"
href="{{ cabin_url() }}crew/groups/edit/{{ groupdata.groupid|e('html_attr') }}"
>
<i
class="fa fa-pencil"
title="{{ __(
"Edit Group (%s)", "default",
groupdata.name
)|e('html_attr')
}}"
></i>
</a>
<a
class="pure-button pure-button-secondary"
href="{{ cabin_url() }}crew/groups/delete/{{ groupdata.groupid|e('html_attr') }}"
>
<i
class="fa fa-trash-o"
title="{{ __(
"Delete Group (%s)", "default",
groupdata.name
)|e('html_attr')
}}"
></i>
</a>
{{ groupdata.name }}
</li>
{% if groupdata.children %}
<ul>
{% for child in groupdata.children %}
{{ _self.groupTree(child, depth|default(0) + 1) }}
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
|