File tree Expand file tree Collapse file tree 5 files changed +29
-22
lines changed Expand file tree Collapse file tree 5 files changed +29
-22
lines changed Original file line number Diff line number Diff line change @@ -184,18 +184,23 @@ func (l *Label) BelongsToRepo() bool {
184184 return l .RepoID > 0
185185}
186186
187- // ExclusiveScope returns scope substring of label name, or empty string if none exists
188- func (l * Label ) ExclusiveScope () string {
189- if ! l .Exclusive {
190- return ""
191- }
187+ // Return scope substring of label name, or empty string if none exists
188+ func (l * Label ) Scope () string {
192189 lastIndex := strings .LastIndex (l .Name , "/" )
193190 if lastIndex == - 1 || lastIndex == 0 || lastIndex == len (l .Name )- 1 {
194191 return ""
195192 }
196193 return l .Name [:lastIndex ]
197194}
198195
196+ // ExclusiveScope returns scope substring of label name, or empty string if none exists
197+ func (l * Label ) ExclusiveScope () string {
198+ if ! l .Exclusive {
199+ return ""
200+ }
201+ return l .Scope ()
202+ }
203+
199204// NewLabel creates a new label
200205func NewLabel (ctx context.Context , l * Label ) error {
201206 color , err := label .NormalizeColor (l .Color )
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ func (ut *RenderUtils) RenderLabel(label *issues_model.Label) template.HTML {
127127 locale := ut .ctx .Value (translation .ContextKey ).(translation.Locale )
128128 var extraCSSClasses string
129129 textColor := util .ContrastColor (label .Color )
130- labelScope := label .ExclusiveScope ()
130+ labelScope := label .Scope ()
131131 descriptionText := emoji .ReplaceAliases (label .Description )
132132
133133 if label .IsArchived () {
Original file line number Diff line number Diff line change 2222 <div class="item issue-action" data-action="clear" data-url="{{$.RepoLink}}/issues/labels">
2323 {{ctx.Locale.Tr "repo.issues.new.clear_labels"}}
2424 </div>
25- {{$previousExclusiveScope := "_no_scope"}}
25+ {{$previousScope := "_no_scope"}}
2626 {{range .Labels}}
27- {{$exclusiveScope := .ExclusiveScope }}
28- {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope )}}
27+ {{$scope := .Scope }}
28+ {{if and (ne $previousScope "_no_scope") (ne $previousScope $scope )}}
2929 <div class="divider"></div>
3030 {{end}}
31- {{$previousExclusiveScope = $exclusiveScope }}
31+ {{$previousScope = $scope }}
3232 <div class="item issue-action tw-flex tw-justify-between" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels">
33- {{if SliceUtils.Contains $.SelLabelIDs .ID}}{{svg (Iif $exclusiveScope "octicon-dot-fill" "octicon-check")}}{{end}} {{ctx.RenderUtils.RenderLabel .}}
33+ {{if SliceUtils.Contains $.SelLabelIDs .ID}}{{svg (Iif .ExclusiveScope "octicon-dot-fill" "octicon-check")}}{{end}} {{ctx.RenderUtils.RenderLabel .}}
3434 {{template "repo/issue/labels/label_archived" .}}
3535 </div>
3636 {{end}}
Original file line number Diff line number Diff line change 2626 {{/* The logic here is not the same as the label selector in the issue sidebar.
2727 The one in the issue sidebar renders "repo labels | divider | org labels".
2828 Maybe the logic should be updated to be consistent.*/}}
29- {{$previousExclusiveScope := "_no_scope"}}
29+ {{$previousScope := "_no_scope"}}
3030 {{range .Labels}}
31- {{$exclusiveScope := .ExclusiveScope }}
32- {{if and (ne $previousExclusiveScope $exclusiveScope )}}
31+ {{$scope := .Scope }}
32+ {{if and (ne $previousScope $scope )}}
3333 <div class="divider" data-scope="{{.ExclusiveScope}}"></div>
3434 {{end}}
35- {{$previousExclusiveScope = $exclusiveScope }}
35+ {{$previousScope = $scope }}
3636 <a class="item label-filter-query-item" data-label-id="{{.ID}}" data-scope="{{.ExclusiveScope}}" {{if .IsArchived}}data-is-archived{{end}}
3737 href="{{QueryBuild $queryLink "labels" .QueryString}}">
3838 {{if .IsExcluded}}
3939 {{svg "octicon-circle-slash"}}
4040 {{else if .IsSelected}}
41- {{Iif $exclusiveScope (svg "octicon-dot-fill") (svg "octicon-check")}}
41+ {{Iif .ExclusiveScope (svg "octicon-dot-fill") (svg "octicon-check")}}
4242 {{end}}
4343 {{ctx.RenderUtils.RenderLabel .}}
4444 <p class="tw-ml-auto">{{template "repo/issue/labels/label_archived" .}}</p>
Original file line number Diff line number Diff line change 1919 <div class="scrolling menu">
2020 <a class="item clear-selection" data-text="" href="#">{{ctx.Locale.Tr "repo.issues.new.clear_labels"}}</a>
2121 <div class="divider"></div>
22- {{$previousExclusiveScope := "_no_scope"}}
22+ {{$previousScope := "_no_scope"}}
2323 {{range $data.RepoLabels}}
24+ {{$scope := .Scope}}
2425 {{$exclusiveScope := .ExclusiveScope}}
25- {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope )}}
26+ {{if and (ne $previousScope "_no_scope") (ne $previousScope $scope )}}
2627 <div class="divider" data-scope="{{.ExclusiveScope}}"></div>
2728 {{end}}
28- {{$previousExclusiveScope = $exclusiveScope }}
29+ {{$previousScope = $scope }}
2930 {{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
3031 {{end}}
3132 {{if and $data.RepoLabels $data.OrgLabels}}<div class="divider"></div>{{end}}
32- {{$previousExclusiveScope = "_no_scope"}}
33+ {{$previousScope = "_no_scope"}}
3334 {{range $data.OrgLabels}}
35+ {{$scope := .Scope}}
3436 {{$exclusiveScope := .ExclusiveScope}}
35- {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope )}}
37+ {{if and (ne $previousScope "_no_scope") (ne $previousScope $scope )}}
3638 <div class="divider" data-scope="{{.ExclusiveScope}}"></div>
3739 {{end}}
38- {{$previousExclusiveScope = $exclusiveScope }}
40+ {{$previousScope = $scope }}
3941 {{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
4042 {{end}}
4143 </div>
You can’t perform that action at this time.
0 commit comments