aboutsummaryrefslogtreecommitdiff
path: root/internal/web/templates/index.html
blob: 8c88779ae30602a3d2da7d271644ae6e4f1ded59 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{{/* index.html renders the full lectio-web page: top-bar controls (date,
     lectionary, version checkboxes, all/gospel toggle, display select,
     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), so "display" needs no extra wiring
     beyond living inside #controls. 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{{if .Mono}} class="mono"{{end}}>
<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>

    <label>układ
      <select name="display">
        <option value="horizontal" {{if eq .Display "horizontal"}}selected{{end}}>poziomo</option>
        <option value="vertical" {{if eq .Display "vertical"}}selected{{end}}>kolumny</option>
        <option value="interlinear" {{if eq .Display "interlinear"}}selected{{end}}>interlinearnie</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>

  <label class="mono-toggle"><input type="checkbox" {{if .Mono}}checked{{end}}
         onchange="document.body.classList.toggle('mono', this.checked)"> mono</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>