{% load sidebar_menu %} {% if allowed %} {% comment %} The tree's root is a link. The link and the expand/collapse toggle are separate elements: AdminLTE toggles the tree when the toggle (the element right before the menu) is clicked, and the link works like any other link. {% endcomment %} {% if root_allowed %} {# Handle when tree root node is a valid url, which the user can open. #}
  • {{ node.text }} {# Only an active tree (one that holds the current page) starts expanded. AdminLTE hides the rest. #}
  • {% else %} {# Handle when tree root node is not a url, or is a url that the user can't open. #} {# The root only expands and collapses the tree. #}
  • {{ node.text }} {# Only an active tree (one that holds the current page) starts expanded. AdminLTE hides the rest. #}
  • {% endif %} {% elif link %} {# Handle when the user can open the tree root node's url, but none of the links inside the tree. #} {# The root is shown as a plain link, without the tree. #} {% include "adminlte2/partials/_main_sidebar/_menu_link.html" with node=link allowed=True %} {% endif %}