<commit_before>define [
  'i18n!react_files'
  'underscore'
  'old_unsupported_dont_use_react'
  'old_unsupported_dont_use_react-router'
  'compiled/react/shared/utils/withReactDOM'
  'compiled/fn/preventDefault'
], (I18n, _, React, ReactRouter, withReactDOM, preventDefault) ->

  classSet = React.addons.classSet

  columns = [
    displayName: I18n.t('name', 'Name')
    property: 'name'
    className: 'ef-name-col'
  ,
    displayNameShort: I18n.t('created_at_short', 'Created')
    displayName: I18n.t('created_at', 'Date Created')
    property: 'created_at'
    className: 'ef-date-created-col'
  ,
    displayNameShort: I18n.t('updated_at_short', 'Modified')
    displayName: I18n.t('updated_at', 'Date Modified')
    property: 'updated_at'
    className: 'ef-date-modified-col'
  ,
    displayName: I18n.t('modified_by', 'Modified By')
    className: 'ef-modified-by-col'
    property: 'user'
  ,
    displayName: I18n.t('size', 'Size')
    property: 'size'
    className: 'ef-size-col'
  ,
    displayName: I18n.t('Usage Rights')
    property: 'usage_rights'
    className: 'ef-usage-rights-col'
  ]

  ColumnHeaders = React.createClass
    displayName: 'ColumnHeaders'

    propTypes:
      to: React.PropTypes.string.isRequired
      query: React.PropTypes.object.isRequired
      params: React.PropTypes.object.isRequired
      toggleAllSelected: React.PropTypes.func.isRequired
      areAllItemsSelected: React.PropTypes.func.isRequired
      splat: React.PropTypes.string

    getInitialState: ->
      return {
        hideToggleAll: true
      }

    queryParamsFor: (query, property) ->
      order = if ((query.sort || 'name') is property) and (query.order is 'desc')
        'asc'
      else
        'desc'
      _.defaults({sort: property, order: order}, query)

    render: withReactDOM ->
      sort = @props.query.sort or 'name'
      order = @props.query.order or 'asc'

      selectAllCheckboxClass = classSet({
        'screenreader-only': @state.hideToggleAll
      })

      selectAllLabelClass = classSet({
        'screenreader-only': !@state.hideToggleAll
      })

      header className:'ef-directory-header', role: 'row',
        div className: selectAllCheckboxClass, role: 'columnheader',
          span {className: selectAllLabelClass },
            I18n.t('select_all', 'Select All')
          input {
            className: selectAllCheckboxClass
            type: 'checkbox'
            onFocus: (event) => @setState({hideToggleAll: false})
            onBlur: (event) => @setState({hideToggleAll: true})
            checked: @props.areAllItemsSelected()
            onChange: (event) => @props.toggleAllSelected(event.target.checked)
          },

        columns.map (column) =>
          # don't show any usage rights related stuff to people that don't have the feature flag on
          return if (column.property is 'usage_rights') and !@props.usageRightsRequiredForContext

          isSortedCol = sort is column.property

          # This little bit is done so that we can get a dynamic key added into<commit_msg>change span to label for files "select all"<commit_after>define [
  'i18n!react_files'
  'underscore'
  'old_unsupported_dont_use_react'
  'old_unsupported_dont_use_react-router'
  'compiled/react/shared/utils/withReactDOM'
  'compiled/fn/preventDefault'
], (I18n, _, React, ReactRouter, withReactDOM, preventDefault) ->

  classSet = React.addons.classSet

  columns = [
    displayName: I18n.t('name', 'Name')
    property: 'name'
    className: 'ef-name-col'
  ,
    displayNameShort: I18n.t('created_at_short', 'Created')
    displayName: I18n.t('created_at', 'Date Created')
    property: 'created_at'
    className: 'ef-date-created-col'
  ,
    displayNameShort: I18n.t('updated_at_short', 'Modified')
    displayName: I18n.t('updated_at', 'Date Modified')
    property: 'updated_at'
    className: 'ef-date-modified-col'
  ,
    displayName: I18n.t('modified_by', 'Modified By')
    className: 'ef-modified-by-col'
    property: 'user'
  ,
    displayName: I18n.t('size', 'Size')
    property: 'size'
    className: 'ef-size-col'
  ,
    displayName: I18n.t('Usage Rights')
    property: 'usage_rights'
    className: 'ef-usage-rights-col'
  ]

  ColumnHeaders = React.createClass
    displayName: 'ColumnHeaders'

    propTypes:
      to: React.PropTypes.string.isRequired
      query: React.PropTypes.object.isRequired
      params: React.PropTypes.object.isRequired
      toggleAllSelected: React.PropTypes.func.isRequired
      areAllItemsSelected: React.PropTypes.func.isRequired
      splat: React.PropTypes.string

    getInitialState: ->
      return {
        hideToggleAll: true
      }

    queryParamsFor: (query, property) ->
      order = if ((query.sort || 'name') is property) and (query.order is 'desc')
        'asc'
      else
        'desc'
      _.defaults({sort: property, order: order}, query)

    render: withReactDOM ->
      sort = @props.query.sort or 'name'
      order = @props.query.order or 'asc'

      selectAllCheckboxClass = classSet({
        'screenreader-only': @state.hideToggleAll
      })

      selectAllLabelClass = classSet({
        'screenreader-only': !@state.hideToggleAll
      })

      header className:'ef-directory-header', role: 'row',
        div className: selectAllCheckboxClass, role: 'columnheader',
          label {htmlFor: "selectAllCheckbox", className: selectAllLabelClass },
            I18n.t('select_all', 'Select All')
          input {
            id: "selectAllCheckbox"
            className: selectAllCheckboxClass
            type: 'checkbox'
            onFocus: (event) => @setState({hideToggleAll: false})
            onBlur: (event) => @setState({hideToggleAll: true})
            checked: @props.areAllItemsSelected()
            onChange: (event) => @props.toggleAllSelected(event.target.checked)
          },

        columns.map (column) =>
          # don't show any usage rights related stuff to people that don't have the feature flag on
          return if (column.property is 'usage_rights') and !@props.usageRightsRequiredForContext

          isSortedCol = sort is column.property

          # This little bit is done so that we can get a dynamic key added into
{'fraction_non_alphanumeric': 0.11915098890496864, 'fraction_numerical': 0.007075092458594629, 'mean_word_length': 2.94169835234474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '4668415', 'n_tokens_mistral': 1947, 'n_tokens_neox': 1894, 'n_words': 416}