                 $icon.removeClass 'icon-icon-close'
                 $container.removeClass 'close-button'
                 $container.addClass 'search-button'
+
         events:
             'typeahead:selected': 'autosuggestShowDetails'
             # Important! The following ensures the click

                @$el.find('.tt-dropdown-menu').css 'width': width
            else
                @$el.find('.tt-dropdown-menu').css 'width': 'auto'
        enableTypeahead: (selector) ->
            @$searchEl = @$el.find selector
            serviceDataset =

            if query? and query.length > 0
                return false
            return true

        _onInputClicked: (ev) ->
            @trigger 'open'
            ev.stopPropagation()

        _getSearchEl: ->
            if @$searchEl?
                @$searchEl
            else
                @$searchEl = @$el.find 'input.form-control[type=search]'

        setInputText: (query) ->
            $el = @_getSearchEl()
            if $el.length
                $el.typeahead 'val', query

        getInputText: ->
            $el = @_getSearchEl()
            if $el.length
                $el.typeahead 'val'
            else
                null

        onRender: () ->
            @enableTypeahead('input.form-control[type=search]')
            @setTypeaheadWidth()
            $(window).resize => @setTypeaheadWidth()

        setTypeaheadWidth: ->
            windowWidth = window.innerWidth or document.documentElement.clientWidth or document.body.clientWidth
            if windowWidth < appSettings.mobile_ui_breakpoint
