Added close on open new tab.

This commit is contained in:
Martin Edenhofer 2015-06-01 16:39:27 +02:00
parent 190d86d4f1
commit 8c651959a8

View file

@ -195,12 +195,30 @@ class App.Navigation extends App.Controller
area.result.push data
@renderResult(result)
@$('#global-search-result').on('click', 'a', =>
close()
)
)
removePopovers = ->
$('.popover').remove()
close = =>
@$('#global-search').blur()
@$('.search').removeClass('open')
# remove not needed popovers
@delay( removePopovers, 280, 'removePopovers' )
emptyAndClose = =>
@$('#global-search').val('').blur()
@$('.search').removeClass('filled').removeClass('open')
# remove not needed popovers
@delay( removePopovers, 280, 'removePopovers' )
# observer search box
@$('#global-search').bind( 'focusout', (e) =>
@$('.search').removeClass('focused')
@ -211,7 +229,7 @@ class App.Navigation extends App.Controller
@$('.search').addClass('focused')
# remove not needed popovers
$('.popover').remove()
removePopovers()
# check if search is needed
term = @$('#global-search').val().trim()
@ -220,27 +238,13 @@ class App.Navigation extends App.Controller
@delay( searchFunction, 220, 'search' )
)
# remove search result
# @$('#global-search').bind( 'focusout', (e) =>
# @delay(
# =>
# @$('.search').removeClass('focused')
# # remove not needed popovers
# $('.popover').remove()
# @renderResult()
# 320
# )
# )
# prevent submit of search box
@$('form.search').bind( 'submit', (e) =>
@$('form.search').on( 'submit', (e) =>
e.preventDefault()
)
# start search
@$('#global-search').bind( 'keyup', (e) =>
@$('#global-search').on( 'keyup', (e) =>
# close on esc
if e.which == 27