{{!
    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 format_ludic/headerbar

    Displays the header bar

    Context variables required for this template:
    * buttons Array - each button is an object with a name, a link and an indicator of position (right / left).

    Example context (json):
    {
        "buttons": [
            {"name": "Title",   "shortname": "title",   "link": "value",                           "left": false},
            {"name": "Course",  "shortname": "course",  "link": "/course/view.php?id=2",           "left": true},
            {"name": "Section", "shortname": "section", "link": "/course/view.php?id=2&section=1", "left": true}
        ]
    }
}}
{{#hasoptionsorsections}}
<div id="ludic-header-bar" class="format-ludic header-bar navbar navbar-light bg-light">

        <a class="btn btn-primary nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            {{#str}}header-bar-menu, format_ludic{{/str}}
        </a>

        <div class="dropdown-menu" id="ludic-navbar-content" aria-labelledby="navbarDropdownMenuLink">
            {{#hasoptions}}
            {{#notstudentview}}
            {{#optionslist}}
                <div class="dropdown-item {{#link}}link{{/link}}" data-action="{{action}}"{{#link}} data-link="{{link}}"{{/link}}{{#controller}}
                data-controller="{{controller}}"{{/controller}}{{#callback}} data-callback="{{callback}}"{{/callback}}{{#id}} data-id="{{id}}"{{/id}}>
                <img class="activityicon" src="{{iconsrc}}" aria-label="{{iconsrc}}">
                <span class="text">{{name}}</span>
                </div>
            {{/optionslist}}
            {{/notstudentview}}
            {{/hasoptions}}
<!--
            {{^hasoptions}}
            {{#str}}header-no-content, format_ludic{{/str}}
            {{/hasoptions}}
-->
{{#hasoptionsandsections}}
            <div class="dropdown-divider"></div>
{{/hasoptionsandsections}}

{{#hassections}}
            <div class="header-sections-list ">

                {{#sections}}

                <div class="section-title dropdown-item" data-id="{{id}}" data-link="{{link}}" data-action="getDataLinkAndRedirectTo" data-type="section">{{name}}</div>
                {{/sections}}

            </div>
{{/hassections}}
        </div>
</div>
{{/hasoptionsorsections}}



