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 {
184
184
return l .RepoID > 0
185
185
}
186
186
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 {
192
189
lastIndex := strings .LastIndex (l .Name , "/" )
193
190
if lastIndex == - 1 || lastIndex == 0 || lastIndex == len (l .Name )- 1 {
194
191
return ""
195
192
}
196
193
return l .Name [:lastIndex ]
197
194
}
198
195
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
+
199
204
// NewLabel creates a new label
200
205
func NewLabel (ctx context.Context , l * Label ) error {
201
206
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 {
127
127
locale := ut .ctx .Value (translation .ContextKey ).(translation.Locale )
128
128
var extraCSSClasses string
129
129
textColor := util .ContrastColor (label .Color )
130
- labelScope := label .ExclusiveScope ()
130
+ labelScope := label .Scope ()
131
131
descriptionText := emoji .ReplaceAliases (label .Description )
132
132
133
133
if label .IsArchived () {
Original file line number Diff line number Diff line change 22
22
<div class="item issue-action" data-action="clear" data-url="{{$.RepoLink}}/issues/labels">
23
23
{{ctx.Locale.Tr "repo.issues.new.clear_labels"}}
24
24
</div>
25
- {{$previousExclusiveScope := "_no_scope"}}
25
+ {{$previousScope := "_no_scope"}}
26
26
{{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 )}}
29
29
<div class="divider"></div>
30
30
{{end}}
31
- {{$previousExclusiveScope = $exclusiveScope }}
31
+ {{$previousScope = $scope }}
32
32
<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 .}}
34
34
{{template "repo/issue/labels/label_archived" .}}
35
35
</div>
36
36
{{end}}
Original file line number Diff line number Diff line change 26
26
{{/* The logic here is not the same as the label selector in the issue sidebar.
27
27
The one in the issue sidebar renders "repo labels | divider | org labels".
28
28
Maybe the logic should be updated to be consistent.*/}}
29
- {{$previousExclusiveScope := "_no_scope"}}
29
+ {{$previousScope := "_no_scope"}}
30
30
{{range .Labels}}
31
- {{$exclusiveScope := .ExclusiveScope }}
32
- {{if and (ne $previousExclusiveScope $exclusiveScope )}}
31
+ {{$scope := .Scope }}
32
+ {{if and (ne $previousScope $scope )}}
33
33
<div class="divider" data-scope="{{.ExclusiveScope}}"></div>
34
34
{{end}}
35
- {{$previousExclusiveScope = $exclusiveScope }}
35
+ {{$previousScope = $scope }}
36
36
<a class="item label-filter-query-item" data-label-id="{{.ID}}" data-scope="{{.ExclusiveScope}}" {{if .IsArchived}}data-is-archived{{end}}
37
37
href="{{QueryBuild $queryLink "labels" .QueryString}}">
38
38
{{if .IsExcluded}}
39
39
{{svg "octicon-circle-slash"}}
40
40
{{else if .IsSelected}}
41
- {{Iif $exclusiveScope (svg "octicon-dot-fill") (svg "octicon-check")}}
41
+ {{Iif .ExclusiveScope (svg "octicon-dot-fill") (svg "octicon-check")}}
42
42
{{end}}
43
43
{{ctx.RenderUtils.RenderLabel .}}
44
44
<p class="tw-ml-auto">{{template "repo/issue/labels/label_archived" .}}</p>
Original file line number Diff line number Diff line change 19
19
<div class="scrolling menu">
20
20
<a class="item clear-selection" data-text="" href="#">{{ctx.Locale.Tr "repo.issues.new.clear_labels"}}</a>
21
21
<div class="divider"></div>
22
- {{$previousExclusiveScope := "_no_scope"}}
22
+ {{$previousScope := "_no_scope"}}
23
23
{{range $data.RepoLabels}}
24
+ {{$scope := .Scope}}
24
25
{{$exclusiveScope := .ExclusiveScope}}
25
- {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope )}}
26
+ {{if and (ne $previousScope "_no_scope") (ne $previousScope $scope )}}
26
27
<div class="divider" data-scope="{{.ExclusiveScope}}"></div>
27
28
{{end}}
28
- {{$previousExclusiveScope = $exclusiveScope }}
29
+ {{$previousScope = $scope }}
29
30
{{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
30
31
{{end}}
31
32
{{if and $data.RepoLabels $data.OrgLabels}}<div class="divider"></div>{{end}}
32
- {{$previousExclusiveScope = "_no_scope"}}
33
+ {{$previousScope = "_no_scope"}}
33
34
{{range $data.OrgLabels}}
35
+ {{$scope := .Scope}}
34
36
{{$exclusiveScope := .ExclusiveScope}}
35
- {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope )}}
37
+ {{if and (ne $previousScope "_no_scope") (ne $previousScope $scope )}}
36
38
<div class="divider" data-scope="{{.ExclusiveScope}}"></div>
37
39
{{end}}
38
- {{$previousExclusiveScope = $exclusiveScope }}
40
+ {{$previousScope = $scope }}
39
41
{{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
40
42
{{end}}
41
43
</div>
You can’t perform that action at this time.
0 commit comments