mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-10 00:42:55 +01:00
Follow-up to #32465: Fix the assignee sidebar after the selector refactor. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
08b7a30867
commit
c401cda108
@ -1,5 +1,7 @@
|
||||
{{$pageMeta := .}}
|
||||
{{$data := .AssigneesData}}
|
||||
{{$listBaseLink := print $pageMeta.RepoLink (Iif $pageMeta.IsPullRequest "/pulls" "/issues")}}
|
||||
{{/* TODO: it seems that the code keeps checking $pageMeta.Issue and assumes that it might not exist, need to figure out why */}}
|
||||
{{$issueAssignees := NIL}}{{if $pageMeta.Issue}}{{$issueAssignees = $pageMeta.Issue.Assignees}}{{end}}
|
||||
<div class="divider"></div>
|
||||
<div class="issue-sidebar-combo" data-selection-mode="multiple" data-update-algo="diff"
|
||||
@ -19,7 +21,7 @@
|
||||
<div class="item clear-selection" data-text="">{{ctx.Locale.Tr "repo.issues.new.clear_assignees"}}</div>
|
||||
<div class="divider"></div>
|
||||
{{range $data.CandidateAssignees}}
|
||||
<a class="item" href="#" data-value="{{.ID}}">
|
||||
<a class="item" href="{{$listBaseLink}}?assignee={{.ID}}" data-value="{{.ID}}">
|
||||
<span class="item-check-mark">{{svg "octicon-check"}}</span>
|
||||
{{ctx.AvatarUtils.Avatar . 20}} {{template "repo/search_name" .}}
|
||||
</a>
|
||||
@ -30,8 +32,8 @@
|
||||
<div class="ui relaxed list muted-links flex-items-block">
|
||||
<span class="item empty-list {{if $issueAssignees}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_assignees"}}</span>
|
||||
{{range $issueAssignees}}
|
||||
<a class="item" href="{{$pageMeta.RepoLink}}/{{if $pageMeta.IsPullRequest}}pulls{{else}}issues{{end}}?assignee={{.ID}}">
|
||||
{{ctx.AvatarUtils.Avatar . 20}} {{.GetDisplayName}}
|
||||
<a class="item" href="{{$listBaseLink}}?assignee={{.ID}}">
|
||||
{{ctx.AvatarUtils.Avatar . 20}} {{.GetDisplayName}}
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{{$pageMeta := .}}
|
||||
{{$data := .LabelsData}}
|
||||
{{$listBaseLink := print $pageMeta.RepoLink (Iif $pageMeta.IsPullRequest "/pulls" "/issues")}}
|
||||
<div class="issue-sidebar-combo" data-selection-mode="multiple" data-update-algo="diff"
|
||||
{{if $pageMeta.Issue}}data-update-url="{{$pageMeta.RepoLink}}/issues/labels?issue_ids={{$pageMeta.Issue.ID}}"{{end}}
|
||||
>
|
||||
@ -26,7 +27,7 @@
|
||||
<div class="divider" data-scope="{{.ExclusiveScope}}"></div>
|
||||
{{end}}
|
||||
{{$previousExclusiveScope = $exclusiveScope}}
|
||||
{{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
|
||||
{{template "repo/issue/sidebar/label_list_item" dict "Label" . "LabelLink" (print $listBaseLink "?labels=" .ID)}}
|
||||
{{end}}
|
||||
{{if and $data.RepoLabels $data.OrgLabels}}<div class="divider"></div>{{end}}
|
||||
{{$previousExclusiveScope = "_no_scope"}}
|
||||
@ -36,7 +37,7 @@
|
||||
<div class="divider" data-scope="{{.ExclusiveScope}}"></div>
|
||||
{{end}}
|
||||
{{$previousExclusiveScope = $exclusiveScope}}
|
||||
{{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
|
||||
{{template "repo/issue/sidebar/label_list_item" dict "Label" . "LabelLink" (print $listBaseLink "?labels=" .ID)}}
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
@ -47,7 +48,7 @@
|
||||
<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="{{$pageMeta.RepoLink}}/{{if $pageMeta.IsPullRequest}}pulls{{else}}issues{{end}}?labels={{.ID}}">
|
||||
<a class="item" href="{{$listBaseLink}}?labels={{.ID}}">
|
||||
{{- ctx.RenderUtils.RenderLabel . -}}
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{{$label := .Label}}
|
||||
<a class="item muted {{if $label.IsChecked}}checked{{else if $label.IsArchived}}tw-hidden{{end}}" href="#"
|
||||
{{$labelLink := or .LabelLink "#"}}
|
||||
<a class="item muted {{if $label.IsChecked}}checked{{else if $label.IsArchived}}tw-hidden{{end}}" href="{{$labelLink}}"
|
||||
data-scope="{{$label.ExclusiveScope}}" data-value="{{$label.ID}}" {{if $label.IsArchived}}data-is-archived{{end}}
|
||||
>
|
||||
<span class="item-check-mark">{{svg (Iif $label.ExclusiveScope "octicon-dot-fill" "octicon-check")}}</span>
|
||||
|
||||
@ -23,6 +23,16 @@ When the selected items change, the `combo-value` input will be updated.
|
||||
If there is `data-update-url`, it also calls backend to attach/detach the changed items.
|
||||
|
||||
Also, the changed items will be synchronized to the `ui list` items.
|
||||
The menu items must have correct `href`, otherwise the links of synchronized (cloned) items would be wrong.
|
||||
|
||||
Synchronization logic:
|
||||
* On page load:
|
||||
* If the dropdown menu contains checked items, there will be no synchronization.
|
||||
In this case, it's assumed that the dropdown menu is already in sync with the list.
|
||||
* If the dropdown menu doesn't contain checked items, it will use dropdown's value to mark the selected items as checked.
|
||||
And the selected (checked) items will be synchronized to the list.
|
||||
* On dropdown selection change:
|
||||
* The selected items will be synchronized to the list after the dropdown is hidden
|
||||
|
||||
The items with the same data-scope only allow one selected at a time.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user