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: -> initSearch: ->
projectsListFilter = $('.projects-list-filter') projectsListFilter = $('.projects-list-filter')
projectsListFilter.on 'keyup', (e) => debounceFilter = _.debounce ProjectsList.filterResults, 500
clearTimeout(@timer) if @timer projectsListFilter.on 'keyup', (e) ->
@timer = setTimeout(ProjectsList.filterResults, 500) if projectsListFilter.val() isnt '' debounceFilter() if projectsListFilter.val() isnt ''
filterResults: -> filterResults: ->
$('.projects-list-holder').fadeTo(250, 0.5) $('.projects-list-holder').fadeTo(250, 0.5)

View file

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