-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Archived label visual bug in labels select #27466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The issue is due to the divider being rendered unconditionally This has been fixed as part of #27668 |
I think the easiest approach to completely fix the problem is by refactoring the code completely. |
This is known issue. |
Does the problem still exist in 1.23? |
Gitea 6bd70d4 |
The problem is that |
I don't know how labels work currently, but I'd imagine backend would for a merged list of labels aka. map[map[int64, string]] and frontend would just print that nested grouped map. With this logic, but would never happen |
It's not that easy. Frontend dropdown needs to "filter" the list. So it also needs to handle such case:
Actually the dropdown could already handles such case, but it is unable to mix these 2 different usages if item2 is hidden by other methods but not by the filter. |
Shouldn't those items that are hidden by other methods be non-existent for dropdown? Where am I missing? |
|
Maybe I fixed it, try this patch diff --git a/templates/repo/issue/sidebar/label_list.tmpl b/templates/repo/issue/sidebar/label_list.tmpl
index fb8f1a667..1d34cf7a7 100644
--- a/templates/repo/issue/sidebar/label_list.tmpl
+++ b/templates/repo/issue/sidebar/label_list.tmpl
@@ -21,5 +21,7 @@
{{$previousExclusiveScope := "_no_scope"}}
- {{range $data.RepoLabels}}
+ {{$previousHadDivider := false}}
+ {{range $data.AllLabels}}
{{$exclusiveScope := .ExclusiveScope}}
- {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}}
+ {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope) (ne $previousHadDivider true)}}
+ {{$previousHadDivider = true}}
<div class="divider"></div>
@@ -27,13 +29,6 @@
{{$previousExclusiveScope = $exclusiveScope}}
- {{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
- {{end}}
- {{if and $data.RepoLabels $data.OrgLabels}}<div class="divider"></div>{{end}}
- {{$previousExclusiveScope = "_no_scope"}}
- {{range $data.OrgLabels}}
- {{$exclusiveScope := .ExclusiveScope}}
- {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}}
- <div class="divider"></div>
+ {{if not .IsArchived}}
+ {{$previousHadDivider = false}}
+ {{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
{{end}}
- {{$previousExclusiveScope = $exclusiveScope}}
- {{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
{{end}}
|
maybe this is better
|
Tested, this patch fixes all cases, including archived label selected and not diff --git a/templates/repo/issue/sidebar/label_list.tmpl b/templates/repo/issue/sidebar/label_list.tmpl
index fb8f1a667..8fd0ff5dd 100644
--- a/templates/repo/issue/sidebar/label_list.tmpl
+++ b/templates/repo/issue/sidebar/label_list.tmpl
@@ -21,19 +21,11 @@
{{$previousExclusiveScope := "_no_scope"}}
- {{range $data.RepoLabels}}
- {{$exclusiveScope := .ExclusiveScope}}
- {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}}
- <div class="divider"></div>
+ {{range $data.AllLabels}}
+ {{if or (not .IsArchived) (.IsChecked)}}
+ {{$exclusiveScope := .ExclusiveScope}}
+ {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}}
+ <div class="divider"></div>
+ {{end}}
+ {{$previousExclusiveScope = $exclusiveScope}}
+ {{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
{{end}}
- {{$previousExclusiveScope = $exclusiveScope}}
- {{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
- {{end}}
- {{if and $data.RepoLabels $data.OrgLabels}}<div class="divider"></div>{{end}}
- {{$previousExclusiveScope = "_no_scope"}}
- {{range $data.OrgLabels}}
- {{$exclusiveScope := .ExclusiveScope}}
- {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}}
- <div class="divider"></div>
- {{end}}
- {{$previousExclusiveScope = $exclusiveScope}}
- {{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
{{end}}
|
No, it won't work. See this: Fix duplicate dropdown dividers #32760 |
Fix #27466 The problem is that any item in the menu could be hidden, pure CSS won't work, and dropdown's builtin "hideDividers" doesn't work with our "scope dividers". The newly introduced "archived" label makes the dividers regression more.
@stuzer05 Thanks for the taking this forward. Now a days I am packed up. This was in my todo list from last year. But unfortunately I could not able to fix it. |
Description
When you have archived non-exclusive label between exclusive label groups the double divider is shown in the place of archived label
Gitea Version
trunk
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
Git Version
No response
Operating System
No response
How are you running Gitea?
docker
Database
None
The text was updated successfully, but these errors were encountered: