forgejo/templates/repo/issue/milestone_issues.tmpl
wxiaoguang 68099f2f00
Refactor some Str2html code (#29397)
This PR touches the most interesting part of the "template refactoring".

1. Unclear variable type. Especially for "web/feed/convert.go":
sometimes it uses text, sometimes it uses HTML.
2. Assign text content to "RenderedContent" field, for example: `
project.RenderedContent = project.Description` in web/org/projects.go
3. Assign rendered content to text field, for example: `r.Note =
rendered content` in web/repo/release.go
4. (possible) Incorrectly calling `{{Str2html
.PackageDescriptor.Metadata.ReleaseNotes}}` in
package/content/nuget.tmpl, I guess the name Str2html misleads
developers to use it to "render string to html", but it only sanitizes.
if ReleaseNotes really contains HTML, then this is not a problem.

(cherry picked from commit e71eb8930a5d0f60874b038c223498b41ad65592)

Conflicts:
	modules/templates/util_string.go
	trivial context conflict
2024-03-06 12:10:44 +08:00

64 lines
2.4 KiB
Go HTML Template

{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository milestone-issue-list">
{{template "repo/header" .}}
<div class="ui container">
<div class="gt-df">
<h1 class="gt-mb-3">{{.Milestone.Name}}</h1>
{{if not .Repository.IsArchived}}
<div class="text right gt-f1">
{{if or .CanWriteIssues .CanWritePulls}}
{{if .Milestone.IsClosed}}
<a class="ui primary basic button link-action" href data-url="{{$.RepoLink}}/milestones/{{.MilestoneID}}/open">{{ctx.Locale.Tr "repo.milestones.open"}}
</a>
{{else}}
<a class="ui red basic button link-action" href data-url="{{$.RepoLink}}/milestones/{{.MilestoneID}}/close">{{ctx.Locale.Tr "repo.milestones.close"}}
</a>
{{end}}
<a class="ui button" href="{{.RepoLink}}/milestones/{{.MilestoneID}}/edit">{{ctx.Locale.Tr "repo.milestones.edit"}}</a>
{{end}}
<a class="ui primary button" href="{{.RepoLink}}/issues/new{{if .NewIssueChooseTemplate}}/choose{{end}}?milestone={{.MilestoneID}}">{{ctx.Locale.Tr "repo.issues.new"}}</a>
</div>
{{end}}
</div>
{{if .Milestone.RenderedContent}}
<div class="markup content gt-mb-4">
{{.Milestone.RenderedContent}}
</div>
{{end}}
<div class="gt-df gt-fc gt-gap-3">
<progress class="milestone-progress-big" value="{{.Milestone.Completeness}}" max="100"></progress>
<div class="gt-df gt-gap-4">
<div classs="gt-df gt-ac">
{{$closedDate:= TimeSinceUnix .Milestone.ClosedDateUnix ctx.Locale}}
{{if .IsClosed}}
{{svg "octicon-clock"}} {{ctx.Locale.Tr "repo.milestones.closed" $closedDate}}
{{else}}
{{if .Milestone.DeadlineString}}
<span{{if .IsOverdue}} class="text red"{{end}}>
{{svg "octicon-calendar"}}
{{DateTime "short" .Milestone.DeadlineString}}
</span>
{{else}}
{{svg "octicon-calendar"}}
{{ctx.Locale.Tr "repo.milestones.no_due_date"}}
{{end}}
{{end}}
</div>
<div class="gt-mr-3">{{ctx.Locale.Tr "repo.milestones.completeness" .Milestone.Completeness}}</div>
{{if .TotalTrackedTime}}
<div data-tooltip-content='{{ctx.Locale.Tr "tracked_time_summary"}}'>
{{svg "octicon-clock"}}
{{.TotalTrackedTime | Sec2Time}}
</div>
{{end}}
</div>
</div>
<div class="divider"></div>
{{template "repo/issue/filters" .}}
{{template "shared/issuelist" dict "." . "listType" "milestone"}}
</div>
</div>
{{template "base/footer" .}}