4 |
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 block_point_view/enabledisable
|
|
|
19 |
|
|
|
20 |
Classes required for JS:
|
|
|
21 |
* enable-disable
|
|
|
22 |
* reactions
|
|
|
23 |
|
|
|
24 |
Data attributes required for JS:
|
|
|
25 |
* data-enable
|
|
|
26 |
|
|
|
27 |
Context variables required for this template:
|
|
|
28 |
* helpbutton HTML fragment for help button.
|
|
|
29 |
* enablename id attribute for enable button.
|
|
|
30 |
* enablelabel Label of enable button.
|
|
|
31 |
* disablename id attribute for disable button.
|
|
|
32 |
* disablelabel Label of disable button.
|
|
|
33 |
* datattr HTML data attributes for both buttons.
|
|
|
34 |
|
|
|
35 |
Example context (json):
|
|
|
36 |
{
|
|
|
37 |
"helpbutton": "<span></span>",
|
|
|
38 |
"enablename": "enable_type_quiz",
|
|
|
39 |
"enablelabel": "Enable all Quizzes",
|
|
|
40 |
"disablename": "disable_type_quiz",
|
|
|
41 |
"disablelabel": "Disable all Quizzes",
|
|
|
42 |
"dataattr": ""
|
|
|
43 |
}
|
|
|
44 |
}}
|
|
|
45 |
<span class="enable-disable reactions">
|
|
|
46 |
{{{helpbutton}}}
|
|
|
47 |
<button id="{{enablename}}" class="btn btn-outline-success mr-1" type="button" data-enable="1" {{{dataattr}}}>{{{enablelabel}}}</button>
|
|
|
48 |
<button id="{{disablename}}" class="btn btn-outline-danger" type="button" data-enable="0" {{{dataattr}}}>{{{disablelabel}}}</button>
|
|
|
49 |
</span>
|