MDL-55657 theme_noname: Use a separate template for passwordunmask

Part of MDL-55071
This commit is contained in:
Andrew Nicols
2016-09-23 10:55:14 +01:00
committed by Dan Poltawski
parent 31d288cfa5
commit 2c3a6e2479
3 changed files with 24 additions and 9 deletions
+1
View File
@@ -65,6 +65,7 @@ class MoodleQuickForm_passwordunmask extends MoodleQuickForm_password {
}
parent::__construct($elementName, $elementLabel, $attributes);
$this->setType('passwordunmask');
}
/**
@@ -12,12 +12,3 @@
{{/error}} {{{attributes}}}>
{{/element}}
{{/ core_form/element-template }}
{{#js}}
require(['core/yui'], function(Y) {
Y.use('moodle-form-passwordunmask', function() {
M.form.passwordunmask({ formid: {{#quote}}{{element.id}}{{/quote}},
checkboxlabel: {{#quote}}{{#str}}unmaskpassword, form{{/str}}{{/quote}},
checkboxname: {{#quote}}{{element.name}}{{/quote}} });
});
});
{{/js}}
@@ -0,0 +1,23 @@
{{< core_form/element-template }}
{{$element}}
<input type="password"
{{#element.frozen}}readonly{{/element.frozen}}
class="form-control {{#error}}form-control-danger{{/error}}"
name="{{element.name}}"
id="{{element.id}}"
value="{{element.value}}"
size="{{element.size}}"
{{#error}}
autofocus aria-describedby="id_error_{{element.name}}"
{{/error}} {{{attributes}}}>
{{/element}}
{{/ core_form/element-template }}
{{#js}}
require(['core/yui'], function(Y) {
Y.use('moodle-form-passwordunmask', function() {
M.form.passwordunmask({ formid: {{#quote}}{{element.id}}{{/quote}},
checkboxlabel: {{#quote}}{{#str}}unmaskpassword, form{{/str}}{{/quote}},
checkboxname: {{#quote}}{{element.name}}{{/quote}} });
});
});
{{/js}}