1 |
efrain |
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 |
|
|
|
19 |
@template core/editswitch
|
|
|
20 |
|
|
|
21 |
This template renders the top navbar.
|
|
|
22 |
|
|
|
23 |
Example context (json):
|
|
|
24 |
{
|
|
|
25 |
"url": "http://localhost/",
|
|
|
26 |
"sesskey": "sesskey",
|
|
|
27 |
"edit": 1,
|
|
|
28 |
"adminedit": true,
|
|
|
29 |
"checked": "",
|
|
|
30 |
"string": "Edit on",
|
|
|
31 |
"legacyseturl": "/editmode.php"
|
|
|
32 |
}
|
|
|
33 |
}}
|
|
|
34 |
<div class="divider border-left h-75 align-self-center ml-1 mr-3"></div>
|
|
|
35 |
<form action="{{{legacyseturl}}}" method="post" class="d-flex align-items-center editmode-switch-form">
|
|
|
36 |
<div class="input-group">
|
|
|
37 |
<label class="mr-2 mb-0 {{#checked}}text-primary{{/checked}}" for="{{uniqid}}-editingswitch">
|
|
|
38 |
{{#str}} editmode {{/str}}
|
|
|
39 |
</label>
|
|
|
40 |
<div class="custom-control custom-switch">
|
|
|
41 |
<input type="checkbox"{{!
|
|
|
42 |
}} name="setmode"{{!
|
|
|
43 |
}}{{#checked}}{{!
|
|
|
44 |
}} checked{{!
|
|
|
45 |
}}{{/checked}}{{!
|
|
|
46 |
}} class="custom-control-input"{{!
|
|
|
47 |
}} id="{{uniqid}}-editingswitch"{{!
|
|
|
48 |
}} data-context="{{{pagecontextid}}}"{{!
|
|
|
49 |
}} data-pageurl="{{{pageurl}}}"{{!
|
|
|
50 |
}}>
|
|
|
51 |
<span class="custom-control-label"> </span>
|
|
|
52 |
</div>
|
|
|
53 |
</div>
|
|
|
54 |
<input type="hidden" name="sesskey" value="{{{sesskey}}}">
|
|
|
55 |
<input type="hidden" name="pageurl" value="{{{pageurl}}}">
|
|
|
56 |
<input type="hidden" name="context" value="{{{pagecontextid}}}">
|
|
|
57 |
<noscript>
|
|
|
58 |
<input type="submit" value="{{#str}}setmode, core{{/str}}">
|
|
|
59 |
</noscript>
|
|
|
60 |
</form>
|
|
|
61 |
{{#js}}
|
|
|
62 |
require(['core/edit_switch'], function(editSwitch) {
|
|
|
63 |
editSwitch.init('{{uniqid}}-editingswitch');
|
|
|
64 |
});
|
|
|
65 |
{{/js}}
|