Skip to content

Commit

Permalink
feat: hotkey "/" to open ACP search
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Sep 18, 2020
1 parent 763cec3 commit 43571ba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion public/language/en-GB/admin/menu.json
Expand Up @@ -70,7 +70,7 @@
"logout": "Log out",
"view-forum": "View Forum",

"search.placeholder": "Search for settings",
"search.placeholder": "Press "/" to search for settings",
"search.no-results": "No results...",
"search.search-forum": "Search the forum for <strong></strong>",
"search.keep-typing": "Type more to see results...",
Expand Down
5 changes: 5 additions & 0 deletions public/src/admin/modules/search.js
Expand Up @@ -90,6 +90,11 @@ define('admin/modules/search', ['mousetrap'], function (mousetrap) {
return false;
});

mousetrap.bind('/', function (ev) {
input.select();
ev.preventDefault();
});

mousetrap(input[0]).bind(['up', 'down'], function (ev, key) {
var next;
if (key === 'up') {
Expand Down
2 changes: 1 addition & 1 deletion src/views/admin/partials/menu.tpl
Expand Up @@ -139,7 +139,7 @@
<form role="search">
<div id="acp-search" >
<div class="dropdown">
<input type="text" autofocus data-toggle="dropdown" class="form-control" placeholder="[[admin/menu:search.placeholder]]">
<input type="text" data-toggle="dropdown" class="form-control" placeholder="[[admin/menu:search.placeholder]]">
<ul class="dropdown-menu dropdown-menu-right state-start-typing" role="menu">
<li role="presentation" class="no-results">
<a>[[admin/menu:search.no-results]]</a>
Expand Down

0 comments on commit 43571ba

Please sign in to comment.