sort target versions by release date
This commit is contained in:
parent
b9b128e92f
commit
7eb6abf250
6
data.go
6
data.go
@ -63,6 +63,7 @@ func NewData(ctx context.Context, url, token string, num int) *Data {
|
||||
}
|
||||
funcMap := map[string]any{
|
||||
"OrderedBy": OrderedBy,
|
||||
"Reverse": sort.Reverse,
|
||||
}
|
||||
data.tmpl = template.Must(template.New("index").Funcs(funcMap).ParseFS(content, "*.tmpl"))
|
||||
|
||||
@ -284,6 +285,11 @@ func (d *Data) VersionsByDate() VersionsByDate {
|
||||
return VersionsByDate(d.Project.Versions)
|
||||
}
|
||||
|
||||
func (d VersionsByDate) Sort() VersionsByDate {
|
||||
sort.Sort(d)
|
||||
return d
|
||||
}
|
||||
|
||||
func (d *Data) Categories() (cs []string) {
|
||||
d.mux.RLock()
|
||||
defer d.mux.RUnlock()
|
||||
|
17
table.tmpl
17
table.tmpl
@ -91,30 +91,27 @@ details[open].issue {
|
||||
{{- $top := . -}}
|
||||
{{- $features := .Features -}}
|
||||
{{- $issues := .Issues -}}
|
||||
{{- $versions := .VersionsByDate -}}
|
||||
{{- $versions := .VersionsByDate.Sort -}}
|
||||
<!--p>
|
||||
{{- range $top.Tags -}}<button>{{ . }}</button>{{- end -}}
|
||||
</p-->
|
||||
<table>
|
||||
<tr>
|
||||
<th class="side"></th>
|
||||
{{- range $vname := $top.TargetVersions }}
|
||||
{{- with $version := $versions.Get . }}
|
||||
{{- range $version := $versions }}
|
||||
<th>
|
||||
<details class="version">
|
||||
<summary><b>{{ $vname }}</b> <span class="right">({{ $version.Timestamp.Format "02 Jan 06"}})</span></summary>
|
||||
<summary><b>{{ $version.Name }}</b> <span class="right">({{ $version.Timestamp.Format "02 Jan 06"}})</span></summary>
|
||||
<div>{{ $version.Description }}</div>
|
||||
</details>
|
||||
</th>
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
</tr>
|
||||
{{- range $cat := $top.Categories }}
|
||||
<tr>
|
||||
<th class="side">{{ . }}</th>
|
||||
{{- range $tar := $top.TargetVersions }}
|
||||
{{- with $version := $versions.Get . }}
|
||||
<td><div class="minh">{{ with $features.ByCategoryAndTarget $cat $tar }}
|
||||
{{- range $version := $versions }}
|
||||
<td><div class="minh">{{ with $features.ByCategoryAndTarget $cat $version.Name }}
|
||||
<details class="feature">
|
||||
<summary>
|
||||
<div>{{ $l := len .}}{{ if lt 1 $l }}{{ $l }} features{{ else }}1 feature{{ end }}</div>
|
||||
@ -133,7 +130,7 @@ details[open].issue {
|
||||
{{- end}}
|
||||
</details>
|
||||
{{- end }}
|
||||
{{- with $issues.ByCategoryAndTarget $cat $tar }}
|
||||
{{- with $issues.ByCategoryAndTarget $cat $version.Name }}
|
||||
<details class="issue">
|
||||
<summary>
|
||||
<div>{{ $l := len .}}{{ if lt 1 $l }}{{ $l }} issues{{ else }}1 issue{{ end }}</div>
|
||||
@ -147,7 +144,7 @@ details[open].issue {
|
||||
{{- end}}
|
||||
</details>
|
||||
{{ end -}}
|
||||
</div></td>{{ end }}
|
||||
</div></td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{- end}}
|
||||
|
Loading…
Reference in New Issue
Block a user