mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-14 01:14:37 +00:00
- Replace fomantic `search` code with minimal first-party code - Added a small fix to vertically align search box and search button - Manually tested all search forms. - Add `errorName` helper, similar to `errorMessage`. Signed-off-by: silverwind <me@silverwind.io> Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
17 lines
639 B
TypeScript
17 lines
639 B
TypeScript
import {attachSearchBox} from '../../modules/search.ts';
|
|
|
|
const {appSubUrl} = window.config;
|
|
|
|
type RepoSearchResponse = {data: Array<{repository: {full_name: string}}>};
|
|
|
|
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`;
|
|
attachSearchBox(el, url, (response: RepoSearchResponse) => response.data.map((item) => ({
|
|
title: item.repository.full_name.split('/')[1],
|
|
description: item.repository.full_name,
|
|
})));
|
|
}
|