From 1fff14f0a5e25adaa851537c71c7bd8381c1bbb1 Mon Sep 17 00:00:00 2001 From: Koren Lev Date: Mon, 2 Oct 2017 11:37:03 +0300 Subject: ui move to docker Change-Id: Iff31ebb3fff782e848704801b7800fdf480264a1 Signed-off-by: Koren Lev (cherry picked from commit a9691f5fe78af32c474754f841a71a68e2d2a484) --- ui/imports/ui/components/mt-input/mt-input.js | 106 -------------------------- 1 file changed, 106 deletions(-) delete mode 100644 ui/imports/ui/components/mt-input/mt-input.js (limited to 'ui/imports/ui/components/mt-input/mt-input.js') diff --git a/ui/imports/ui/components/mt-input/mt-input.js b/ui/imports/ui/components/mt-input/mt-input.js deleted file mode 100644 index 729adb9..0000000 --- a/ui/imports/ui/components/mt-input/mt-input.js +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Template Component: MtInput - */ - -//import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import * as R from 'ramda'; -//import { ReactiveDict } from 'meteor/reactive-dict'; - -import './mt-input.html'; - -/* - * Lifecycles - */ - -Template.MtInput.onCreated(function() { - let instance = this; - - instance.autorun(function () { - let data = Template.currentData(); - - //simple schema does not support input value type of: number or string together. - data = R.dissoc('inputValue', data); - - instance.autorun(function () { - new SimpleSchema({ - inputType: { type: String }, - classStr: { type: String, optional: true }, - placeholder: { type: String, optional: true }, - isDisabled: { type: Boolean, optional: true }, - onInput: { type: Object, blackbox: true }, - }).validate(data); - }); - }); - - instance.autorun(function () { - let data = Template.currentData(); - - instance.onInput = function (value) { - R.when(R.pipe(R.isNil, R.not), x => x(value))(R.path(['onInput', 'fn'], data)); - }; - }); -}); - -/* -Template.MtInput.rendered = function() { -}; -*/ - -/* - * Events - */ - -Template.MtInput.events({ - 'input .input-field': function (event, instance) { - if (event.target.type === 'checkbox') { return; } - - let value = R.cond([ - [R.equals('number'), R.always(event.target.valueAsNumber)], - [R.T, R.always(event.target.value)], - ])(event.target.type); - - instance.onInput(value); - }, - - 'click .input-field': function (event, instance) { - if (event.target.type !== 'checkbox') { return; } - - let element = instance.$('.input-field')[0]; - instance.onInput(element.checked); - } -}); - -/* - * Helpers - */ - -Template.MtInput.helpers({ - attrsInput: function (inputType, placeholder, isDisabled) { - let attrs = {}; - - if (hasPlaceholder(inputType, placeholder)) { - attrs = R.assoc('placeholder', placeholder, attrs); - } - - if (isDisabled) { - attrs = R.assoc('disabled', 'disabled', attrs); - } - - return attrs; - }, - -}); // end: helpers - -function hasPlaceholder(inputType, placeholder) { - if (R.contains(inputType, ['checkbox', 'select'])) { - return false; - } - - if (R.isNil(placeholder)) { - return false; - } - - return true; -} -- cgit 1.2.3-korg