feat: add server-side theme cookie with dropdown selector (no JS)
- Add theme POST handler that sets HttpOnly cookie - Update preferences page to use <select> dropdown instead of JS buttons - Theme cookie set on POST /preferences with theme parameter - Theme read from cookie on all page renders - No JavaScript required for theme selection Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
056d2d1175
commit
fe0c7e8dc8
4 changed files with 47 additions and 13 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{{define "base"}}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme="{{.Theme}}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
|
|
|||
|
|
@ -8,8 +8,11 @@
|
|||
<section class="pref-section">
|
||||
<h2 class="pref-section-title">Appearance</h2>
|
||||
<div class="pref-row">
|
||||
<label>Theme</label>
|
||||
<span class="theme-info">Follows system preference</span>
|
||||
<label for="theme-select">Theme</label>
|
||||
<select name="theme" id="theme-select" onchange="this.form.submit()">
|
||||
<option value="light" {{if eq .Theme "light"}}selected{{end}}>Light</option>
|
||||
<option value="dark" {{if eq .Theme "dark"}}selected{{end}}>Dark</option>
|
||||
</select>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue