<commit_before>'use strict';

var React = require('react');
var SingleSelect2 = require('./SingleSelect2.react');

var SpecSectionPicker = React.createClass({
  getInitialState() {
    return{
      value: this.props.value || [''],
      secondPicker: false
    };
  },
  _onSelect(item) {
    console.log('onSelect');
  },
  _getLabel(item) {
    if (Object.keys(item).length === 0) return null;
    return (item.number + "-" + item.description);
  },
  _togglePickers() {
    this.setState({
      secondPicker: !this.state.secondPicker
    });
  },
  render() {
    return(
      <div>
        {this.props.editable ? this.renderSelect() : this.renderLabel()}
      </div>
    );
  },
  renderSelect() {
    return(
      <div className='inline-block padded-children'>
        <SingleSelect2 
          collection={this.props.data}
          value={this.props.value}
          getLabel={this._getLabel}
          onSelect={this._onSelect}
          editable={this.props.editable}
        />
      </div>
    );
  },
  renderLabel(name) {
    return(<label>{name}</label>);
  },
  renderOtherPicker() {
    if(this.state.secondPicker) { 
      return(
        <div>
          <SingleSelect2 
              collection={this.props.data}
              value={this.props.value}
              getLabel={this._getLabel}
              onSelect={this._onSelect}
              editable={this.props.editable}/>
        </div>
      );
    } else return ('');
  }
});

module.exports = SpecSectionPicker;

<commit_msg>Mapping Over Specs in View Mode<commit_after>'use strict';

var React = require('react');
var SingleSelect2 = require('./SingleSelect2.react');
var _ = require('underscore');

var SpecSectionPicker = React.createClass({
  getInitialState() {
    return{
      value: this.props.value || [''],
      secondPicker: false
    };
  },
  _onSelect(item) {
    console.log('onSelect');
  },
  _getLabel(item) {
    if (Object.keys(item).length === 0) return null;
    return (item.number + "-" + item.description);
  },
  _togglePickers() {
    this.setState({
      secondPicker: !this.state.secondPicker
    });
  },
  render() {
    return(
      <div>
        {this.props.editable ? this.renderSelect() : this.renderLabels()}
      </div>
    );
  },
  renderSelect() {
    return(
      <div className='inline-block padded-children'>
        <SingleSelect2 
          collection={this.props.data}
          value={this.props.value}
          getLabel={this._getLabel}
          onSelect={this._onSelect}
          editable={this.props.editable}
        />
      </div>
    );
  },
  renderLabels() {
    var collection = this.props.data;
    var specs = _.each(collection, function(spec) { 
      return <label>{this._getLabel(spec)}</label> 
    }.bind(this));
    return specs;
  },
  renderOtherPicker() {
    if(this.state.secondPicker) { 
      return(
        <div>
          <SingleSelect2 
              collection={this.props.data}
              value={this.props.value}
              getLabel={this._getLabel}
              onSelect={this._onSelect}
              editable={this.props.editable}/>
        </div>
      );
    } else return ('');
  }
});

module.exports = SpecSectionPicker;


{'fraction_non_alphanumeric': 0.15336658354114713, 'fraction_numerical': 0.003117206982543641, 'mean_word_length': 2.238143289606458, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4036432', 'n_tokens_mistral': 998, 'n_tokens_neox': 983, 'n_words': 154}