mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-27 11:56:04 +02:00
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>
27 lines
785 B
TypeScript
27 lines
785 B
TypeScript
import {initSearchBox} from '../../modules/fomantic/search.ts';
|
|
import {htmlEscape} from '../../utils/html.ts';
|
|
|
|
const {appSubUrl} = window.config;
|
|
|
|
export function initCompSearchRepoBox(el: HTMLElement) {
|
|
const uid = el.getAttribute('data-uid');
|
|
const exclusive = el.getAttribute('data-exclusive');
|
|
let url = `${appSubUrl}/repo/search?q={query}&uid=${uid}`;
|
|
if (exclusive === 'true') {
|
|
url += `&exclusive=true`;
|
|
}
|
|
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};
|
|
},
|
|
});
|
|
}
|