client/general: simplify input creation

This commit is contained in:
rr- 2016-06-08 22:51:15 +02:00
parent 07329d33a4
commit d445a4c93f
1 changed files with 6 additions and 17 deletions

View File

@ -94,38 +94,27 @@ function makeSelect(options) {
} }
function makeInput(options) { function makeInput(options) {
return _makeLabel(options) + options.value = options.value || '';
makeVoidElement( return _makeLabel(options) + makeVoidElement('input', options);
'input', {
type: options.inputType,
name: options.name,
id: options.id,
class: options.class,
value: options.value || '',
required: options.required,
pattern: options.pattern,
placeholder: options.placeholder,
readonly: options.readonly,
});
} }
function makeButton(options) { function makeButton(options) {
options.inputType = 'button'; options.type = 'button';
return makeInput(options); return makeInput(options);
} }
function makeTextInput(options) { function makeTextInput(options) {
options.inputType = 'text'; options.type = 'text';
return makeInput(options); return makeInput(options);
} }
function makePasswordInput(options) { function makePasswordInput(options) {
options.inputType = 'password'; options.type = 'password';
return makeInput(options); return makeInput(options);
} }
function makeEmailInput(options) { function makeEmailInput(options) {
options.inputType = 'email'; options.type = 'email';
return makeInput(options); return makeInput(options);
} }