{{! 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 . }} {{! @template qbank_managecategories/categories Template for displaying category view. Context variables required for this template: * contextid - Context id for js init. * categoriesrendered - Array representing categories data rendered. * items - Categories data. * heading - Category's heading for each context (ie: Course or Quiz). * ctxlvl - Context level for categories section - context. Example context (json): { "contextid": "18", "categoriesrendered": [{ "items": [{ "categoryid": "1", "questionbankurl": "question/edit.php?cmid=123", "categoryname": "Default for Miscellaneous", "idnumber": "1", "questioncount": " (1)", "categorydesc": "The default category for questions shared in context Miscellaneous", "editactionmenu": "
...
", "handle": true, "iconleft": "", "iconright": "", "children": "" }], "heading": "Question categories for 'Quiz: qz'", "ctxlvl": "contextlevel70" }] } }}
{{#categoriesrendered}}

{{heading}}

    {{#items}} {{> qbank_managecategories/category }} {{/items}}
{{/categoriesrendered}}
{{#js}} require(['qbank_managecategories/categoryroot'], (categoryroot) => { categoryroot.init('#categoryroot'); }); require(['qbank_managecategories/categorylist'], (categorylist) => { // Initialise top-level lists. const categoryLists = document.querySelectorAll('.qbank_managecategories-categorylist[data-contextid]'); categoryLists.forEach(element => { categorylist.init(`.qbank_managecategories-categorylist[data-categoryid="${element.dataset.categoryid}"]`); }); }); {{/js}}