add empty search functionality

still bugged, because the search will lose focus and start to animate
This commit is contained in:
Felix Niklas 2014-07-14 19:03:37 +02:00
parent c5f88febd4
commit 46edcaed8b

View file

@ -1,6 +1,9 @@
class App.Navigation extends App.Controller class App.Navigation extends App.Controller
className: 'navigation flex vertical' className: 'navigation flex vertical'
events:
'click .empty-search': 'emptySearch'
constructor: -> constructor: ->
super super
@render() @render()
@ -205,6 +208,8 @@ class App.Navigation extends App.Controller
@el.find('#global-search').bind( 'keyup', (e) => @el.find('#global-search').bind( 'keyup', (e) =>
@term = @el.find('#global-search').val() @term = @el.find('#global-search').val()
@el.find('.search').toggleClass('filled', !!@term)
return if !@term return if !@term
return if @term is search return if @term is search
@delay( searchFunction, 220, 'search' ) @delay( searchFunction, 220, 'search' )
@ -212,6 +217,10 @@ class App.Navigation extends App.Controller
@taskbar = new App.TaskbarWidget( el: @el.find('.tasks') ) @taskbar = new App.TaskbarWidget( el: @el.find('.tasks') )
emptySearch: (event) =>
@el.find('#global-search').val("")
@el.find('.search').removeClass('filled')
getItems: (data) -> getItems: (data) ->
navbar = _.values(data.navbar) navbar = _.values(data.navbar)