Review changes

This commit is contained in:
Luke "Jared" Bennett 2016-07-11 17:06:31 +01:00
parent 359ec42754
commit e0f3b66c38
No known key found for this signature in database
GPG key ID: 7EC4B269DC10037C
2 changed files with 9 additions and 8 deletions

View file

@ -6,9 +6,9 @@
initSearch: ->
projectsListFilter = $('.projects-list-filter')
projectsListFilter.on 'keyup', (e) =>
clearTimeout(@timer) if @timer
@timer = setTimeout(ProjectsList.filterResults, 500) if projectsListFilter.val() isnt ''
debounceFilter = _.debounce ProjectsList.filterResults, 500
projectsListFilter.on 'keyup', (e) ->
debounceFilter() if projectsListFilter.val() isnt ''
filterResults: ->
$('.projects-list-holder').fadeTo(250, 0.5)

View file

@ -2,10 +2,10 @@ class @Shortcuts
constructor: (skipResetBindings) ->
@enabledHelp = []
Mousetrap.reset() if not skipResetBindings
Mousetrap.bind('?', @onToggleHelp)
Mousetrap.bind('s', Shortcuts.focusSearch)
Mousetrap.bind 'f', @focusFilter
Mousetrap.bind(['ctrl+shift+p', 'command+shift+p'], @toggleMarkdownPreview)
Mousetrap.bind '?', @onToggleHelp
Mousetrap.bind 's', Shortcuts.focusSearch
Mousetrap.bind 'f', (e) => @focusFilter e
Mousetrap.bind ['ctrl+shift+p', 'command+shift+p'], @toggleMarkdownPreview
Mousetrap.bind('t', -> Turbolinks.visit(findFileURL)) if findFileURL?
onToggleHelp: (e) =>
@ -34,7 +34,8 @@ class @Shortcuts
)
focusFilter: (e) ->
$('input[type=search]', '.nav-controls .block-controls').focus()
@filterInput ?= $('input[type=search]', '.nav-controls')
@filterInput.focus()
e.preventDefault()
@focusSearch: (e) ->