Improve repo/user/org search (#27030)

* Fix a regression from #26809 (the `data-org` is missing)
* Remove unnecessary style

Screenshots:


![image](https://github.com/go-gitea/gitea/assets/2114189/3f5cf628-db7f-4705-898a-7a4a1fbfbba8)


![image](https://github.com/go-gitea/gitea/assets/2114189/453d1fad-1090-4524-bf45-6c5da2465f04)


![image](https://github.com/go-gitea/gitea/assets/2114189/f14d9808-7596-42c8-84b4-0d57a0bf2278)
This commit is contained in:
wxiaoguang 2023-09-13 00:44:48 +08:00 committed by GitHub
parent e6b68c579b
commit 739e47cd80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 10 deletions

View file

@ -89,7 +89,7 @@
{{if $allowedToChangeTeams}}
<form class="ui form" id="repo-collab-team-form" action="{{.Link}}/team" method="post">
{{.CsrfTokenHtml}}
<div id="search-team-box" class="ui search input gt-vm">
<div id="search-team-box" class="ui search input gt-vm" data-org-name="{{.OrgName}}">
<input class="prompt" name="team" placeholder="{{$.locale.Tr "repo.settings.search_team"}}" autocomplete="off" autofocus required>
</div>
<button class="ui green button">{{$.locale.Tr "repo.settings.add_team"}}</button>

View file

@ -2154,21 +2154,15 @@
margin-top: 5px;
}
#search-repo-box .results .result img,
#search-user-box .results .result img {
#search-user-box .results .result .image {
float: left;
margin-right: 8px;
width: 2em;
height: 2em;
}
#search-repo-box .results .result .content,
#search-user-box .results .result .content {
margin: 6px 0;
}
#search-team-box .results .result .content {
margin: 6px 0;
margin: 6px 0; /* this trick is used to align with the sibling avatar image */
}
.ui.menu .item > img:not(.ui) {

View file

@ -47,7 +47,7 @@ export function initRepoSettingSearchTeamBox() {
$searchTeamBox.search({
minCharacters: 2,
apiSettings: {
url: `${appSubUrl}/org/${$searchTeamBox.data('org')}/teams/-/search?q={query}`,
url: `${appSubUrl}/org/${$searchTeamBox.attr('data-org-name')}/teams/-/search?q={query}`,
headers: {'X-Csrf-Token': csrfToken},
onResponse(response) {
const items = [];