-
-
Notifications
You must be signed in to change notification settings - Fork 231
feat(Templates): add search functionality for user templates #901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ef91608
8bbb6fe
877133c
2e46deb
b0026f2
693858c
f186bed
bb68997
8f72fe3
692fbd8
83b5feb
17ed405
08ecc0b
8f4bccf
71194c9
85f5952
105f9df
6910962
95fc88c
a29009b
0b1d802
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,10 @@ | |
| <li> | ||
| <a href="#" data-target="templates-user" data-i18n="templates.user.heading">My Templates</a> | ||
| </li> | ||
| <li class="templates-search"> | ||
| <label for="templates-search-input" class="visually-hidden" data-i18n="templates.search.label">Search templates</label> | ||
| <input id="templates-search-input" type="search" placeholder="Filter languages..." aria-label="Filter templates by language" /> | ||
| </li> | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </ul> | ||
|
|
||
| <div id="templates-starter" class="tab-content active"> | ||
|
|
@@ -28,3 +32,24 @@ | |
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Inline: emit a "templates:filter" event with the current query so other scripts can perform filtering --> | ||
| <script> | ||
|
||
| (function () { | ||
| var input = document.getElementById('templates-search-input'); | ||
| if (!input) return; | ||
|
|
||
| var emit = function (value) { | ||
| var ev = new CustomEvent('templates:filter', { detail: { query: value } }); | ||
| document.getElementById('templates-container').dispatchEvent(ev); | ||
| }; | ||
|
|
||
| var timeout = null; | ||
| input.addEventListener('input', function (e) { | ||
| var val = e.target.value || ''; | ||
| // debounce to avoid excessive events while typing | ||
| clearTimeout(timeout); | ||
| timeout = setTimeout(function () { emit(val.trim()); }, 150); | ||
|
||
| }); | ||
| })(); | ||
| </script> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change
"Filter languages..."to"Search templates...". And then we can search by title, languages and others (e.g. tags).Also, after you finish your edits, please run
npm run i18n-exportto regenerate the i18n json and fix this build error.