diff options
author | Özgür Kesim <oec@codeblau.de> | 2024-09-04 20:08:49 +0200 |
---|---|---|
committer | Özgür Kesim <oec@codeblau.de> | 2024-09-04 20:08:49 +0200 |
commit | 7eb6abf25009a4d53ca18e4d4ac01c810b52ea48 (patch) | |
tree | ac1868f712617b3f048e9e18738a2223b57c7449 | |
parent | b9b128e92ff19335a318a6e15fc9ce379905ec8f (diff) |
sort target versions by release date
-rw-r--r-- | data.go | 6 | ||||
-rw-r--r-- | table.tmpl | 17 |
2 files changed, 13 insertions, 10 deletions
@@ -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() @@ -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}} |