Sha256: f7e29b9e2573f6914d9ee8ec29d59a4196926916220d013e23272c4addfd4544

Contents?: true

Size: 1.6 KB

Versions: 57

Compression:

Stored size: 1.6 KB

Contents

I"V(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

57 entries across 52 versions & 2 rubygems

Version Path
revelry_data-0.0.15 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.1.5 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.1.4 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.0.14 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.0.8.1 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.0.13 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.1.3 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.0.12 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.1.2 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.1.1 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.0.10 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.1.0 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.0.8 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_core-0.1.12.4 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_core-0.1.12.2 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_data-0.0.7 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_core-0.1.11.6 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_core-0.1.11.5 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_core-0.1.11.2 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache
revelry_core-0.1.11.1 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d0GAB4H_XpaThdIDYv0LMmaDsBm66BIuQnqymgVYVfs.cache