Implemented issue #2395 - Search term is deleted after I opened a object/ticket.
This commit is contained in:
parent
ecad97f5ef
commit
23059d7c90
1 changed files with 21 additions and 23 deletions
|
@ -16,9 +16,8 @@ class App.Navigation extends App.ControllerWidgetPermanent
|
||||||
'submit form.search-holder': 'preventDefault'
|
'submit form.search-holder': 'preventDefault'
|
||||||
'dblclick form.search-holder .icon-magnifier': 'openExtendedSearch'
|
'dblclick form.search-holder .icon-magnifier': 'openExtendedSearch'
|
||||||
'focus #global-search': 'searchFocus'
|
'focus #global-search': 'searchFocus'
|
||||||
'blur #global-search': 'searchBlur'
|
|
||||||
'keyup #global-search': 'listNavigate'
|
'keyup #global-search': 'listNavigate'
|
||||||
'click .js-global-search-result': 'emptyAndClose'
|
'click .js-global-search-result': 'emptyAndCloseDelayed'
|
||||||
'click .js-details-link': 'openExtendedSearch'
|
'click .js-details-link': 'openExtendedSearch'
|
||||||
'change .js-menu .js-switch input': 'switch'
|
'change .js-menu .js-switch input': 'switch'
|
||||||
|
|
||||||
|
@ -162,7 +161,7 @@ class App.Navigation extends App.ControllerWidgetPermanent
|
||||||
renderResult: (result = [], noChange) =>
|
renderResult: (result = [], noChange) =>
|
||||||
if noChange
|
if noChange
|
||||||
return
|
return
|
||||||
|
|
||||||
@removePopovers()
|
@removePopovers()
|
||||||
|
|
||||||
# remove result if not result exists
|
# remove result if not result exists
|
||||||
|
@ -202,19 +201,11 @@ class App.Navigation extends App.ControllerWidgetPermanent
|
||||||
$('#app').append @notificationWidget.el
|
$('#app').append @notificationWidget.el
|
||||||
|
|
||||||
searchFocus: (e) =>
|
searchFocus: (e) =>
|
||||||
@query = '' # reset query cache
|
@clearDelay('emptyAndCloseDelayed')
|
||||||
|
@throttledSearch()
|
||||||
App.PopoverProvidable.anyPopoversDestroy()
|
App.PopoverProvidable.anyPopoversDestroy()
|
||||||
@searchContainer.addClass('focused')
|
@searchContainer.addClass('focused')
|
||||||
|
@selectAll(e)
|
||||||
searchBlur: (e) =>
|
|
||||||
# delay to be able to click x
|
|
||||||
update = =>
|
|
||||||
query = @searchInput.val().trim()
|
|
||||||
if !query
|
|
||||||
@emptyAndClose()
|
|
||||||
return
|
|
||||||
|
|
||||||
@delay(update, 100, 'removeFocused')
|
|
||||||
|
|
||||||
listNavigate: (e) =>
|
listNavigate: (e) =>
|
||||||
if e.keyCode is 27 # close on esc
|
if e.keyCode is 27 # close on esc
|
||||||
|
@ -231,9 +222,9 @@ class App.Navigation extends App.ControllerWidgetPermanent
|
||||||
href = @$('.global-search-result .nav-tab.is-hover').attr('href')
|
href = @$('.global-search-result .nav-tab.is-hover').attr('href')
|
||||||
if href
|
if href
|
||||||
@navigate(href)
|
@navigate(href)
|
||||||
|
@emptyAndCloseDelayed()
|
||||||
else
|
else
|
||||||
@openExtendedSearch()
|
@openExtendedSearch()
|
||||||
@emptyAndClose()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# on other keys, show result
|
# on other keys, show result
|
||||||
|
@ -277,18 +268,24 @@ class App.Navigation extends App.ControllerWidgetPermanent
|
||||||
@scrollToIfNeeded(prev, false)
|
@scrollToIfNeeded(prev, false)
|
||||||
|
|
||||||
emptyAndClose: =>
|
emptyAndClose: =>
|
||||||
|
@andClose()
|
||||||
|
@andEmpty()
|
||||||
|
|
||||||
|
emptyAndCloseDelayed: =>
|
||||||
|
@andClose()
|
||||||
|
delay = =>
|
||||||
|
@andEmpty()
|
||||||
|
@delay(delay, 60000, 'emptyAndCloseDelayed')
|
||||||
|
|
||||||
|
andEmpty: =>
|
||||||
@query = ''
|
@query = ''
|
||||||
@searchInput.val('')
|
@searchInput.val('')
|
||||||
|
|
||||||
|
andClose: =>
|
||||||
@searchContainer.removeClass('focused filled open no-match loading')
|
@searchContainer.removeClass('focused filled open no-match loading')
|
||||||
@globalSearch.close()
|
@globalSearch.close()
|
||||||
@delayedRemoveAnyPopover()
|
@delayedRemoveAnyPopover()
|
||||||
|
|
||||||
andClose: =>
|
|
||||||
@query = ''
|
|
||||||
@searchInput.blur()
|
@searchInput.blur()
|
||||||
@searchContainer.removeClass('open no-match loading')
|
|
||||||
@globalSearch.close()
|
|
||||||
@delayedRemoveAnyPopover()
|
|
||||||
|
|
||||||
search: =>
|
search: =>
|
||||||
query = @searchInput.val().trim()
|
query = @searchInput.val().trim()
|
||||||
|
@ -301,9 +298,10 @@ class App.Navigation extends App.ControllerWidgetPermanent
|
||||||
@query = query
|
@query = query
|
||||||
|
|
||||||
if @query == ''
|
if @query == ''
|
||||||
@searchContainer.removeClass('open')
|
@searchContainer.removeClass('open loading')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@searchContainer.addClass('open')
|
||||||
@globalSearch.search(query: @query)
|
@globalSearch.search(query: @query)
|
||||||
|
|
||||||
filterNavbar: (values, user, parent = null) ->
|
filterNavbar: (values, user, parent = null) ->
|
||||||
|
@ -460,7 +458,7 @@ class App.Navigation extends App.ControllerWidgetPermanent
|
||||||
if e
|
if e
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
query = @searchInput.val()
|
query = @searchInput.val()
|
||||||
@searchInput.val('').blur()
|
@emptyAndClose()
|
||||||
if query
|
if query
|
||||||
@navigate("#search/#{encodeURIComponent(query)}")
|
@navigate("#search/#{encodeURIComponent(query)}")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue