chore(webui): redesign the settings page and fix a few display elements
This commit is contained in:
parent
59b3d49a4f
commit
f604bb98ab
6 changed files with 24 additions and 32 deletions
|
@ -15,21 +15,21 @@
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<aside>
|
<aside>
|
||||||
{{ if eq .Page.Section "login" }}
|
{{ if eq .Page.Section "login" }}
|
||||||
<a href="/login" class="active">
|
<a href="/login" class="primary">
|
||||||
<i class="material-symbols-outlined">login</i>
|
<i class="material-symbols-outlined">login</i>
|
||||||
<span>Login</span>
|
<span>Login</span>
|
||||||
</a>
|
</a>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<a href="/states"{{ if eq .Page.Section "states" }} class="active"{{ end}}>
|
<a href="/states"{{ if eq .Page.Section "states" }} class="primary"{{ end}}>
|
||||||
<i class="material-symbols-outlined">home_storage</i>
|
<i class="material-symbols-outlined">home_storage</i>
|
||||||
<span>States</span>
|
<span>States</span>
|
||||||
</a>
|
</a>
|
||||||
<a href="/settings"{{ if eq .Page.Section "settings" }} class="active"{{ end}}>
|
<a href="/settings"{{ if eq .Page.Section "settings" }} class="primary"{{ end}}>
|
||||||
<i class="material-symbols-outlined">settings</i>
|
<i class="material-symbols-outlined">settings</i>
|
||||||
<span>Settings</span>
|
<span>Settings</span>
|
||||||
</a>
|
</a>
|
||||||
{{ if .Page.IsAdmin }}
|
{{ if .Page.IsAdmin }}
|
||||||
<a href="/accounts"{{ if eq .Page.Section "accounts" }} class="active"{{ end}}>
|
<a href="/accounts"{{ if eq .Page.Section "accounts" }} class="primary"{{ end}}>
|
||||||
<i class="material-symbols-outlined">person</i>
|
<i class="material-symbols-outlined">person</i>
|
||||||
<span>User Accounts</span>
|
<span>User Accounts</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
|
<h1>Settings</h1>
|
||||||
<form action="/settings" method="post">
|
<form action="/settings" method="post">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="field middle-align">
|
<legend>Account Settings</legend>
|
||||||
<nav>
|
<div style="align-items:center; display:grid; grid-template-columns:1fr 1fr;">
|
||||||
<div class="max">
|
<label for="dark-mode">Dark mode</label>
|
||||||
<h6>Dark Mode</h6>
|
<input autofocus
|
||||||
</div>
|
{{ if not .Settings.LightMode }}checked{{ end }}
|
||||||
<label class="switch icon">
|
id="dark-mode"
|
||||||
<input {{ if not .Settings.LightMode }} checked{{ end }}
|
|
||||||
name="dark-mode"
|
name="dark-mode"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
value="1" />
|
value="1">
|
||||||
<span>
|
</div>
|
||||||
<i>dark_mode</i>
|
<div style="align-self:stretch; display:flex; justify-content:flex-end;">
|
||||||
</span>
|
<button class="primary" type="submit" value="submit">Save</button>
|
||||||
</label>
|
|
||||||
</nav>
|
|
||||||
</div>
|
</div>
|
||||||
<button class="small-round" type="submit" value="login">Save</button>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
type Page struct {
|
type Page struct {
|
||||||
IsAdmin bool
|
IsAdmin bool
|
||||||
LightMode bool
|
LightMode bool
|
||||||
Precedent string
|
|
||||||
Section string
|
Section string
|
||||||
Title string
|
Title string
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,10 @@ func handleSettingsPOST(db *database.DB) http.Handler {
|
||||||
errorResponse(w, r, http.StatusInternalServerError, err)
|
errorResponse(w, r, http.StatusInternalServerError, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
page := makePage(r, &Page{Title: "Settings", Section: "settings"})
|
||||||
|
page.LightMode = settings.LightMode
|
||||||
render(w, settingsTemplates, http.StatusOK, SettingsPage{
|
render(w, settingsTemplates, http.StatusOK, SettingsPage{
|
||||||
Page: &Page{
|
Page: page,
|
||||||
LightMode: settings.LightMode,
|
|
||||||
Title: "Settings",
|
|
||||||
Section: "settings",
|
|
||||||
},
|
|
||||||
Settings: &settings,
|
Settings: &settings,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -126,7 +126,6 @@ func handleStatesIdGET(db *database.DB) http.Handler {
|
||||||
}
|
}
|
||||||
render(w, statesIdTemplate, http.StatusOK, StatesData{
|
render(w, statesIdTemplate, http.StatusOK, StatesData{
|
||||||
Page: makePage(r, &Page{
|
Page: makePage(r, &Page{
|
||||||
Precedent: "/states",
|
|
||||||
Section: "states",
|
Section: "states",
|
||||||
Title: state.Path,
|
Title: state.Path,
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -48,7 +48,6 @@ func handleVersionsGET(db *database.DB) http.Handler {
|
||||||
versionData := string(version.Data[:])
|
versionData := string(version.Data[:])
|
||||||
render(w, versionsTemplate, http.StatusOK, VersionsData{
|
render(w, versionsTemplate, http.StatusOK, VersionsData{
|
||||||
Page: makePage(r, &Page{
|
Page: makePage(r, &Page{
|
||||||
Precedent: path.Join("/states/", state.Id.String()),
|
|
||||||
Section: "states",
|
Section: "states",
|
||||||
Title: state.Path,
|
Title: state.Path,
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Add table
Reference in a new issue