From d445a4c93ffb47943e07b223752bc905d18c57ca Mon Sep 17 00:00:00 2001 From: rr- Date: Wed, 8 Jun 2016 22:51:15 +0200 Subject: [PATCH] client/general: simplify input creation --- client/js/util/views.js | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/client/js/util/views.js b/client/js/util/views.js index 0389616..e5e3033 100644 --- a/client/js/util/views.js +++ b/client/js/util/views.js @@ -94,38 +94,27 @@ function makeSelect(options) { } function makeInput(options) { - return _makeLabel(options) + - makeVoidElement( - '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, - }); + options.value = options.value || ''; + return _makeLabel(options) + makeVoidElement('input', options); } function makeButton(options) { - options.inputType = 'button'; + options.type = 'button'; return makeInput(options); } function makeTextInput(options) { - options.inputType = 'text'; + options.type = 'text'; return makeInput(options); } function makePasswordInput(options) { - options.inputType = 'password'; + options.type = 'password'; return makeInput(options); } function makeEmailInput(options) { - options.inputType = 'email'; + options.type = 'email'; return makeInput(options); }