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_form/element-passwordunmask
19
 
20
    Moodle passwordunmask form element template.
21
 
22
    The purpose of this template is to render a passwordunmask form element.
23
 
24
    Classes required for JS:
25
    * none
26
 
27
    Data attributes required for JS:
28
    * none
29
 
30
    Context variables required for this template:
31
    * element
32
        * id
33
        * name
34
        * value
35
        * size
36
 
37
    Example context (json):
38
    {
39
        "element": {
40
            "id": "example_password_unmask",
41
            "name": "example",
42
            "value": "Password1!",
43
            "size": 40
44
        }
45
    }
46
 
47
}}
48
{{< core_form/element-template }}
49
    {{$ element }}
50
        <div data-passwordunmask="wrapper" data-passwordunmaskid="{{ element.id }}">
51
            <div class="d-flex align-items-center">
52
                <span data-passwordunmask="editor">
53
                    <input  type="password"
54
                            {{# element.frozen }}readonly{{/ element.frozen }}
55
                            {{^ element.hardfrozen}} name="{{ element.name }}"{{/ element.hardfrozen }}
56
                            id="{{ element.id }}"
57
                            value="{{ element.value }}"
58
                            class="form-control d-none {{# error }}is-invalid{{/ error }}"
59
                            data-size="{{ element.size }}"
60
                            {{# error }}
61
                                autofocus aria-describedby="{{ element.iderror }}"
62
                            {{/ error }}
63
                            {{#required}}
64
                                aria-required="true"
65
                            {{/required}}
66
                            {{{ element.attributes }}}
67
                            >
68
                </span>
69
                {{^ element.frozen }}
70
                <a href="#" class="form-control" data-passwordunmask="edit" title="{{ edithint }}">
71
                {{/ element.frozen }}
72
                    <span data-passwordunmask="displayvalue">{{> core_form/element-passwordunmask-fill }}</span>
73
                {{^ element.frozen }}
74
                    {{# pix }} t/passwordunmask-edit, core, {{# str }} passwordunmaskedithint, form {{/ str }}{{/ pix }}
75
                </a>
76
                {{/ element.frozen }}
77
                <a href="#" class="btn btn-link icon-no-margin p-1 ml-1" data-passwordunmask="unmask" title="{{ unmaskhint }}">
78
                    {{# pix }} t/passwordunmask-reveal, core, {{# str }} passwordunmaskrevealhint, form {{/ str }}{{/ pix }}
79
                </a>
80
            </div>
81
            <span data-passwordunmask="instructions" class="form-text text-muted" style="display: none;">
82
                {{^ element.frozen }}
83
                {{# str }} passwordunmaskinstructions, form {{/ str }}
84
                {{/ element.frozen }}
85
            </span>
86
        </div>
87
    {{/ element }}
88
{{/ core_form/element-template }}
89
{{#js}}
90
require(['core_form/passwordunmask'], function(PasswordUnmask) {
91
    new PasswordUnmask("{{ element.id }}");
92
});
93
{{/ js }}