<commit_before>class App.SearchableSelect extends Spine.Controller

  events:
    'input .js-input':       'onInput'
    'blur .js-input':        'onBlur'
    'focus .js-input':       'onFocus'
    'focus .js-shadow':      'onShadowFocus'
    'click .js-option':      'selectItem'
    'click .js-enter':       'navigateIn'
    'click .js-back':        'navigateOut'
    'mouseenter .js-option': 'highlightItem'
    'mouseenter .js-enter':  'highlightItem'
    'mouseenter .js-back':   'highlightItem'
    'shown.bs.dropdown':     'onDropdownShown'
    'hidden.bs.dropdown':    'onDropdownHidden'
    'keyup .js-input':       'onKeyUp'

  elements:
    '.js-dropdown': 'dropdown'
    '.js-option, .js-enter': 'optionItems'
    '.js-input': 'input'
    '.js-shadow': 'shadowInput'
    '.js-optionsList': 'optionsList'
    '.js-optionsSubmenu': 'optionsSubmenu'
    '.js-autocomplete-invisible': 'invisiblePart'
    '.js-autocomplete-visible': 'visiblePart'

  className: 'searchableSelect dropdown dropdown--actions'

  element: =>
    @el

  constructor: ->
    super
    @render()

  render: ->
    firstSelected = _.find @attribute.options, (option) -> option.selected

    if firstSelected
      @attribute.valueName = firstSelected.name
      @attribute.value = firstSelected.value
    else if @attribute.unknown && @attribute.value
      @attribute.valueName = @attribute.value
    else if @hasSubmenu @attribute.options
      @attribute.valueName = @getName @attribute.value, @attribute.options

    @html App.view('generic/searchable_select')
      attribute: @attribute<commit_msg>Refactoring: Improved code layout.<commit_after>class App.SearchableSelect extends Spine.Controller

  events:
    'input .js-input':       'onInput'
    'blur .js-input':        'onBlur'
    'focus .js-input':       'onFocus'
    'focus .js-shadow':      'onShadowFocus'
    'click .js-option':      'selectItem'
    'click .js-enter':       'navigateIn'
    'click .js-back':        'navigateOut'
    'mouseenter .js-option': 'highlightItem'
    'mouseenter .js-enter':  'highlightItem'
    'mouseenter .js-back':   'highlightItem'
    'shown.bs.dropdown':     'onDropdownShown'
    'hidden.bs.dropdown':    'onDropdownHidden'
    'keyup .js-input':       'onKeyUp'

  elements:
    '.js-dropdown':               'dropdown'
    '.js-option, .js-enter':      'optionItems'
    '.js-input':                  'input'
    '.js-shadow':                 'shadowInput'
    '.js-optionsList':            'optionsList'
    '.js-optionsSubmenu':         'optionsSubmenu'
    '.js-autocomplete-invisible': 'invisiblePart'
    '.js-autocomplete-visible':   'visiblePart'

  className: 'searchableSelect dropdown dropdown--actions'

  element: =>
    @el

  constructor: ->
    super
    @render()

  render: ->
    firstSelected = _.find @attribute.options, (option) -> option.selected

    if firstSelected
      @attribute.valueName = firstSelected.name
      @attribute.value = firstSelected.value
    else if @attribute.unknown && @attribute.value
      @attribute.valueName = @attribute.value
    else if @hasSubmenu @attribute.options
      @attribute.valueName = @getName @attribute.value, @attribute.options

    @html App.view('generic/searchable_select')
      attribute: @attribute
{'fraction_non_alphanumeric': 0.13944954128440368, 'fraction_numerical': 0.0, 'mean_word_length': 2.7086167800453516, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5711421', 'n_tokens_mistral': 1028, 'n_tokens_neox': 996, 'n_words': 200}