Commit 359ec427 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Added shortcut to focus all search tags apart from the top nav search

Updated CHANGELOG

Added docs for filter shortcut

Moved CHANGELOG entry

Added phils fixes

Fixed search form submitting with empty input

Added review fixes

Readability and selector perf fix
parent df49492f
......@@ -222,6 +222,7 @@ v 8.9.0
- Add rake task 'gitlab:db:configure' for conditionally seeding or migrating the database
- Changed the Slack build message to use the singular duration if necessary (Aran Koning)
- Fix race condition on merge when build succeeds
- Added shortcut to focus filter search fields and added documentation #18120
- Links from a wiki page to other wiki pages should be rewritten as expected
- Add option to project to only allow merge requests to be merged if the build succeeds (Rui Santos)
- Added navigation shortcuts to the project pipelines, milestones, builds and forks page. !4393
......
......@@ -32,13 +32,11 @@ issuable_created = false
$search = $('#issue_search')
$form = $('.js-filter-form')
$input = $("input[name='#{$search.attr('name')}']", $form)
if $input.length is 0
$form.append "<input type='hidden' name='#{$search.attr('name')}' value='#{_.escape($search.val())}'/>"
else
$input.val $search.val()
Issuable.filterResults $form
Issuable.filterResults $form if $search.val() isnt ''
, 500)
initLabelFilterRemove: ->
......
......@@ -5,13 +5,12 @@
this.initPagination()
initSearch: ->
@timer = null
$(".projects-list-filter").on('keyup', ->
clearTimeout(@timer)
@timer = setTimeout(ProjectsList.filterResults, 500)
)
projectsListFilter = $('.projects-list-filter')
projectsListFilter.on 'keyup', (e) =>
clearTimeout(@timer) if @timer
@timer = setTimeout(ProjectsList.filterResults, 500) if projectsListFilter.val() isnt ''
filterResults: =>
filterResults: ->
$('.projects-list-holder').fadeTo(250, 0.5)
form = null
......
......@@ -4,6 +4,7 @@ class @Shortcuts
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('t', -> Turbolinks.visit(findFileURL)) if findFileURL?
......@@ -32,10 +33,15 @@ class @Shortcuts
$('.js-more-help-button').remove()
)
focusFilter: (e) ->
$('input[type=search]', '.nav-controls .block-controls').focus()
e.preventDefault()
@focusSearch: (e) ->
$('#search').focus()
e.preventDefault()
$(document).on 'click.more_help', '.js-more-help-button', (e) ->
$(@).remove()
$('.hidden-shortcut').show()
......
......@@ -18,6 +18,10 @@
%td.shortcut
.key s
%td Focus Search
%tr
%td.shortcut
.key f
%td Focus Filter
%tr
%td.shortcut
.key ?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment