mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-21 21:55:30 +03:00
d731dc793b
- Currently if you want to update the milestone of an issue or pull request, your whole page will be reloaded to reflect the newly set milestone. This is quite unecessary, as only the milestone text is updated and a new timeline event is added. - This patch converts the milestone section in the issue/pull request sidebar to use HTMX, so it becomes a progressive element and avoids reloading the whole page to update the milestone. - The update of the milestone section itself is quite straightforward and nothing special is happening. To support adding new timeline events, a new element `#insert-timeline` is conviently placed after the last timeline event, which can be used with [`hx-swap-oob`](https://htmx.org/attributes/hx-swap-oob/) to position new timeline events before that element. - Adds E2E test.
38 lines
1.3 KiB
Go HTML Template
38 lines
1.3 KiB
Go HTML Template
{{if or .OpenMilestones .ClosedMilestones}}
|
|
<div class="ui icon search input">
|
|
<i class="icon">{{svg "octicon-search" 16}}</i>
|
|
<input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_milestones"}}">
|
|
</div>
|
|
<div class="divider"></div>
|
|
{{end}}
|
|
<div class="no-select item" hx-post="{{$.RepoLink}}/issues/milestone?issue_ids={{$.Issue.ID}}&htmx=true">{{ctx.Locale.Tr "repo.issues.new.clear_milestone"}}</div>
|
|
{{if and (not .OpenMilestones) (not .ClosedMilestones)}}
|
|
<div class="disabled item">
|
|
{{ctx.Locale.Tr "repo.issues.new.no_items"}}
|
|
</div>
|
|
{{else}}
|
|
{{if .OpenMilestones}}
|
|
<div class="divider"></div>
|
|
<div class="header">
|
|
{{ctx.Locale.Tr "repo.issues.new.open_milestone"}}
|
|
</div>
|
|
{{range .OpenMilestones}}
|
|
<a class="item" hx-post="{{$.RepoLink}}/issues/milestone?id={{.ID}}&issue_ids={{$.Issue.ID}}&htmx=true">
|
|
{{svg "octicon-milestone" 16 "tw-mr-1"}}
|
|
{{.Name}}
|
|
</a>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .ClosedMilestones}}
|
|
<div class="divider"></div>
|
|
<div class="header">
|
|
{{ctx.Locale.Tr "repo.issues.new.closed_milestone"}}
|
|
</div>
|
|
{{range .ClosedMilestones}}
|
|
<a class="item" hx-post="{{$.RepoLink}}/issues/milestone?id={{.ID}}&issue_ids={{$.Issue.ID}}&htmx=true">
|
|
{{svg "octicon-milestone" 16 "tw-mr-1"}}
|
|
{{.Name}}
|
|
</a>
|
|
{{end}}
|
|
{{end}}
|
|
{{end}}
|