1441 |
ariadna |
1 |
{{!
|
|
|
2 |
This file is part of Moodle - http://moodle.org/
|
|
|
3 |
|
|
|
4 |
Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
it under the terms of the GNU General Public License as published by
|
|
|
6 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
(at your option) any later version.
|
|
|
8 |
|
|
|
9 |
Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
GNU General Public License for more details.
|
|
|
13 |
|
|
|
14 |
You should have received a copy of the GNU General Public License
|
|
|
15 |
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
}}
|
|
|
17 |
{{!
|
|
|
18 |
@template qbank_managecategories/category
|
|
|
19 |
|
|
|
20 |
This template renders the list item for each category.
|
|
|
21 |
|
|
|
22 |
Context variables required for this template:
|
|
|
23 |
* categoryid - The id of the category this item represents.
|
|
|
24 |
* questionbankurl - Url for corresponding question bank.
|
|
|
25 |
* categoryname - Category name. Raw string. Will be HTML-escaped during rendering.
|
|
|
26 |
* idnumber - Id number string (optional).
|
|
|
27 |
* questioncount - Number of question in question bank.
|
|
|
28 |
* categorydesc - Category description. HTML that is safe to output (e.g. from format_text).
|
|
|
29 |
* editactionmenu - Edit action menu link.
|
|
|
30 |
* draghandle - Boolean if handle should be displayed (if category is movable).
|
|
|
31 |
* children - Children category item to curent category (same variables as those above).
|
|
|
32 |
|
|
|
33 |
Example context (json):
|
|
|
34 |
{
|
|
|
35 |
"categoryid": "1",
|
|
|
36 |
"questionbankurl": "question/edit.php?cmid=123",
|
|
|
37 |
"categoryname": "Default for Miscellaneous & < > \" '",
|
|
|
38 |
"idnumber": "1",
|
|
|
39 |
"questioncount": " 1",
|
|
|
40 |
"categorydesc": "The default category for questions shared in context Miscellaneous",
|
|
|
41 |
"editactionmenu": "<div class='action-menu moodle-actionmenu'>...</div>",
|
|
|
42 |
"draghandle": true,
|
|
|
43 |
"children": ""
|
|
|
44 |
}
|
|
|
45 |
}}
|
|
|
46 |
<li class="qbank_managecategories-item{{#draghandle}} draghandle{{/draghandle}}"
|
|
|
47 |
id="category-{{{categoryid}}}"
|
|
|
48 |
data-categoryid="{{{categoryid}}}"
|
|
|
49 |
data-contextid="{{{contextid}}}"
|
|
|
50 |
data-categoryname="{{categoryname}}"
|
|
|
51 |
data-parent="{{parent}}"
|
|
|
52 |
data-sortorder="{{sortorder}}">
|
|
|
53 |
<div class="container{{#haschildren}} pb-0{{/haschildren}}">
|
|
|
54 |
<div class="d-flex flex-wrap m-0">
|
|
|
55 |
<div class="p-2 me-2 qbank_managecategories-handlecontainer">
|
|
|
56 |
<span class="qbank_managecategories-draghandle">
|
|
|
57 |
<i class="fa fa-grip-vertical"></i>
|
|
|
58 |
</span>
|
|
|
59 |
</div>
|
|
|
60 |
<div class="col-11 p-0 qbank_managecategories-contentcontainer">
|
|
|
61 |
<div class="row m-0">
|
|
|
62 |
<div class="col-11 p-0 pt-1 qbank_managecategories-details">
|
|
|
63 |
{{>qbank_managecategories/category_details}}
|
|
|
64 |
</div>
|
|
|
65 |
<div class="col-1 qbank_managecategories-actioncontainer">
|
|
|
66 |
{{#editactionmenu}}
|
|
|
67 |
{{>core/action_menu}}
|
|
|
68 |
{{/editactionmenu}}
|
|
|
69 |
</div>
|
|
|
70 |
</div>
|
|
|
71 |
<div class="row m-0 mt-1 qbank_managecategories-childlistcontainer">
|
|
|
72 |
{{#haschildren}}
|
|
|
73 |
{{> qbank_managecategories/childlist }}
|
|
|
74 |
{{/haschildren}}
|
|
|
75 |
</div>
|
|
|
76 |
</div>
|
|
|
77 |
</div>
|
|
|
78 |
</div>
|
|
|
79 |
</li>
|
|
|
80 |
{{#js}}
|
|
|
81 |
require(['qbank_managecategories/category'], function(component) {
|
|
|
82 |
component.init('#category-{{{categoryid}}}');
|
|
|
83 |
});
|
|
|
84 |
{{/js}}
|