{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template core/settings_link_page

    Displays the admin tree as a list of grouped links.

    Example context (json):
    {
        "node": {
            "text": "Root of menu",
            "key": "test0",
            "display": true,
            "children": [
                {
                    "text": "Child of menu",
                    "key": "test1",
                    "display": true,
                    "children": []
                }
            ]
        }
    }
}}
<div class="d-md-inline-flex w-100 no-gutters">
    <div class="col tab-content px-0">
        <div class="tab-pane active" id="link{{node.key}}" role="tabpanel">
            <div class="rui-settings-container px-0">
                <div class="row">
                    <div class="col-sm-12 col-md-3 pt-5">
                    </div>
                    <div class="col">
                        <ul class="list-unstyled rui-list-admin-links">
                            {{#node.children}}
                                {{^children.count}}
                                    {{#display}}
                                        <li><a href="{{{action}}}">{{text}}</a></li>
                                    {{/display}}
                                {{/children.count}}
                            {{/node.children}}
                        </ul>
                    </div>
                </div>

                {{#node.children}}
                    {{#display}}
                        {{#children.count}}
                            {{#is_short_branch}}
                                <hr>
                                <div class="row">
                                    <div class="col-sm-12 col-md-3">
                                        {{#action}}<h4><a class="badge badge-secondary" href="{{action}}">{{text}}</a></h4>{{/action}}
                                        {{^action}}<h4 class="badge badge-light">{{text}}</h4>{{/action}}
                                    </div>
                                    <div class="col">
                                        <ul class="list-unstyled rui-list-admin-links">
                                            {{#children}}
                                                {{> core/settings_link_page_single }}
                                            {{/children}}
                                        </ul>
                                    </div>
                                </div>
                            {{/is_short_branch}}
                        {{/children.count}}
                    {{/display}}
                {{/node.children}}
            </div>
        </div>
        {{#node.children}}
            {{#children.count}}
                <div class="tab-pane" id="link{{key}}" role="tabpanel">
                    <div class="rui-settings-container px-0">
                        <div class="row">
                            <div class="col-sm-12 col-md-3 mt-1">
                                {{#action}}<h4><a class="badge badge-secondary" href="{{action}}">{{text}}</a></h4>{{/action}}
                                {{^action}}<h4 class="badge badge-light">{{text}}</h4>{{/action}}
                            </div>
                            <div class="col-sm-12 col-md-9">
                                <ul class="list-unstyled rui-list-admin-links">
                                    {{#children}}
                                        {{#display}}
                                            {{^children.count}}
                                                <li><a href="{{{action}}}">{{text}}</a></li>
                                            {{/children.count}}
                                        {{/display}}
                                    {{/children}}
                                </ul>
                            </div>
                        </div>
                        {{#children}}
                            {{#display}}
                                {{#children.count}}
                                    <hr>
                                    <div class="row">
                                        <div class="col-sm-12 col-md-3 mt-1">
                                            {{#action}}<h4><a class="badge badge-secondary" href="{{action}}">{{text}}</a></h4>{{/action}}
                                            {{^action}}<h4 class="badge badge-light">{{text}}</h4>{{/action}}
                                        </div>
                                        <div class="col-sm-12 col-md-9">
                                            <ul class="list-unstyled rui-list-admin-links">
                                                {{#children}}
                                                    {{> core/settings_link_page_single }}
                                                {{/children}}
                                            </ul>
                                        </div>
                                    </div>
                                {{/children.count}}
                            {{/display}}
                        {{/children}}
                    </div>
                </div>
            {{/children.count}}
        {{/node.children}}
    </div>
</div>