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 ...@@ -222,6 +222,7 @@ v 8.9.0
- Add rake task 'gitlab:db:configure' for conditionally seeding or migrating the database - 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) - Changed the Slack build message to use the singular duration if necessary (Aran Koning)
- Fix race condition on merge when build succeeds - 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 - 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) - 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 - Added navigation shortcuts to the project pipelines, milestones, builds and forks page. !4393
......
...@@ -32,13 +32,11 @@ issuable_created = false ...@@ -32,13 +32,11 @@ issuable_created = false
$search = $('#issue_search') $search = $('#issue_search')
$form = $('.js-filter-form') $form = $('.js-filter-form')
$input = $("input[name='#{$search.attr('name')}']", $form) $input = $("input[name='#{$search.attr('name')}']", $form)
if $input.length is 0 if $input.length is 0
$form.append "<input type='hidden' name='#{$search.attr('name')}' value='#{_.escape($search.val())}'/>" $form.append "<input type='hidden' name='#{$search.attr('name')}' value='#{_.escape($search.val())}'/>"
else else
$input.val $search.val() $input.val $search.val()
Issuable.filterResults $form if $search.val() isnt ''
Issuable.filterResults $form
, 500) , 500)
initLabelFilterRemove: -> initLabelFilterRemove: ->
......
...@@ -5,13 +5,12 @@ ...@@ -5,13 +5,12 @@
this.initPagination() this.initPagination()
initSearch: -> initSearch: ->
@timer = null projectsListFilter = $('.projects-list-filter')
$(".projects-list-filter").on('keyup', -> projectsListFilter.on 'keyup', (e) =>
clearTimeout(@timer) clearTimeout(@timer) if @timer
@timer = setTimeout(ProjectsList.filterResults, 500) @timer = setTimeout(ProjectsList.filterResults, 500) if projectsListFilter.val() isnt ''
)
filterResults: => filterResults: ->
$('.projects-list-holder').fadeTo(250, 0.5) $('.projects-list-holder').fadeTo(250, 0.5)
form = null form = null
......
...@@ -4,6 +4,7 @@ class @Shortcuts ...@@ -4,6 +4,7 @@ class @Shortcuts
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(['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?
...@@ -32,10 +33,15 @@ class @Shortcuts ...@@ -32,10 +33,15 @@ class @Shortcuts
$('.js-more-help-button').remove() $('.js-more-help-button').remove()
) )
focusFilter: (e) ->
$('input[type=search]', '.nav-controls .block-controls').focus()
e.preventDefault()
@focusSearch: (e) -> @focusSearch: (e) ->
$('#search').focus() $('#search').focus()
e.preventDefault() e.preventDefault()
$(document).on 'click.more_help', '.js-more-help-button', (e) -> $(document).on 'click.more_help', '.js-more-help-button', (e) ->
$(@).remove() $(@).remove()
$('.hidden-shortcut').show() $('.hidden-shortcut').show()
......
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
%td.shortcut %td.shortcut
.key s .key s
%td Focus Search %td Focus Search
%tr
%td.shortcut
.key f
%td Focus Filter
%tr %tr
%td.shortcut %td.shortcut
.key ? .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