refactor the preferences page
parent
5553a8af01
commit
56416b78ec
|
|
@ -69,6 +69,7 @@ func PreferencesHandler(app *App) http.HandlerFunc {
|
||||||
BasePath: app.Config.ThreadrDir,
|
BasePath: app.Config.ThreadrDir,
|
||||||
StaticPath: app.Config.ThreadrDir + "/static",
|
StaticPath: app.Config.ThreadrDir + "/static",
|
||||||
CurrentURL: r.URL.Path,
|
CurrentURL: r.URL.Path,
|
||||||
|
ContentTemplate: "preferences-content",
|
||||||
},
|
},
|
||||||
Preferences: prefs,
|
Preferences: prefs,
|
||||||
ShowSuccess: showSuccess,
|
ShowSuccess: showSuccess,
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,26 @@
|
||||||
{{define "preferences"}}
|
{{define "preferences"}}{{template "base" .}}{{end}}
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>{{.Title}}</title>
|
|
||||||
<link rel="stylesheet" href="{{.StaticPath}}/style.css">
|
|
||||||
<script src="{{.StaticPath}}/app.js" defer></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
{{template "navbar" .}}
|
|
||||||
<main>
|
|
||||||
<header>
|
|
||||||
<h2>Preferences</h2>
|
|
||||||
</header>
|
|
||||||
{{if .ShowSuccess}}
|
|
||||||
<div class="notification success" style="position: static; margin-bottom: 1em; animation: none;">
|
|
||||||
Preferences saved successfully!
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
<section>
|
|
||||||
<form method="post" action="{{.BasePath}}/preferences/">
|
|
||||||
<h3>Draft Auto-Save</h3>
|
|
||||||
<label for="auto_save_drafts" style="display: flex; align-items: center; gap: 0.5em; cursor: pointer;">
|
|
||||||
<input type="checkbox" id="auto_save_drafts" name="auto_save_drafts" {{if .Preferences.AutoSaveDrafts}}checked{{end}}>
|
|
||||||
<span>Automatically save drafts while typing in chat</span>
|
|
||||||
</label>
|
|
||||||
<p style="margin-left: 1.5em; margin-top: 0.25em; font-size: 0.9em; opacity: 0.8;">
|
|
||||||
Drafts are saved to your browser's local storage and restored when you return to chat.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<input type="submit" value="Save Preferences" style="margin-top: 2em;">
|
{{define "preferences-content"}}
|
||||||
</form>
|
<header>
|
||||||
</section>
|
<h2>Preferences</h2>
|
||||||
</main>
|
</header>
|
||||||
{{template "cookie_banner" .}}
|
{{if .ShowSuccess}}
|
||||||
</body>
|
<div class="notification success" style="position: static; margin-bottom: 1em; animation: none;">
|
||||||
</html>
|
Preferences saved successfully!
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
<section>
|
||||||
|
<form method="post" action="{{.BasePath}}/preferences/">
|
||||||
|
<h3>Draft Auto-Save</h3>
|
||||||
|
<label for="auto_save_drafts" style="display: flex; align-items: center; gap: 0.5em; cursor: pointer;">
|
||||||
|
<input type="checkbox" id="auto_save_drafts" name="auto_save_drafts" {{if .Preferences.AutoSaveDrafts}}checked{{end}}>
|
||||||
|
<span>Automatically save drafts while typing in chat</span>
|
||||||
|
</label>
|
||||||
|
<p style="margin-left: 1.5em; margin-top: 0.25em; font-size: 0.9em; opacity: 0.8;">
|
||||||
|
Drafts are saved to your browser's local storage and restored when you return to chat.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<input type="submit" value="Save Preferences" style="margin-top: 2em;">
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue