mirror of
https://gitea.com/gitea/gitea-mirror.git
synced 2026-03-20 11:50:27 +00: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:
@@ -1,5 +1,7 @@
|
|||||||
{{$pageMeta := .}}
|
{{$pageMeta := .}}
|
||||||
{{$data := .AssigneesData}}
|
{{$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}}
|
{{$issueAssignees := NIL}}{{if $pageMeta.Issue}}{{$issueAssignees = $pageMeta.Issue.Assignees}}{{end}}
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<div class="issue-sidebar-combo" data-selection-mode="multiple" data-update-algo="diff"
|
<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="item clear-selection" data-text="">{{ctx.Locale.Tr "repo.issues.new.clear_assignees"}}</div>
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
{{range $data.CandidateAssignees}}
|
{{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>
|
<span class="item-check-mark">{{svg "octicon-check"}}</span>
|
||||||
{{ctx.AvatarUtils.Avatar . 20}} {{template "repo/search_name" .}}
|
{{ctx.AvatarUtils.Avatar . 20}} {{template "repo/search_name" .}}
|
||||||
</a>
|
</a>
|
||||||
@@ -30,8 +32,8 @@
|
|||||||
<div class="ui relaxed list muted-links flex-items-block">
|
<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>
|
<span class="item empty-list {{if $issueAssignees}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_assignees"}}</span>
|
||||||
{{range $issueAssignees}}
|
{{range $issueAssignees}}
|
||||||
<a class="item" href="{{$pageMeta.RepoLink}}/{{if $pageMeta.IsPullRequest}}pulls{{else}}issues{{end}}?assignee={{.ID}}">
|
<a class="item" href="{{$listBaseLink}}?assignee={{.ID}}">
|
||||||
{{ctx.AvatarUtils.Avatar . 20}} {{.GetDisplayName}}
|
{{ctx.AvatarUtils.Avatar . 20}} {{.GetDisplayName}}
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{{$pageMeta := .}}
|
{{$pageMeta := .}}
|
||||||
{{$data := .LabelsData}}
|
{{$data := .LabelsData}}
|
||||||
|
{{$listBaseLink := print $pageMeta.RepoLink (Iif $pageMeta.IsPullRequest "/pulls" "/issues")}}
|
||||||
<div class="issue-sidebar-combo" data-selection-mode="multiple" data-update-algo="diff"
|
<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}}
|
{{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>
|
<div class="divider" data-scope="{{.ExclusiveScope}}"></div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{$previousExclusiveScope = $exclusiveScope}}
|
{{$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}}
|
{{end}}
|
||||||
{{if and $data.RepoLabels $data.OrgLabels}}<div class="divider"></div>{{end}}
|
{{if and $data.RepoLabels $data.OrgLabels}}<div class="divider"></div>{{end}}
|
||||||
{{$previousExclusiveScope = "_no_scope"}}
|
{{$previousExclusiveScope = "_no_scope"}}
|
||||||
@@ -36,7 +37,7 @@
|
|||||||
<div class="divider" data-scope="{{.ExclusiveScope}}"></div>
|
<div class="divider" data-scope="{{.ExclusiveScope}}"></div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{$previousExclusiveScope = $exclusiveScope}}
|
{{$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}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{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>
|
<span class="item empty-list {{if $data.SelectedLabelIDs}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_label"}}</span>
|
||||||
{{range $data.AllLabels}}
|
{{range $data.AllLabels}}
|
||||||
{{if .IsChecked}}
|
{{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 . -}}
|
{{- ctx.RenderUtils.RenderLabel . -}}
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{{$label := .Label}}
|
{{$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}}
|
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>
|
<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.
|
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.
|
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.
|
The items with the same data-scope only allow one selected at a time.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user