diff --git a/admin.go b/admin.go
index 55cfb17..c0ad436 100644
--- a/admin.go
+++ b/admin.go
@@ -90,6 +90,16 @@ type instanceContent struct {
Updated time.Time
}
+type AdminPage struct {
+ UpdateAvailable bool
+}
+
+func NewAdminPage(app *App) *AdminPage {
+ return &AdminPage{
+ UpdateAvailable: app.updates.AreAvailableNoCheck(),
+ }
+}
+
func (c instanceContent) UpdatedFriendly() string {
/*
// TODO: accept a locale in this method and use that for the format
@@ -102,12 +112,14 @@ func (c instanceContent) UpdatedFriendly() string {
func handleViewAdminDash(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
p := struct {
*UserPage
+ *AdminPage
Message string
UsersCount, CollectionsCount, PostsCount int64
}{
- UserPage: NewUserPage(app, r, u, "Admin", nil),
- Message: r.FormValue("m"),
+ UserPage: NewUserPage(app, r, u, "Admin", nil),
+ AdminPage: NewAdminPage(app),
+ Message: r.FormValue("m"),
}
// Get user stats
@@ -130,12 +142,14 @@ func handleViewAdminMonitor(app *App, u *User, w http.ResponseWriter, r *http.Re
updateAppStats()
p := struct {
*UserPage
+ *AdminPage
SysStatus systemStatus
Config config.AppCfg
Message, ConfigMessage string
}{
UserPage: NewUserPage(app, r, u, "Admin", nil),
+ AdminPage: NewAdminPage(app),
SysStatus: sysStatus,
Config: app.cfg.App,
@@ -150,12 +164,14 @@ func handleViewAdminMonitor(app *App, u *User, w http.ResponseWriter, r *http.Re
func handleViewAdminSettings(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
p := struct {
*UserPage
+ *AdminPage
Config config.AppCfg
Message, ConfigMessage string
}{
- UserPage: NewUserPage(app, r, u, "Admin", nil),
- Config: app.cfg.App,
+ UserPage: NewUserPage(app, r, u, "Admin", nil),
+ AdminPage: NewAdminPage(app),
+ Config: app.cfg.App,
Message: r.FormValue("m"),
ConfigMessage: r.FormValue("cm"),
@@ -168,6 +184,7 @@ func handleViewAdminSettings(app *App, u *User, w http.ResponseWriter, r *http.R
func handleViewAdminUsers(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
p := struct {
*UserPage
+ *AdminPage
Config config.AppCfg
Message string
@@ -176,9 +193,10 @@ func handleViewAdminUsers(app *App, u *User, w http.ResponseWriter, r *http.Requ
TotalUsers int64
TotalPages []int
}{
- UserPage: NewUserPage(app, r, u, "Users", nil),
- Config: app.cfg.App,
- Message: r.FormValue("m"),
+ UserPage: NewUserPage(app, r, u, "Users", nil),
+ AdminPage: NewAdminPage(app),
+ Config: app.cfg.App,
+ Message: r.FormValue("m"),
}
p.TotalUsers = app.db.GetAllUsersCount()
@@ -214,6 +232,7 @@ func handleViewAdminUser(app *App, u *User, w http.ResponseWriter, r *http.Reque
p := struct {
*UserPage
+ *AdminPage
Config config.AppCfg
Message string
@@ -349,14 +368,16 @@ func handleAdminResetUserPass(app *App, u *User, w http.ResponseWriter, r *http.
func handleViewAdminPages(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
p := struct {
*UserPage
+ *AdminPage
Config config.AppCfg
Message string
Pages []*instanceContent
}{
- UserPage: NewUserPage(app, r, u, "Pages", nil),
- Config: app.cfg.App,
- Message: r.FormValue("m"),
+ UserPage: NewUserPage(app, r, u, "Pages", nil),
+ AdminPage: NewAdminPage(app),
+ Config: app.cfg.App,
+ Message: r.FormValue("m"),
}
var err error
@@ -413,6 +434,7 @@ func handleViewAdminPage(app *App, u *User, w http.ResponseWriter, r *http.Reque
p := struct {
*UserPage
+ *AdminPage
Config config.AppCfg
Message string
@@ -583,15 +605,16 @@ func handleViewAdminUpdates(app *App, u *User, w http.ResponseWriter, r *http.Re
p := struct {
*UserPage
+ *AdminPage
CurReleaseNotesURL string
LastChecked string
LastChecked8601 string
LatestVersion string
LatestReleaseURL string
LatestReleaseNotesURL string
- UpdateAvailable bool
}{
- UserPage: NewUserPage(app, r, u, "Updates", nil),
+ UserPage: NewUserPage(app, r, u, "Updates", nil),
+ AdminPage: NewAdminPage(app),
}
p.CurReleaseNotesURL = wfReleaseNotesURL(p.Version)
if app.cfg.App.UpdateChecks {
diff --git a/less/admin.less b/less/admin.less
index 3cbf30b..2aa34dc 100644
--- a/less/admin.less
+++ b/less/admin.less
@@ -19,8 +19,14 @@ nav#admin {
&.selected {
background: #dedede;
font-weight: bold;
+ .blip {
+ color: black;
+ }
}
}
+ .blip {
+ font-weight: bold;
+ }
}
.pager {
display: flex;
diff --git a/less/core.less b/less/core.less
index 0e5798b..05a050c 100644
--- a/less/core.less
+++ b/less/core.less
@@ -1345,7 +1345,7 @@ div.row {
}
}
-.check {
+.check, .blip {
font-size: 1.125em;
color: #71D571;
}
diff --git a/templates/user/include/header.tmpl b/templates/user/include/header.tmpl
index 4b53b32..16978ee 100644
--- a/templates/user/include/header.tmpl
+++ b/templates/user/include/header.tmpl
@@ -103,7 +103,7 @@
{{if not .SingleUser}}
Users
Pages
- {{if .UpdateChecks}}Updates{{end}}
+ {{if .UpdateChecks}}Updates{{if .UpdateAvailable}}!{{end}}{{end}}
{{end}}
{{if not .Forest}}
Monitor
diff --git a/updates.go b/updates.go
index e8f0d21..b1893fd 100644
--- a/updates.go
+++ b/updates.go
@@ -58,6 +58,12 @@ func (uc updatesCache) AreAvailable() bool {
return CompareSemver(uc.latestVersion, uc.currentVersion) == 1
}
+// AreAvailableNoCheck returns if the latest release is newer than the current
+// running version.
+func (uc updatesCache) AreAvailableNoCheck() bool {
+ return CompareSemver(uc.latestVersion, uc.currentVersion) == 1
+}
+
// LatestVersion returns the latest stored version available.
func (uc updatesCache) LatestVersion() string {
return uc.latestVersion