Added close on open new tab.
This commit is contained in:
parent
190d86d4f1
commit
8c651959a8
1 changed files with 23 additions and 19 deletions
|
@ -195,12 +195,30 @@ class App.Navigation extends App.Controller
|
||||||
area.result.push data
|
area.result.push data
|
||||||
|
|
||||||
@renderResult(result)
|
@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 = =>
|
emptyAndClose = =>
|
||||||
@$('#global-search').val('').blur()
|
@$('#global-search').val('').blur()
|
||||||
@$('.search').removeClass('filled').removeClass('open')
|
@$('.search').removeClass('filled').removeClass('open')
|
||||||
|
|
||||||
|
# remove not needed popovers
|
||||||
|
@delay( removePopovers, 280, 'removePopovers' )
|
||||||
|
|
||||||
|
|
||||||
# observer search box
|
# observer search box
|
||||||
@$('#global-search').bind( 'focusout', (e) =>
|
@$('#global-search').bind( 'focusout', (e) =>
|
||||||
@$('.search').removeClass('focused')
|
@$('.search').removeClass('focused')
|
||||||
|
@ -211,7 +229,7 @@ class App.Navigation extends App.Controller
|
||||||
@$('.search').addClass('focused')
|
@$('.search').addClass('focused')
|
||||||
|
|
||||||
# remove not needed popovers
|
# remove not needed popovers
|
||||||
$('.popover').remove()
|
removePopovers()
|
||||||
|
|
||||||
# check if search is needed
|
# check if search is needed
|
||||||
term = @$('#global-search').val().trim()
|
term = @$('#global-search').val().trim()
|
||||||
|
@ -220,27 +238,13 @@ class App.Navigation extends App.Controller
|
||||||
@delay( searchFunction, 220, 'search' )
|
@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
|
# prevent submit of search box
|
||||||
@$('form.search').bind( 'submit', (e) =>
|
@$('form.search').on( 'submit', (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
)
|
)
|
||||||
|
|
||||||
# start search
|
# start search
|
||||||
@$('#global-search').bind( 'keyup', (e) =>
|
@$('#global-search').on( 'keyup', (e) =>
|
||||||
|
|
||||||
# close on esc
|
# close on esc
|
||||||
if e.which == 27
|
if e.which == 27
|
||||||
|
|
Loading…
Reference in a new issue