Sha256: ab7ce328bb8aa6e18e190c2e01b2313eddda8aac398de96968f4f33e7d2df531

Contents?: true

Size: 1.6 KB

Versions: 16

Compression:

Stored size: 1.6 KB

Contents

I"Y(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);
:ET

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
revelry_core-0.1.6.8 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.6.7 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.6.6 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.6.5 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.6.4 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.6.3 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.6.2 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.6.1 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.5 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.4 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.3 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.2 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.1 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.1.0 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.0.1 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache
revelry_core-0.0.0 test/dummy/tmp/cache/assets/development/sprockets/v3.0/DFJTDntGAFS0ivL1zJsFMtilieT83t0u5oyDbgb0SE4.cache