<commit_before>Wheelmap.ToolbarView = Ember.View.extend
  classNames: 'toolbar'
  templateName: 'toolbar'

  init: ()->
    @_super()

  searchFormTarget: (()->
    if Ember.ENV.WIDGET? then '_blank' else null
  ).property()

  showCategories: (()->
    if Ember.ENV.WIDGET? then Ember.ENV.WIDGET.show_categories else true
  ).property()

  showSearch: (()->
    if Ember.ENV.WIDGET? then Ember.ENV.WIDGET.show_search else true
  ).property()

  didInsertElement: ()->
    $(window).on 'resize.toolbar', @adjustFilters
    @adjustFilters()

    $popovers = @$('[data-popover]')

    adjustPopovers = ->
      $popovers.popover
        placement: if $(window).width() < 767 then 'top' else 'bottom'

    adjustPopovers()

    $(window).on 'resize.toolbar.popover', ->
      $popovers.popover('destroy')
      adjustPopovers()

    return

  didRemoveElement: ()->
    $(window).off 'resize.toolbar'

  adjustFilters: ()->
    # @TODO We need a better place for this!
    @$('.bootstrap-select').toggleClass('dropup', $(window).width() < 767)

  addToggleSearchbar: (()->
    toolbarView = @

    toolbarView.$('[data-toggle="searchbar"]').click -><commit_msg>Fix toolbar dropdowns to be dropups in embed layout.<commit_after>Wheelmap.ToolbarView = Ember.View.extend
  classNames: 'toolbar'
  templateName: 'toolbar'

  init: ()->
    @_super()

  searchFormTarget: (()->
    if Ember.ENV.WIDGET? then '_blank' else null
  ).property()

  showCategories: (()->
    if Ember.ENV.WIDGET? then Ember.ENV.WIDGET.show_categories else true
  ).property()

  showSearch: (()->
    if Ember.ENV.WIDGET? then Ember.ENV.WIDGET.show_search else true
  ).property()

  didInsertElement: ()->
    $(window).on 'resize.toolbar', @adjustFilters
    @adjustFilters()

    $popovers = @$('[data-popover]')

    adjustPopovers = ->
      $popovers.popover
        placement: if $(window).width() < 767 then 'top' else 'bottom'

    adjustPopovers()

    $(window).on 'resize.toolbar.popover', ->
      $popovers.popover('destroy')
      adjustPopovers()

    return

  didRemoveElement: ()->
    $(window).off 'resize.toolbar'

  adjustFilters: ()->
    # @TODO We need a better place for this!
    @$('.bootstrap-select').toggleClass('dropup', Ember.ENV.WIDGET? || $(window).width() < 767)

  addToggleSearchbar: (()->
    toolbarView = @

    toolbarView.$('[data-toggle="searchbar"]').click ->
{'fraction_non_alphanumeric': 0.1691919191919192, 'fraction_numerical': 0.005050505050505051, 'mean_word_length': 3.321818181818182, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, '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': '7053553', 'n_tokens_mistral': 816, 'n_tokens_neox': 778, 'n_words': 155}