mirror of
https://github.com/writefreely/writefreely
synced 2024-11-24 09:33:11 +00:00
Show functional Updates page when checks are disabled
Ref T572
This commit is contained in:
parent
a06bb457de
commit
389dc8b9db
3 changed files with 17 additions and 1 deletions
2
admin.go
2
admin.go
|
@ -583,6 +583,7 @@ func handleViewAdminUpdates(app *App, u *User, w http.ResponseWriter, r *http.Re
|
|||
|
||||
p := struct {
|
||||
*UserPage
|
||||
CurReleaseNotesURL string
|
||||
LastChecked string
|
||||
LastChecked8601 string
|
||||
LatestVersion string
|
||||
|
@ -592,6 +593,7 @@ func handleViewAdminUpdates(app *App, u *User, w http.ResponseWriter, r *http.Re
|
|||
}{
|
||||
UserPage: NewUserPage(app, r, u, "Updates", nil),
|
||||
}
|
||||
p.CurReleaseNotesURL = wfReleaseNotesURL(p.Version)
|
||||
if app.cfg.App.UpdateChecks {
|
||||
p.LastChecked = app.updates.lastCheck.Format("January 2, 2006, 3:04 PM")
|
||||
p.LastChecked8601 = app.updates.lastCheck.Format("2006-01-02T15:04:05Z")
|
||||
|
|
|
@ -5,11 +5,16 @@
|
|||
p.intro {
|
||||
text-align: left;
|
||||
}
|
||||
p.disabled {
|
||||
font-style: italic;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="content-container snug">
|
||||
{{template "admin-header" .}}
|
||||
|
||||
{{ if .UpdateChecks }}
|
||||
{{if not .UpdateAvailable}}
|
||||
<p class="intro"><span class="check">✓</span> WriteFreely is <strong>up to date</strong>.</p>
|
||||
<p>Installed version: <strong>{{.Version}}</strong> (<a href="{{.LatestReleaseNotesURL}}" target="changelog-wf">release notes</a>).</p>
|
||||
|
@ -27,6 +32,11 @@
|
|||
var d = new Date(displayEl.getAttribute("datetime"));
|
||||
displayEl.textContent = d.toLocaleDateString(navigator.language || "en-US", { dateStyle: 'long', timeStyle: 'short' });
|
||||
</script>
|
||||
{{ else }}
|
||||
<p class="intro disabled">Automated update checks are disabled.</p>
|
||||
<p>Installed version: <strong>{{.Version}}</strong> (<a href="{{.CurReleaseNotesURL}}" target="changelog-wf">release notes</a>).</p>
|
||||
<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>
|
||||
{{ end }}
|
||||
|
||||
{{template "footer" .}}
|
||||
|
||||
|
|
|
@ -70,7 +70,11 @@ func (uc updatesCache) ReleaseURL() string {
|
|||
// ReleaseNotesURL returns the full URL to the blog.writefreely.org release notes
|
||||
// for the latest version as stored in the cache.
|
||||
func (uc updatesCache) ReleaseNotesURL() string {
|
||||
ver := strings.TrimPrefix(uc.latestVersion, "v")
|
||||
return wfReleaseNotesURL(uc.latestVersion)
|
||||
}
|
||||
|
||||
func wfReleaseNotesURL(v string) string {
|
||||
ver := strings.TrimPrefix(v, "v")
|
||||
ver = strings.TrimSuffix(ver, ".0")
|
||||
// hack until go 1.12 in build/travis
|
||||
seg := strings.Split(ver, ".")
|
||||
|
|
Loading…
Reference in a new issue