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 |
<form action="{{{legacyseturl}}}" method="post" class="d-flex align-items-center editmode-switch-form d-print-none">
|
|
|
35 |
<div class="input-group">
|
|
|
36 |
<div class="custom-control custom-control--xs custom-switch mx-0">
|
|
|
37 |
<input type="checkbox"{{!
|
|
|
38 |
}} name="setmode"{{!
|
|
|
39 |
}}{{#checked}}{{!
|
|
|
40 |
}} checked{{!
|
|
|
41 |
}}{{/checked}}{{!
|
|
|
42 |
}} class="custom-control-input custom-control-input--xs"{{!
|
|
|
43 |
}} id="{{uniqid}}-editingswitch"{{!
|
|
|
44 |
}} data-context="{{{pagecontextid}}}"{{!
|
|
|
45 |
}} data-pageurl="{{{pageurl}}}"{{!
|
|
|
46 |
}}>
|
|
|
47 |
<label class="mx-0 mr-md-2 mb-0 custom-control-label" for="{{uniqid}}-editingswitch">
|
|
|
48 |
{{#str}} editmode {{/str}}
|
|
|
49 |
</label>
|
|
|
50 |
</div>
|
|
|
51 |
</div>
|
|
|
52 |
<input type="hidden" name="sesskey" value="{{{sesskey}}}">
|
|
|
53 |
<input type="hidden" name="pageurl" value="{{{pageurl}}}">
|
|
|
54 |
<input type="hidden" name="context" value="{{{pagecontextid}}}">
|
|
|
55 |
<noscript>
|
|
|
56 |
<input type="submit" value="{{#str}}setmode, core{{/str}}">
|
|
|
57 |
</noscript>
|
|
|
58 |
<a href="#" id="showBlockArea" class="btn mx-0 p-1">
|
|
|
59 |
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 6H10V4H4V10H6V6Z" fill="currentColor" /><path d="M10 18H6V14H4V20H10V18Z" fill="currentColor" /><path d="M14 6H18V10H20V4H14V6Z" fill="currentColor" /><path d="M14 18H18V14H20V20H14V18Z" fill="currentColor" /><path d="M12 8.5C10.067 8.5 8.5 10.067 8.5 12C8.5 13.933 10.067 15.5 12 15.5C13.933 15.5 15.5 13.933 15.5 12C15.5 10.067 13.933 8.5 12 8.5Z" fill="currentColor" /></svg>
|
|
|
60 |
</a>
|
|
|
61 |
</form>
|
|
|
62 |
{{#js}}
|
|
|
63 |
require(['core/edit_switch'], function(editSwitch) {
|
|
|
64 |
editSwitch.init('{{uniqid}}-editingswitch');
|
|
|
65 |
});
|
|
|
66 |
{{/js}}
|