aboutsummaryrefslogtreecommitdiff
path: root/internal/web/templates/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'internal/web/templates/index.html')
-rw-r--r--internal/web/templates/index.html72
1 files changed, 72 insertions, 0 deletions
diff --git a/internal/web/templates/index.html b/internal/web/templates/index.html
new file mode 100644
index 0000000..4dd580f
--- /dev/null
+++ b/internal/web/templates/index.html
@@ -0,0 +1,72 @@
+{{/* index.html renders the full lectio-web page: top-bar controls (date,
+ lectionary, version checkboxes, all/gospel toggle, theme select), a
+ passage-lookup form, and the pre-rendered reading pane (#pane).
+
+ The controls form (#controls) carries hx-get="/readings" and fires on
+ any "change" bubbling up from its fields (htmx auto-includes an
+ hx-get element's enclosing form fields as the request's query
+ params -- no hx-include needed). The date +/- buttons are separate
+ hx-get elements nested in the same form so their own field values are
+ included too; they override "date" via hx-vals. The theme <select>
+ has no server round trip: it swaps the #theme <link>'s href directly. */}}
+<!doctype html>
+<html lang="pl">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>lectio</title>
+<link rel="stylesheet" href="/static/base.css">
+<link id="theme" rel="stylesheet" href="/theme.css?name={{.Theme}}">
+<script src="/static/htmx.min.js"></script>
+</head>
+<body>
+<div class="page">
+
+ <form id="controls" class="controls" hx-get="/readings" hx-target="#pane" hx-trigger="change">
+ <span class="date-nav">
+ <button type="button" hx-get="/readings" hx-target="#pane"
+ hx-vals='{"date":"{{.PrevDate}}"}'>&larr;</button>
+ <input type="date" name="date" value="{{.Date}}">
+ <button type="button" hx-get="/readings" hx-target="#pane"
+ hx-vals='{"date":"{{.NextDate}}"}'>&rarr;</button>
+ </span>
+
+ <label>lekcjonarz
+ <select name="lectionary">
+ <option value="new" {{if eq .Lectionary "new"}}selected{{end}}>nowy</option>
+ <option value="traditional" {{if eq .Lectionary "traditional"}}selected{{end}}>tradycyjny</option>
+ </select>
+ </label>
+
+ {{range .VersionOpts}}
+ <label><input type="checkbox" name="v" value="{{.Code}}" {{if .Checked}}checked{{end}}> {{.Code}}</label>
+ {{end}}
+
+ <label>zakres
+ <select name="all">
+ <option value="0" {{if not .All}}selected{{end}}>Ewangelia</option>
+ <option value="1" {{if .All}}selected{{end}}>wszystkie części</option>
+ </select>
+ </label>
+ </form>
+
+ <label class="theme-picker">motyw
+ <select id="theme-select"
+ onchange="document.getElementById('theme').href='/theme.css?name='+encodeURIComponent(this.value)">
+ {{range .ThemeOpts}}
+ <option value="{{.Name}}" {{if .Selected}}selected{{end}}>{{.Name}}</option>
+ {{end}}
+ </select>
+ </label>
+
+ <form id="lookup-form" class="controls" hx-get="/lookup" hx-target="#lookup-results" hx-include="#controls">
+ <input type="text" name="ref" placeholder="np. J 20:1" value="{{.Ref}}">
+ <button type="submit">szukaj</button>
+ </form>
+ <div id="lookup-results">{{.Lookup}}</div>
+
+ <div id="pane">{{.Reading}}</div>
+
+</div>
+</body>
+</html>