File tree Expand file tree Collapse file tree 4 files changed +38
-9
lines changed Expand file tree Collapse file tree 4 files changed +38
-9
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,26 @@ const sortRecords = (e) => {
26
26
} ;
27
27
28
28
/*************************************************************
29
- * Searh dropdown
29
+ * Search form
30
+ *************************************************************/
31
+ function searchForm ( ) {
32
+ return {
33
+ applyShortcut ( event ) {
34
+ if (
35
+ event . key === "/" &&
36
+ document . activeElement . tagName . toLowerCase ( ) !== "input" &&
37
+ document . activeElement . tagName . toLowerCase ( ) !== "textarea" &&
38
+ ! document . activeElement . isContentEditable
39
+ ) {
40
+ event . preventDefault ( ) ;
41
+ this . $refs . searchInput . focus ( ) ;
42
+ }
43
+ } ,
44
+ } ;
45
+ }
46
+
47
+ /*************************************************************
48
+ * Search dropdown
30
49
*************************************************************/
31
50
function searchDropdown ( ) {
32
51
return {
Original file line number Diff line number Diff line change 2
2
3
3
{% if cl.search_fields %}
4
4
< div id ="toolbar ">
5
- < form id ="changelist-search " method ="get " role ="search ">
6
- < div class ="bg-white border border-base-200 flex rounded-default overflow-hidden shadow-xs lg:w-96 focus-within:outline-2 focus-within:-outline-offset-2 focus-within:outline-primary-600 dark:bg-base-900 dark:border-base-700 ">
7
- < input class ="font-medium grow min-w-0 h-9 px-3 text-font-default-light text-sm focus:outline-hidden dark:bg-base-900 dark:text-font-default-dark placeholder-shown:truncate placeholder-base-400 " type ="text " name ="{{ search_var }} " value ="{{ cl.query }} " id ="searchbar " placeholder ="{% if cl.search_help_text %}{{ cl.search_help_text }}{% else %}{% trans "Type to search " %}{% endif %}" />
8
-
9
- < button type ="submit " class ="flex items-center px-2 focus:outline-hidden " id ="searchbar-submit ">
5
+ < form id ="changelist-search " method ="get " role ="search " x-data ="searchForm() ">
6
+ < div class ="bg-white border border-base-200 flex flex-row items-center px-3 rounded-default relative shadow-xs w-full focus-within:outline-2 focus-within:-outline-offset-2 focus-within:outline-primary-600 lg:w-96 dark:bg-base-900 dark:border-base-700 ">
7
+ < button type ="submit " class ="flex items-center focus:outline-hidden " id ="searchbar-submit ">
10
8
< span class ="material-symbols-outlined md-18 text-base-400 dark:text-base-500 "> search</ span >
11
9
</ button >
10
+
11
+ < input type ="text "
12
+ x-ref ="searchInput "
13
+ x-on:keydown.window ="applyShortcut($event) "
14
+ class ="grow font-medium min-w-0 overflow-hidden p-2 placeholder-font-subtle-light truncate focus:outline-hidden dark:bg-base-900 dark:placeholder-font-subtle-dark dark:text-font-default-dark "
15
+ name ="{{ search_var }} "
16
+ value ="{{ cl.query }} "
17
+ id ="searchbar "
18
+ placeholder ="{% if cl.search_help_text %}{{ cl.search_help_text }}{% else %}{% trans "Type to search " %}{% endif %}" />
19
+
20
+ {% include "unfold/helpers/shortcut.html" with shortcut="/" %}
12
21
</ div >
13
22
14
23
{% for pair in cl.filter_params.items %}
Original file line number Diff line number Diff line change 22
22
placeholder ="{% translate 'Search apps and models...' %} "
23
23
aria-label ="{% translate 'Filter navigation items' %} ">
24
24
25
- < kbd class ="bg-base-50 border border-base-200 font-mono text-xs text-font-subtle-light rounded-xs px-1 ">
26
- t
27
- </ kbd >
25
+ {% include "unfold/helpers/shortcut.html" with shortcut="t" %}
28
26
</ div >
29
27
30
28
< div id ="search-results " x-show ="openSearchResults "> </ div >
Original file line number Diff line number Diff line change
1
+ < kbd class ="bg-base-50 border border-base-200 font-mono text-xs text-font-subtle-light rounded-xs px-1 dark:bg-white/[.04] dark:border-base-700 dark:text-font-subtle-dark ">
2
+ {{ shortcut }}
3
+ </ kbd >
You can’t perform that action at this time.
0 commit comments