<commit_before>{% macro menu_nodes(nodes, name, nodeId404, nodeId503) %}
    {% for element in nodes %}
        {% set node = element.node %}
        {% if (node.nodeType != "general" and is_granted("ROLE_ACCESS_TREE_NODE", node))
           or (node.nodeType == "general" and is_granted("ROLE_ACCESS_TREE_GENERAL_NODE")) %}
            <li data-element-id="{{ node.nodeId }}"
                data-type="Node"
            >
                <a
                    id="nav-node-{{ node.nodeId }}"
                    data-url="{{ path('open_orchestra_api_node_show_or_create', {'nodeId': node.nodeId}) }}"
                    data-node="{{ node.nodeId }}"
                    href="#node/show/{{ node.nodeId }}"
                >
                    <span>{{ node.name }}</span>
                </a>
                {% if 'child' in element|keys
                   and (element.child is not empty or is_granted("ROLE_ACCESS_CREATE_NODE", node))
                   and node.nodeType != constant('TYPE_TRANSVERSE', node)
                %}
                    <ul
                        {% if is_granted("ROLE_ACCESS_MOVE_TREE") %} class="node-connectedSortable" {% endif %}
                        data-update-order="{{ path('open_orchestra_api_node_update_children_order', {'nodeId': node.nodeId}) }}"
                        data-confirm-title="{{ 'open_orchestra_backoffice.left_menu.tree.confirm_move.title'|trans }}"
                        data-confirm-text="{{ 'open_orchestra_backoffice.left_menu.tree.confirm_move.text'|trans({'%nodeName%': node.name}) }}"
                    >
                        {% if element.child is not empty %}
                            {{ _self.menu_nodes(element.child, name) }}
                        {% endif %}
                        {{ _self.new_node(node.nodeId, "node-unsortable", node) }}
                    </ul>
                {% endif %}
            </li>
        {% endif %}
    {% else %}
        {{ _self.new_node('-', "ui-state-unsortable", null) }}
    {% endfor %}

    {% if nodeId404 %}
        {{ _self.error_node(nodeId404, 'error_404') }}
    {% endif %}

    {% if nodeId503 %}
        {{ _self.error_node(nodeId503, 'error_503') }}
    {% endif %}

{% endmacro %}

{% macro new_node(parentId, class, node) %}
    {% if is_granted("ROLE_ACCESS_CREATE_NODE", node) or (parentId == '-' and node is null and is_granted("ROLE_ACCESS_CREATE_SITE")) %}
        <li>
            <div class="{{ class }}"><commit_msg>remove addpage button if no root page<commit_after>{% macro menu_nodes(nodes, name, nodeId404, nodeId503) %}
    {% for element in nodes %}
        {% set node = element.node %}
        {% if (node.nodeType != "general" and is_granted("ROLE_ACCESS_TREE_NODE", node))
           or (node.nodeType == "general" and is_granted("ROLE_ACCESS_TREE_GENERAL_NODE")) %}
            <li data-element-id="{{ node.nodeId }}"
                data-type="Node"
            >
                <a
                    id="nav-node-{{ node.nodeId }}"
                    data-url="{{ path('open_orchestra_api_node_show_or_create', {'nodeId': node.nodeId}) }}"
                    data-node="{{ node.nodeId }}"
                    href="#node/show/{{ node.nodeId }}"
                >
                    <span>{{ node.name }}</span>
                </a>
                {% if 'child' in element|keys
                   and (element.child is not empty or is_granted("ROLE_ACCESS_CREATE_NODE", node))
                   and node.nodeType != constant('TYPE_TRANSVERSE', node)
                %}
                    <ul
                        {% if is_granted("ROLE_ACCESS_MOVE_TREE") %} class="node-connectedSortable" {% endif %}
                        data-update-order="{{ path('open_orchestra_api_node_update_children_order', {'nodeId': node.nodeId}) }}"
                        data-confirm-title="{{ 'open_orchestra_backoffice.left_menu.tree.confirm_move.title'|trans }}"
                        data-confirm-text="{{ 'open_orchestra_backoffice.left_menu.tree.confirm_move.text'|trans({'%nodeName%': node.name}) }}"
                    >
                        {% if element.child is not empty %}
                            {{ _self.menu_nodes(element.child, name) }}
                        {% endif %}
                        {{ _self.new_node(node.nodeId, "node-unsortable", node) }}
                    </ul>
                {% endif %}
            </li>
        {% endif %}
    {% else %}
        {{ _self.new_node('-', "ui-state-unsortable", null) }}
    {% endfor %}

    {% if nodeId404 %}
        {{ _self.error_node(nodeId404, 'error_404') }}
    {% endif %}

    {% if nodeId503 %}
        {{ _self.error_node(nodeId503, 'error_503') }}
    {% endif %}

{% endmacro %}

{% macro new_node(parentId, class, node) %}
    {% if is_granted("ROLE_ACCESS_CREATE_NODE", node) and parentId != '-' and node is not null %}
        <li>
            <div class="{{ class }}">
{'fraction_non_alphanumeric': 0.1528481654165822, 'fraction_numerical': 0.009730387188323536, 'mean_word_length': 1.7320044296788484, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4439186', 'n_tokens_mistral': 1585, 'n_tokens_neox': 1422, 'n_words': 251}