forgejo/templates/repo/settings/tags.tmpl
Hester Gong 661e78bed5
Allow both fullname and username search when DEFAULT_SHOW_FULL_NAME is true (#23463)
This PR adds the ability to search both fullname and username for
assignees, reviewers and author search boxes when the config
[`DEFAULT_SHOW_FULL_NAME`](6ff5400af9/custom/conf/app.example.ini (L1238))
in `app.ini` is set to `true`. Which is originally raised
[here](https://projects.blender.org/infrastructure/blender-projects-platform/issues/14)
And if `DEFAULT_SHOW_FULL_NAME` is set to `false`(default value), these
search boxes will only show username.

Example:
When `DEFAULT_SHOW_FULL_NAME = true`

<img width="1220" alt="截屏2023-03-14 14 28 06"
src="https://user-images.githubusercontent.com/17645053/224914546-80ef2837-ab72-4d66-9f00-6eb77ed4baaa.png">

When `DEFAULT_SHOW_FULL_NAME = false` (default value)

<img width="1243" alt="截屏2023-03-14 14 29 37"
src="https://user-images.githubusercontent.com/17645053/224914798-f69ec8a2-0929-4330-827c-3e30188f9b47.png">


The specific search boxes that adapts these changes include:
1. Author, Assignee search boxes in pull requests tab and issues tab in
repository
<img width="1283" alt="截屏2023-03-14 14 35 01"
src="https://user-images.githubusercontent.com/17645053/224916250-8e452525-71d6-4b48-bf1c-bf7a176abaaa.png">

2. Assigee and Author on milestones issue page (Added missing search box
for author here)
<img width="1261" alt="截屏2023-03-14 14 38 20"
src="https://user-images.githubusercontent.com/17645053/224916569-d3105619-7824-4bb8-a6d0-1a600eaa9963.png">

3. Assignee on issues and PR Sidebar, Reviewer on PR Sidebar
<img width="976" alt="截屏2023-03-14 14 41 06"
src="https://user-images.githubusercontent.com/17645053/224917431-c45d821e-9660-4f58-a196-5979a0bb64ce.png">

<img width="1027" alt="截屏2023-03-14 14 41 58"
src="https://user-images.githubusercontent.com/17645053/224917290-ad4dbc52-0c20-45c4-9fce-9dcd59ad7d47.png">

4. Assignee when creating new issue
<img width="961" alt="截屏2023-03-14 14 44 33"
src="https://user-images.githubusercontent.com/17645053/224917694-34bee5a7-e975-4f37-8862-56ebc2556808.png">

5. Whitelisted users for pushing, Whitelisted users for merging and
Whitelisted reviewers in Protected branch settings
<img width="920" alt="截屏2023-03-14 14 48 56"
src="https://user-images.githubusercontent.com/17645053/224918551-9b46b44e-b075-4895-8d33-1aafc7d3c8e5.png">
<img width="901" alt="截屏2023-03-14 14 49 02"
src="https://user-images.githubusercontent.com/17645053/224918584-efa66f23-a593-4e26-a3eb-bb1fbc5516ae.png">
<img width="944" alt="截屏2023-03-14 14 49 21"
src="https://user-images.githubusercontent.com/17645053/224918591-be60455d-0513-4f66-84f6-b5e1bc40ff91.png">


6.  "Allowed users" in tags settings
<img width="935" alt="截屏2023-03-14 14 50 11"
src="https://user-images.githubusercontent.com/17645053/224918701-797699aa-c7e5-4290-b3fe-27dcead1c6c7.png">
2023-03-16 11:32:25 -05:00

132 lines
4.9 KiB
Handlebars

{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository settings edit">
{{template "repo/header" .}}
{{template "repo/settings/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
{{if .Repository.IsArchived}}
<div class="ui warning message">
{{.locale.Tr "repo.settings.archive.tagsettings_unavailable"}}
</div>
{{else}}
<h4 class="ui top attached header">
{{.locale.Tr "repo.settings.tags.protection"}}
</h4>
<div class="ui attached segment">
<div class="ui grid">
<div class="eight wide column">
<div class="ui segment">
<form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<div class="field">
<label>{{.locale.Tr "repo.settings.tags.protection.pattern"}}</label>
<div id="search-tag-box" class="ui search">
<div class="ui input">
<input class="prompt" name="name_pattern" autocomplete="off" value="{{.name_pattern}}" placeholder="v*" autofocus required>
</div>
<div class="help">{{.locale.Tr "repo.settings.tags.protection.pattern.description" | Safe}}</div>
</div>
</div>
<div class="whitelist field">
<label>{{.locale.Tr "repo.settings.tags.protection.allowed.users"}}</label>
<div class="ui multiple search selection dropdown">
<input type="hidden" name="allowlist_users" value="{{.allowlist_users}}">
<div class="default text">{{.locale.Tr "repo.settings.protect_whitelist_search_users"}}</div>
<div class="menu">
{{range .Users}}
<div class="item" data-value="{{.ID}}">
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
</div>
{{end}}
</div>
</div>
</div>
{{if .Owner.IsOrganization}}
<div class="whitelist field">
<label>{{.locale.Tr "repo.settings.tags.protection.allowed.teams"}}</label>
<div class="ui multiple search selection dropdown">
<input type="hidden" name="allowlist_teams" value="{{.allowlist_teams}}">
<div class="default text">{{.locale.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
<div class="menu">
{{range .Teams}}
<div class="item" data-value="{{.ID}}">
{{svg "octicon-people"}}
{{.Name}}
</div>
{{end}}
</div>
</div>
</div>
{{end}}
<div class="field">
{{if .PageIsEditProtectedTag}}
<button class="ui green button">
{{$.locale.Tr "save"}}
</button>
<a class="ui primary button" href="{{$.RepoLink}}/settings/tags">
{{$.locale.Tr "cancel"}}
</a>
{{else}}
<button class="ui green button">
{{$.locale.Tr "repo.settings.tags.protection.create"}}
</button>
{{end}}
</div>
</form>
</div>
</div>
<div class="sixteen wide column">
<table class="ui single line table">
<thead>
<th>{{.locale.Tr "repo.settings.tags.protection.pattern"}}</th>
<th>{{.locale.Tr "repo.settings.tags.protection.allowed"}}</th>
<th></th>
</thead>
<tbody>
{{range .ProtectedTags}}
<tr>
<td><pre>{{.NamePattern}}</pre></td>
<td>
{{if or .AllowlistUserIDs (and $.Owner.IsOrganization .AllowlistTeamIDs)}}
{{$userIDs := .AllowlistUserIDs}}
{{range $.Users}}
{{if contain $userIDs .ID}}
<a class="ui basic label" href="{{.HomeLink}}">{{avatar $.Context . 26}} {{.GetDisplayName}}</a>
{{end}}
{{end}}
{{if $.Owner.IsOrganization}}
{{$teamIDs := .AllowlistTeamIDs}}
{{range $.Teams}}
{{if contain $teamIDs .ID}}
<a class="ui basic label" href="{{$.Owner.OrganisationLink}}/teams/{{PathEscape .LowerName}}">{{.Name}}</a>
{{end}}
{{end}}
{{end}}
{{else}}
{{$.locale.Tr "repo.settings.tags.protection.allowed.noone"}}
{{end}}
</td>
<td class="right aligned">
<a class="ui tiny primary button" href="{{$.RepoLink}}/settings/tags/{{.ID}}">{{$.locale.Tr "edit"}}</a>
<form class="gt-dib" action="{{$.RepoLink}}/settings/tags/delete" method="post">
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{.ID}}" />
<button class="ui tiny red button">{{$.locale.Tr "remove"}}</button>
</form>
</td>
</tr>
{{else}}
<tr class="center aligned"><td colspan="3">{{.locale.Tr "repo.settings.tags.protection.none"}}</td></tr>
{{end}}
</tbody>
</table>
</div>
</div>
</div>
{{end}}
</div>
</div>
{{template "base/footer" .}}