Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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 row" id="{{id}}">
51
    <div class="form-label col-sm-3 text-sm-right">
52
        {{#customcontrol}}
53
            <p {{#labelfor}}id="{{labelfor}}_label"{{/labelfor}}>
54
                {{{title}}}
55
                {{#override}}
56
                    <div class="alert alert-info">{{override}}</div>
57
                {{/override}}
58
                {{#warning}}
59
                    <div class="alert alert-warning">{{warning}}</div>
60
                {{/warning}}
61
            </p>
62
        {{/customcontrol}}
63
        {{^customcontrol}}
64
            <label {{#labelfor}}for="{{labelfor}}"{{/labelfor}}>
65
                {{{title}}}
66
                {{#override}}
67
                    <div class="alert alert-info">{{override}}</div>
68
                {{/override}}
69
                {{#warning}}
70
                    <div class="alert alert-warning">{{warning}}</div>
71
                {{/warning}}
72
            </label>
73
        {{/customcontrol}}
74
        <span class="form-shortname d-block small text-muted">{{{name}}}</span>
75
    </div>
76
    <div class="form-setting col-sm-9">
77
        {{#error}}
78
            <div><span class="error">{{error}}</span></div>
79
        {{/error}}
80
        {{{element}}}
81
        {{#default}}
82
            <div class="form-defaultinfo text-muted {{#forceltr}}text-ltr{{/forceltr}}">{{{default}}}</div>
83
        {{/default}}
84
        <div class="form-description mt-3">{{{description}}}</div>
85
        {{#dependenton}}<div class="form-dependenton mb-4 text-muted">{{{.}}}</div>{{/dependenton}}
86
    </div>
87
</div>
88
{{#customcontrol}}
89
    {{#js}}
90
        require(['jquery'], function($) {
91
            $('#{{id}}_label').css('cursor', 'default');
92
            $('#{{id}}_label').click(function() {
93
                $('#{{id}}')
94
                    .find('button, a, input:not([type="hidden"]), select, textarea, [tabindex]')
95
                    .filter(':not([disabled]):not([tabindex="0"]):not([tabindex="-1"])')
96
                    .first().focus();
97
            });
98
        });
99
    {{/js}}
100
{{/customcontrol}}