Merge branch 'MDL-77272-main' of https://github.com/SergioComeron/moodle
[moodle.git] / lib / templates / editswitch.mustache
blobe20f2d9411c82df28a0c7aa5d531d5270d4b5972
1 {{!
2     This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
17 {{!
19     @template core/editswitch
21     This template renders the top navbar.
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     }
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">&nbsp;</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}}