{{!
    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 theme_snap/blocks_drawer

    Snap template for the blocks drawer.

    Example context (json):
    {
        "sidepreblocks": "<h2>Blocks html goes here</h2>",
        "hasblocks":true,
        "courseindexopen": true,
        "blockdraweropen": true,
        "addblockbutton": ""
    }
}}
{{#hasblocks}}
    {{< theme_boost/drawer }}
        {{$id}}theme_snap-drawers-blocks{{/id}}
        {{$drawerclasses}}drawer drawer-right{{#blockdraweropen}} show{{/blockdraweropen}}{{/drawerclasses}}
        {{$drawercontent}}
            <section class="d-print-none" aria-label="{{#str}}blocks{{/str}}">
                {{{ addblockbutton }}}
                {{{ sidepreblocks }}}
            </section>
        {{/drawercontent}}
        {{$drawerpreferencename}}drawer-open-block{{/drawerpreferencename}}
        {{$forceopen}}{{#forceblockdraweropen}}1{{/forceblockdraweropen}}{{/forceopen}}
        {{$drawerstate}}show-drawer-right{{/drawerstate}}
        {{$tooltipplacement}}left{{/tooltipplacement}}
        {{$drawercloseonresize}}1{{/drawercloseonresize}}
        {{$closebuttontext}}{{#str}}closeblockdrawer, core{{/str}}{{/closebuttontext}}
    {{/ theme_boost/drawer}}

    {{#showdraweropenbutton}}
    <div class="drawer-toggler drawer-right-toggle">
        <button
            class="btn px-1 py-2"
            data-toggler="drawers"
            data-action="toggle"
            data-target="theme_snap-drawers-blocks"
            data-toggle="tooltip"
            data-placement="right"
            title="{{#str}}opendrawerblocks, core{{/str}}"
        >
            <span class="sr-only">{{#str}}opendrawerblocks, core{{/str}}</span>
            <span class="dir-rtl-hide">{{#pix}} t/blocks_drawer, moodle {{/pix}}</span>
                <span class="dir-ltr-hide">{{#pix}} t/blocks_drawer_rtl, moodle {{/pix}}</span>
            </button>
        </div>
    {{/showdraweropenbutton}}
{{/hasblocks}}

{{#js}}
M.util.js_pending('theme_boost/loader');
require(['theme_boost/loader', 'theme_boost/drawer', 'theme_snap/blocks_drawer'], function(Loader, Drawer, BlocksDrawer) {
    Drawer.init();
    BlocksDrawer.init();
    M.util.js_complete('theme_boost/loader');
});
{{/js}}
