Sha256: a5b6b77ca8c425f2c6aa4985a5cdccd02e98cd0a7493f319945eb51cca459c6e
Contents?: true
Size: 1.58 KB
Versions: 8
Compression:
Stored size: 1.58 KB
Contents
(function() { Rev.appMixin('ModelInputMixin', { componentDidMount: function() { return this.props.model.set(this.props.field, this.defaultValue()); }, defaultValue: function() { return this.props.defaultValue || this.value(); }, value: function() { var ref; if (((ref = this.props.model) != null ? ref.get : void 0) != null) { return this.props.model.get(this.props.field); } }, klass: function() { return _.str.underscored(this.props.model.constructor.name); }, name: function() { return this.props.name || ((this.props.baseName || this.klass()) + "[" + this.props.field + "]"); }, isCheckbox: function() { return this.props.type === 'checkbox'; }, onFieldChange: function(e) { if (this.isCheckbox()) { this.props.model.set(this.props.field, e.target.checked); } else { this.props.model.set(this.props.field, e.target.value); } if (this.props.onChange != null) { return this.props.onChange(e); } }, onBlur: function(e) { var error, response, validator; validator = this.props.model["validate" + (_.str.classify(this.props.field))]; if (validator != null) { error = validator.bind(this.props.model)(); if (error) { response = { responseJSON: { errors: {} } }; response.responseJSON.errors[this.props.field] = [error]; return this.props.model.trigger('error', this.props.model, response, {}); } } } }); }).call(this);
Version data entries
8 entries across 8 versions & 1 rubygems