mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-13 17:15:49 +08:00
58c634b854
Introduce `issueSidebarLabelsData` to handle all sidebar labels related data.
52 lines
2.2 KiB
Handlebars
52 lines
2.2 KiB
Handlebars
{{$data := .}}
|
|
{{$canChange := and ctx.RootData.HasIssuesOrPullsWritePermission (not $data.Repository.IsArchived)}}
|
|
<div class="issue-sidebar-combo" {{if $data.IssueID}}data-update-url="{{$data.RepoLink}}/issues/labels?issue_ids={{$data.IssueID}}"{{end}}>
|
|
<input class="combo-value" name="label_ids" type="hidden" value="{{$data.SelectedLabelIDs}}">
|
|
<div class="ui dropdown {{if not $canChange}}disabled{{end}}">
|
|
<a class="text muted">
|
|
<strong>{{ctx.Locale.Tr "repo.issues.new.labels"}}</strong> {{if $canChange}}{{svg "octicon-gear"}}{{end}}
|
|
</a>
|
|
<div class="menu">
|
|
{{if not $data.AllLabels}}
|
|
<div class="item disabled">{{ctx.Locale.Tr "repo.issues.new.no_items"}}</div>
|
|
{{else}}
|
|
<div class="ui icon search input">
|
|
<i class="icon">{{svg "octicon-search" 16}}</i>
|
|
<input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_labels"}}">
|
|
</div>
|
|
<a class="item clear-selection" href="#">{{ctx.Locale.Tr "repo.issues.new.clear_labels"}}</a>
|
|
{{$previousExclusiveScope := "_no_scope"}}
|
|
{{range .RepoLabels}}
|
|
{{$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}}
|
|
<div class="divider"></div>
|
|
{{$previousExclusiveScope = "_no_scope"}}
|
|
{{range .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}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="ui list labels-list tw-my-2 tw-flex tw-gap-2">
|
|
<span class="item empty-list {{if $data.SelectedLabelIDs}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_label"}}</span>
|
|
{{range $data.AllLabels}}
|
|
{{if .IsChecked}}
|
|
<a class="item" href="{{$data.RepoLink}}/{{if $data.IsPullRequest}}pulls{{else}}issues{{end}}?labels={{.ID}}">
|
|
{{- ctx.RenderUtils.RenderLabel . -}}
|
|
</a>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|