<commit_before>_     = require 'underscore'
React = require 'react'
BS    = require 'react-bootstrap'
classnames = require 'classnames'

Icon = require './icon'

MultiSelect = React.createClass

  propTypes:
    title:      React.PropTypes.string.isRequired
    className:  React.PropTypes.string
    selections: React.PropTypes.arrayOf(
      React.PropTypes.shape(
        id:       React.PropTypes.string
        title:    React.PropTypes.string
        selected: React.PropTypes.bool
      )
    ).isRequired
    onOnlySelection: React.PropTypes.func
    onSelect: React.PropTypes.func

  toggleOnly: (ev) ->
    ev.preventDefault()
    ev.stopPropagation()
    @props.onOnlySelection(ev.target.getAttribute('data-id'))

  onSelect: (ev, selection) ->
    @props.onSelect?( _.findWhere(@props.selections, id: selection))

  renderMenuSelection: (selection) ->
    if @props.onOnlySelection
      onlyToggle = <span className="only" data-id={selection.id} onClick={@toggleOnly}>only</span>

    <BS.MenuItem key={selection.id} eventKey={selection.id}>
      <Icon type={if selection.selected then 'check-square-o' else 'square-o'} />
      <span className="title">{selection.title}</span>
      {onlyToggle}
    </BS.MenuItem>

  render: ->
    classNames = classnames('multi-select', @props.className)
    <BS.DropdownButton
      navItem={@props.navItem}
      className={classNames}
      id='multi-select'
      onSelect={@onSelect}
      title={@props.title}
    >
      {@renderMenuSelection(selection) for selection in @props.selections}
    </BS.DropdownButton>



module.exports = MultiSelect
<commit_msg>navItem prop isn't a thing any longer<commit_after>_     = require 'underscore'
React = require 'react'
BS    = require 'react-bootstrap'
classnames = require 'classnames'

Icon = require './icon'

MultiSelect = React.createClass

  propTypes:
    title:      React.PropTypes.string.isRequired
    className:  React.PropTypes.string
    selections: React.PropTypes.arrayOf(
      React.PropTypes.shape(
        id:       React.PropTypes.string
        title:    React.PropTypes.string
        selected: React.PropTypes.bool
      )
    ).isRequired
    onOnlySelection: React.PropTypes.func
    onSelect: React.PropTypes.func

  toggleOnly: (ev) ->
    ev.preventDefault()
    ev.stopPropagation()
    @props.onOnlySelection(ev.target.getAttribute('data-id'))

  onSelect: (ev, selection) ->
    @props.onSelect?( _.findWhere(@props.selections, id: selection))

  renderMenuSelection: (selection) ->
    if @props.onOnlySelection
      onlyToggle = <span className="only" data-id={selection.id} onClick={@toggleOnly}>only</span>

    <BS.MenuItem key={selection.id} eventKey={selection.id}>
      <Icon type={if selection.selected then 'check-square-o' else 'square-o'} />
      <span className="title">{selection.title}</span>
      {onlyToggle}
    </BS.MenuItem>

  render: ->
    classNames = classnames('multi-select', @props.className)
    <BS.DropdownButton
      className={classNames}
      id='multi-select'
      onSelect={@onSelect}
      title={@props.title}
    >
      {@renderMenuSelection(selection) for selection in @props.selections}
    </BS.DropdownButton>



module.exports = MultiSelect

{'fraction_non_alphanumeric': 0.1301518438177874, 'fraction_numerical': 0.0, 'mean_word_length': 3.3097463284379174, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 29, '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': '235922', 'n_tokens_mistral': 979, 'n_tokens_neox': 981, 'n_words': 183}