-
Notifications
You must be signed in to change notification settings - Fork 3
/
releases.html
105 lines (94 loc) · 4.03 KB
/
releases.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
---
layout: page
permalink: /releases/
title: Releases
redirect_from:
- /releases/all/
- /releases/simpleid/
---
<div class="releases-app" x-data="releasesApp()" x-init="initReleases()">
<div x-show="!isLoading" x-cloak>
<p>
Series:
<select x-model="filter" x-on:change="filterReleases()">
<option value="" x-bind:selected="filter == ''">(All)</option>
<template x-for="(package, index) in packages" :key="index">
<optgroup x-bind:label="package['id']">
<template x-for="package_series in package['series']">
<option x-bind:value="package['id'] + ' ' + package_series.package_series" x-bind:selected="filter == package['id'] + ' ' + package_series.package_series" x-text="package_series.title"></option>
</template>
</optgroup>
</template>
</select>
</p>
<table class="table table-banded releases-table">
<thead>
<tr>
<th>Package</th>
<th>Version</th>
<th>Download</th>
<th>Date</th>
<th>Release Announcement</th>
</tr>
</thead>
<tbody>
<template x-for="(release, index) in releases" :key="index">
<tr x-bind:class="{ odd: ((index + 1) % 2 != 0), even: ((index + 1) % 2 == 0) }">
<td x-text="release.release_package"></td>
<td><a x-bind:href="release.announce_url" x-text="release.release_version"></a></td>
<td><a x-bind:href="release.download_url">Download</a></td>
<td x-text="new Date(release.release_date * 1000).toISOString().substring(0, 10)"></td>
<td><a x-bind:href="release.announce_url">Announcement</a></td>
</tr>
</template>
</tbody>
</table>
<template x-if="seriesInfo">
<p>The source code for this series can be found at
<a x-bind:href="seriesInfo.repo_url" x-text="seriesInfo.repo_url"></a>.
</p>
</template>
</div>
</div>
<script type="text/javascript">
function releasesApp() {
return {
isLoading: false,
filter: '',
seriesInfo: {},
packages: [],
releases: [],
db: {},
initReleases: function() {
this.isLoading = true;
let pairs = window.location.hash.substring(1).split('&');
let params = {};
pairs.forEach((pair) => {
pair = pair.split('=');
params[pair[0]] = decodeURIComponent(pair[1] || '');
});
if (params.filter) this.filter = params.filter;
fetch('{{ "/api/releases.json" | prepend: site.baseurl }}')
.then((results) => results.json())
.then((data) => {
this.packages = data.packages;
this.db = data;
this.isLoading = false;
this.filterReleases();
});
},
filterReleases: function() {
if (this.filter == '') {
window.location.hash = '';
this.releases = this.db.releases;
this.seriesInfo = {};
return;
}
window.location.hash = '#filter=' + encodeURIComponent(this.filter);
let pairs = this.filter.split(' ', 2);
this.releases = this.db.releases.filter((release) => ((release.release_package == pairs[0]) && (release.package_series == pairs[1])));
this.seriesInfo = this.packages.find((pkg) => pkg.id == pairs[0]).series.find((series) => series.package_series == pairs[1]);
}
}
}
</script>