mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-19 19:25:11 +02:00
Replace Fomantic search module with first-party autocomplete
Drops the 1565-line vendored Fomantic UI search jQuery plugin in favor of a small first-party TypeScript module covering the three call sites (repo, user, and team autocomplete). Adds an e2e regression suite that exercises each search box. Also fixes input/button vertical alignment in the four forms that wrap a search box: the fomantic-era `tw-align-middle` workaround is replaced by `flex-text-block` on the form, which is the codebase's standard flex helper for this layout. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
This commit is contained in:
13 files changed
+291
-1643
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import {fomanticQuery} from '../../modules/fomantic/base.ts';
|
||||
import {initSearchBox} from '../../modules/fomantic/search.ts';
|
||||
import {htmlEscape} from '../../utils/html.ts';
|
||||
|
||||
const {appSubUrl} = window.config;
|
||||
@@ -10,22 +10,17 @@ export function initCompSearchRepoBox(el: HTMLElement) {
|
||||
if (exclusive === 'true') {
|
||||
url += `&exclusive=true`;
|
||||
}
|
||||
fomanticQuery(el).search({
|
||||
minCharacters: 2,
|
||||
apiSettings: {
|
||||
url,
|
||||
onResponse(response: any) {
|
||||
const items = [];
|
||||
for (const item of response.data) {
|
||||
items.push({
|
||||
title: htmlEscape(item.repository.full_name.split('/')[1]),
|
||||
description: htmlEscape(item.repository.full_name),
|
||||
});
|
||||
}
|
||||
return {results: items};
|
||||
},
|
||||
initSearchBox(el, {
|
||||
apiUrl: url,
|
||||
onResponse(response: any) {
|
||||
const items = [];
|
||||
for (const item of response.data) {
|
||||
items.push({
|
||||
title: htmlEscape(item.repository.full_name.split('/')[1]),
|
||||
description: htmlEscape(item.repository.full_name),
|
||||
});
|
||||
}
|
||||
return {results: items};
|
||||
},
|
||||
searchFields: ['full_name'],
|
||||
showNoResults: false,
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user