{% includeTranslations
"Show/hide children",
"New child"
%}
{% nav element in elements %}
{% set collapsed = (viewState.collapsedElementIds is defined and element.id in viewState.collapsedElementIds) %}
{% set indent = 8 + (element.depth - 1) * 35 %}
{% include "_elements/element" %}
{% if context == 'index' %}
{% if source.sortable is defined and source.sortable %}
{% endif %}
{% endif %}
{% ifchildren %}
{% children %}
{% endifchildren %}
{% endnav %}
{# Hide "Add child" menu buttons beyond the max depth #}
{% if context == 'index' and source.maxDepth is defined and source.maxDepth %}
{% set css %}
.structureview{% for i in 2 .. source.maxDepth if source.maxDepth >= 2 %} ul{% endfor %} .add { display: none; }
{% endset %}
{% includeCss css %}
{% endif %}