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/>.
18 @template core_form/element-passwordunmask
20 Moodle passwordunmask form element template.
22 The purpose of this template is to render a passwordunmask form element.
24 Classes required for JS:
27 Data attributes required for JS:
30 Context variables required for this template:
37 Example context (json):
40 "id": "example_password_unmask",
42 "value": "Password1!",
48 {{< core_form/element-template }}
50 <div data-passwordunmask="wrapper" data-passwordunmaskid="{{ element.id }}">
51 <span data-passwordunmask="editor">
52 <!-- The input in the noscript will be moved here as part of the page load -->
53 <span data-passwordunmask="instructions" class="editinstructions">
55 {{# str }} passwordunmaskinstructions, form {{/ str }}
59 {{# element.frozen }}readonly{{/ element.frozen }}
60 {{^ element.hardfrozen}} name="{{ element.name }}"{{/ element.hardfrozen }}
62 value="{{element.value }}"
63 data-size="{{ element.size }}"
65 autofocus aria-describedby="id_error_{{ element.name }}"
71 <a href="#" data-passwordunmask="edit" title="{{ edithint }}">
73 <span data-passwordunmask="displayvalue">{{> core_form/element-passwordunmask-fill }}</span>
75 {{# pix }} t/passwordunmask-edit, core, {{ edithint }}{{/ pix }}
78 <a href="#" data-passwordunmask="unmask" title="{{ unmaskhint }}">
79 {{# pix }} t/passwordunmask-reveal, core, {{ edithint }}{{/ pix }}
83 {{/ core_form/element-template }}
85 require(['core_form/passwordunmask'], function(PasswordUnmask) {
86 new PasswordUnmask("{{ element.id }}");