diff options
author | Hester Gong <hestergong@gmail.com> | 2023-03-17 00:32:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-16 11:32:25 -0500 |
commit | 661e78bed5c0879c32c53eb60f3d6898b93e1f08 (patch) | |
tree | 59351ec61728241d7180a1e1c6b45c427a4cdf8d | |
parent | 49389456687a923c1809df8d6eb5ce72c30404f0 (diff) | |
download | gitea-661e78bed5c0879c32c53eb60f3d6898b93e1f08.tar.gz gitea-661e78bed5c0879c32c53eb60f3d6898b93e1f08.zip |
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`](https://github.com/go-gitea/gitea/blob/6ff5400af91aefb02cbc7dd59f6be23cc2bf7865/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">
-rw-r--r-- | modules/templates/helper.go | 3 | ||||
-rw-r--r-- | templates/repo/issue/list.tmpl | 4 | ||||
-rw-r--r-- | templates/repo/issue/milestone_issues.tmpl | 9 | ||||
-rw-r--r-- | templates/repo/issue/new_form.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 6 | ||||
-rw-r--r-- | templates/repo/search_name.tmpl | 1 | ||||
-rw-r--r-- | templates/repo/settings/protected_branch.tmpl | 9 | ||||
-rw-r--r-- | templates/repo/settings/tags.tmpl | 3 | ||||
-rw-r--r-- | web_src/css/repository.css | 4 |
9 files changed, 23 insertions, 18 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 822bbbd9b1..a8343428dc 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -109,6 +109,9 @@ func NewFuncMap() []template.FuncMap { "CustomEmojis": func() map[string]string { return setting.UI.CustomEmojisMap }, + "IsShowFullName": func() bool { + return setting.UI.DefaultShowFullName + }, "Safe": Safe, "SafeJS": SafeJS, "JSEscape": JSEscape, diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 36faf86113..975d659470 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -134,7 +134,7 @@ <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}">{{.locale.Tr "repo.issues.filter_poster_no_select"}}</a> {{range .Posters}} <a class="{{if eq $.PosterID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{.ID}}"> - {{avatar $.Context .}} {{.GetDisplayName}} + {{avatar $.Context .}}{{template "repo/search_name" .}} </a> {{end}} </div> @@ -154,7 +154,7 @@ <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_assginee_no_select"}}</a> {{range .Assignees}} <a class="{{if eq $.AssigneeID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{.ID}}&poster={{$.PosterID}}"> - {{avatar $.Context .}} {{.GetDisplayName}} + {{avatar $.Context .}}{{template "repo/search_name" .}} </a> {{end}} </div> diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index b4f036d32a..cb20fb0c56 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -70,10 +70,14 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} </span> <div class="menu"> + <div class="ui icon search input"> + <i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{.locale.Tr "repo.issues.filter_poster"}}"> + </div> <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&assignee={{$.AssigneeID}}">{{.locale.Tr "repo.issues.filter_poster_no_select"}}</a> {{range .Posters}} <a class="{{if eq $.PosterID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&assignee={{$.AssigneeID}}&poster={{.ID}}"> - {{avatar $.Context .}} {{.GetDisplayName}} + {{avatar $.Context .}}{{template "repo/search_name" .}} </a> {{end}} </div> @@ -93,8 +97,7 @@ <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_assginee_no_select"}}</a> {{range .Assignees}} <a class="{{if eq $.AssigneeID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&assignee={{.ID}}&poster={{$.PosterID}}"> - {{avatar $.Context . 28 "gt-mr-2"}} - {{.GetDisplayName}} + {{avatar $.Context . 28 "gt-mr-2"}}{{template "repo/search_name" .}} </a> {{end}} </div> diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index a99ceb0451..b45a00f781 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -186,7 +186,7 @@ <a class="item muted" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}"> <span class="octicon-check invisible">{{svg "octicon-check"}}</span> <span class="text"> - {{avatar $.Context . 28 "gt-mr-3"}}{{.GetDisplayName}} + {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" .}} </span> </a> {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 165dca7e0c..40d87b4178 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -26,8 +26,7 @@ <a class="{{if not .CanChange}}ui tooltip{{end}} item {{if .Checked}} checked {{end}} {{if not .CanChange}}ban-change{{end}}" href="#" data-id="{{.ItemID}}" data-id-selector="#review_request_{{.ItemID}}" {{if not .CanChange}} data-content="{{$.locale.Tr "repo.issues.remove_request_review_block"}}"{{end}}> <span class="octicon-check {{if not .Checked}}invisible{{end}}">{{svg "octicon-check"}}</span> <span class="text"> - {{avatar $.Context .User 28 "gt-mr-3"}} - {{.User.GetDisplayName}} + {{avatar $.Context .User 28 "gt-mr-3"}}{{template "repo/search_name" .User}} </span> </a> {{end}} @@ -258,8 +257,7 @@ {{end}} <span class="octicon-check {{if not $checked}}invisible{{end}}">{{svg "octicon-check"}}</span> <span class="text"> - {{avatar $.Context . 28 "gt-mr-3"}} - {{.GetDisplayName}} + {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" .}} </span> </a> {{end}} diff --git a/templates/repo/search_name.tmpl b/templates/repo/search_name.tmpl new file mode 100644 index 0000000000..468f6c394c --- /dev/null +++ b/templates/repo/search_name.tmpl @@ -0,0 +1 @@ +{{.Name}}{{if IsShowFullName}}<span class="search-fullname"> {{.FullName}}</span>{{end}} diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index 88350c5999..d63fed46bc 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -49,8 +49,7 @@ <div class="menu"> {{range .Users}} <div class="item" data-value="{{.ID}}"> - {{avatar $.Context . 28 "mini"}} - {{.GetDisplayName}} + {{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}} </div> {{end}} </div> @@ -101,8 +100,7 @@ <div class="menu"> {{range .Users}} <div class="item" data-value="{{.ID}}"> - {{avatar $.Context . 28 "mini"}} - {{.GetDisplayName}} + {{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}} </div> {{end}} </div> @@ -181,8 +179,7 @@ <div class="menu"> {{range .Users}} <div class="item" data-value="{{.ID}}"> - {{avatar $.Context . 28 "mini"}} - {{.GetDisplayName}} + {{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}} </div> {{end}} </div> diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl index 7b318955ec..aa23c6a57d 100644 --- a/templates/repo/settings/tags.tmpl +++ b/templates/repo/settings/tags.tmpl @@ -36,8 +36,7 @@ <div class="menu"> {{range .Users}} <div class="item" data-value="{{.ID}}"> - {{avatar $.Context . 28 "mini"}} - {{.GetDisplayName}} + {{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}} </div> {{end}} </div> diff --git a/web_src/css/repository.css b/web_src/css/repository.css index ad2ac49b99..bebe3ff8f4 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -3627,3 +3627,7 @@ td.blob-excerpt { .pr-status .status-details > span { padding-right: 0.5em; /* To match the alignment with the "required" label */ } + +.search-fullname { + color: var(--color-text-light-2); +} |