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 |
@template core_admin/setting
|
|
|
19 |
|
|
|
20 |
Admin setting template.
|
|
|
21 |
|
|
|
22 |
Context variables required for this template:
|
|
|
23 |
* labelfor - id of the form element
|
|
|
24 |
* title - Setting title
|
|
|
25 |
* override - Overridden message
|
|
|
26 |
* warning - Warning message
|
|
|
27 |
* name - Setting name
|
|
|
28 |
* error - Error message
|
|
|
29 |
* element - The Element HTML
|
|
|
30 |
* forceltr - Force this element to be displayed LTR
|
|
|
31 |
* default - Default value
|
|
|
32 |
* dependenton - optional message listing the settings this one is dependent on
|
|
|
33 |
|
|
|
34 |
Example context (json):
|
|
|
35 |
{
|
|
|
36 |
"title": "Setting title",
|
|
|
37 |
"labelfor": "id0",
|
|
|
38 |
"override": "Overidden",
|
|
|
39 |
"warning": "Warning",
|
|
|
40 |
"name": "Name",
|
|
|
41 |
"error": "Error",
|
|
|
42 |
"element": "Raw HTML",
|
|
|
43 |
"forceltr": false,
|
|
|
44 |
"default": "Default value"
|
|
|
45 |
}
|
|
|
46 |
}}
|
|
|
47 |
{{!
|
|
|
48 |
Setting.
|
|
|
49 |
}}
|
|
|
50 |
<div class="form-item rui-settings-item" id="{{id}}">
|
|
|
51 |
<div class="form-label rui-settings-label">
|
|
|
52 |
{{#customcontrol}}
|
|
|
53 |
<p class="d-inline-flex" {{#labelfor}}id="{{labelfor}}_label"{{/labelfor}}>
|
|
|
54 |
{{{title}}}
|
|
|
55 |
{{#override}}
|
|
|
56 |
<div class="mx-2 badge badge-info">{{override}}</div>
|
|
|
57 |
{{/override}}
|
|
|
58 |
{{#warning}}
|
|
|
59 |
<div class="mx-2 badge badge-warning">{{warning}}</div>
|
|
|
60 |
{{/warning}}
|
|
|
61 |
</p>
|
|
|
62 |
{{/customcontrol}}
|
|
|
63 |
{{^customcontrol}}
|
|
|
64 |
<label class="d-inline-flex" {{#labelfor}}for="{{labelfor}}"{{/labelfor}}>
|
|
|
65 |
{{{title}}}
|
|
|
66 |
{{#override}}
|
|
|
67 |
<div class="mx-2 badge badge-info">{{override}}</div>
|
|
|
68 |
{{/override}}
|
|
|
69 |
{{#warning}}
|
|
|
70 |
<div class="mx-2 badge badge-warning">{{warning}}</div>
|
|
|
71 |
{{/warning}}
|
|
|
72 |
</label>
|
|
|
73 |
{{/customcontrol}}
|
|
|
74 |
<span class="d-inline-flex form-shortname rui-settings-shortname ml-3">{{{name}}}</span>
|
|
|
75 |
</div>
|
|
|
76 |
<div class="form-setting rui-settings-setting">
|
|
|
77 |
<div class="d-inline-flex flex-wrap align-items-center w-100">
|
|
|
78 |
{{#error}}
|
|
|
79 |
<div><span class="error">{{error}}</span></div>
|
|
|
80 |
{{/error}}
|
|
|
81 |
{{{element}}}
|
|
|
82 |
{{#default}}
|
|
|
83 |
<div class="form-defaultinfo badge-sq badge-primary mx-1 my-1 {{#forceltr}}text-ltr{{/forceltr}}">{{{default}}}</div>
|
|
|
84 |
{{/default}}
|
|
|
85 |
</div>
|
|
|
86 |
<div class="form-description mt-2">{{{description}}}</div>
|
|
|
87 |
{{#dependenton}}<div class="form-dependenton badge badge-xs badge-warning mt-2 mb-2">{{{.}}}</div>{{/dependenton}}
|
|
|
88 |
</div>
|
|
|
89 |
</div>
|
|
|
90 |
{{#customcontrol}}
|
|
|
91 |
{{#js}}
|
|
|
92 |
require(['jquery'], function($) {
|
|
|
93 |
$('#{{id}}_label').css('cursor', 'default');
|
|
|
94 |
$('#{{id}}_label').click(function() {
|
|
|
95 |
$('#{{id}}')
|
|
|
96 |
.find('button, a, input:not([type="hidden"]), select, textarea, [tabindex]')
|
|
|
97 |
.filter(':not([disabled]):not([tabindex="0"]):not([tabindex="-1"])')
|
|
|
98 |
.first().focus();
|
|
|
99 |
});
|
|
|
100 |
});
|
|
|
101 |
{{/js}}
|
|
|
102 |
{{/customcontrol}}
|