Sha256: 6e832cc7fa151a551921b07b84576e39253b5f0bf322d607cc46248fadba9391

Contents?: true

Size: 1.3 KB

Versions: 8

Compression:

Stored size: 1.3 KB

Contents

(function() {
  Rev.registerComponent('CollectionSelectBox', {
    getDefaultProps: function() {
      var props;
      return props = {
        collection: new Backbone.Collection(),
        modelToKey: function(model) {
          return model.id;
        },
        modelToValue: function(model) {
          return model.id;
        },
        modelToChildContent: function(model) {
          return model.id;
        },
        onChange: function(e) {},
        selectBoxClassName: "RevCollectionSelectBox",
        optionClassName: "RevCollectionSelectBox-option"
      };
    },
    onChange: function(e) {
      e.model = this.props.collection.get(e.currentTarget.value);
      return this.props.onChange(e);
    },
    render: function() {
      return this.transferPropsTo(React.createElement("select", {
        "className": this.props.selectBoxClassName,
        "onChange": this.onChange
      }, this.props.collection.map((function(_this) {
        return function() {
          return _this.renderOption.apply(_this, arguments);
        };
      })(this))));
    },
    renderOption: function(model) {
      return React.createElement("option", {
        "key": this.props.modelToKey(model),
        "value": this.props.modelToValue(model)
      }, this.props.modelToChildContent(model));
    }
  });

}).call(this);

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
revelry_core-0.1.12.4 spec/dummy/tmp/jasmine/assets/revelry/ui/forms/CollectionSelectBox.self.js
revelry_core-0.1.12.2 spec/dummy/tmp/jasmine/assets/revelry/ui/forms/CollectionSelectBox.self.js
revelry_core-0.1.11.6 spec/dummy/tmp/jasmine/assets/revelry/ui/forms/CollectionSelectBox.self.js
revelry_core-0.1.10.1 spec/dummy/tmp/jasmine/assets/revelry/ui/forms/CollectionSelectBox.self.js
revelry_core-0.1.10.0 spec/dummy/tmp/jasmine/assets/revelry/ui/forms/CollectionSelectBox.self.js
revelry_core-0.1.9.1 spec/dummy/tmp/jasmine/assets/revelry/ui/forms/CollectionSelectBox.self.js
revelry_core-0.1.9.0 spec/dummy/tmp/jasmine/assets/revelry/ui/forms/CollectionSelectBox.self.js
revelry_core-0.1.8.0 spec/dummy/tmp/jasmine/assets/revelry/ui/forms/CollectionSelectBox.self.js