1{{define "app-updates"}}
2{{template "header" .}}
3
4<style type="text/css">
5	p.intro {
6		text-align: left;
7	}
8	p.disabled {
9		font-style: italic;
10		color: #999;
11	}
12</style>
13
14<div class="content-container snug">
15	{{template "admin-header" .}}
16
17{{ if .UpdateChecks }}
18	{{if .CheckFailed}}
19		<p class="intro"><span class="ex failure">&times;</span> Automated update check failed.</p>
20		<p>Installed version: <strong>{{.Version}}</strong> (<a href="{{.CurReleaseNotesURL}}" target="changelog-wf">release notes</a>).</p>
21		<p>Learn about latest releases on the <a href="https://blog.writefreely.org/tag:release" target="changelog-wf">WriteFreely blog</a> or <a href="https://discuss.write.as/c/writefreely/updates" target="forum-wf">forum</a>.</p>
22	{{else if not .UpdateAvailable}}
23		<p class="intro"><span class="check">&check;</span> WriteFreely is <strong>up to date</strong>.</p>
24		<p>Installed version: <strong>{{.Version}}</strong> (<a href="{{.LatestReleaseNotesURL}}" target="changelog-wf">release notes</a>).</p>
25    {{else}}
26		<p class="intro">A new version of WriteFreely is available! <a href="{{.LatestReleaseURL}}" target="download-wf" style="font-weight: bold;">Get {{.LatestVersion}}</a></p>
27		<p class="changelog">
28			<a href="{{.LatestReleaseNotesURL}}" target="changelog-wf">Read the release notes</a> for details on features, bug fixes, and notes on upgrading from your current version, <strong>{{.Version}}</strong>.
29		</p>
30	{{end}}
31	<p style="font-size: 0.86em;"><em>Last checked</em>: <time class="dt-published" datetime="{{.LastChecked8601}}">{{.LastChecked}}</time>. <a href="/admin/updates?check=now">Check now</a>.</p>
32
33	<script>
34	// Code modified from /js/localdate.js
35	var displayEl = document.querySelector("time");
36	var d = new Date(displayEl.getAttribute("datetime"));
37	displayEl.textContent = d.toLocaleDateString(navigator.language || "en-US", { dateStyle: 'long', timeStyle: 'short' });
38	</script>
39{{ else }}
40	<p class="intro disabled">Automated update checks are disabled.</p>
41	<p>Installed version: <strong>{{.Version}}</strong> (<a href="{{.CurReleaseNotesURL}}" target="changelog-wf">release notes</a>).</p>
42	<p>Learn about latest releases on the <a href="https://blog.writefreely.org/tag:release" target="changelog-wf">WriteFreely blog</a> or <a href="https://discuss.write.as/c/writefreely/updates" target="forum-wf">forum</a>.</p>
43{{ end }}
44
45{{template "footer" .}}
46
47{{template "body-end" .}}
48{{end}}
49