aboutsummaryrefslogtreecommitdiff
path: root/internal/web/templates/settings.html
blob: cb753ae4a149e0fc8859b823ac8c4a1106c9e901 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
{{/* settings.html — lectio-web /settings page: a form for every config
     setting plus a raw books.ini editor. A plain POST form (no htmx) --
     saving redirects (PRG) back here with ?saved=1. On a validation error
     the form re-renders with the submitted values and an inline message
     instead of redirecting. Self-contained and theme-aware, like index.html. */}}
<!doctype html>
<html lang="{{.Lang}}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>lectio — settings</title>
<link rel="stylesheet" href="/static/base.css">
<link id="theme" rel="stylesheet" href="/theme.css?name={{.Cfg.WebTheme}}">
<script src="/static/htmx.min.js"></script>
</head>
<body{{if .Cfg.WebMono}} class="mono"{{end}}>
<div class="page">

  <p><a class="nav-link" href="/">&larr; {{.L.BannerReadings}}</a></p>

  {{if .Saved}}<p class="saved">{{.L.WebSaved}}</p>{{end}}
  {{if .Error}}<p class="error">{{.Error}}</p>{{end}}

  <form class="settings" method="post" action="/settings">

    <div class="row"><button type="submit">{{.L.WebSave}}</button></div>

    <label>{{.L.Lectionary}}
      <select name="lectionary">
        <option value="new" {{if eq .Cfg.Lectionary "new"}}selected{{end}}>{{.L.OptModern}}</option>
        <option value="traditional" {{if eq .Cfg.Lectionary "traditional"}}selected{{end}}>{{.L.OptTraditional}}</option>
      </select>
    </label>

    <label>{{.L.WebUILang}}
      <select name="ui_language">
        <option value="en" {{if eq .Cfg.UILanguage "en"}}selected{{end}}>en</option>
        <option value="pl" {{if eq .Cfg.UILanguage "pl"}}selected{{end}}>pl</option>
      </select>
    </label>

    <label>{{.L.WebSiglaStyle}}
      <select name="sigla_style">
        <option value="auto" {{if eq .Cfg.SiglaStyle "auto"}}selected{{end}}>auto</option>
        <option value="polish" {{if eq .Cfg.SiglaStyle "polish"}}selected{{end}}>polish</option>
        <option value="english" {{if eq .Cfg.SiglaStyle "english"}}selected{{end}}>english</option>
      </select>
    </label>

    <label>{{.L.Layout}}
      <select name="web_display">
        <option value="horizontal" {{if eq .Cfg.WebDisplay "horizontal"}}selected{{end}}>{{.L.OptHorizontal}}</option>
        <option value="vertical" {{if eq .Cfg.WebDisplay "vertical"}}selected{{end}}>{{.L.OptColumns}}</option>
        <option value="interlinear" {{if eq .Cfg.WebDisplay "interlinear"}}selected{{end}}>{{.L.OptInterlinear}}</option>
      </select>
    </label>

    <label>{{.L.Theme}}
      <select name="web_theme">
        {{range .ThemeOpts}}<option value="{{.Name}}" {{if .Selected}}selected{{end}}>{{.Name}}</option>{{end}}
      </select>
    </label>

    <label>{{.L.WebDefaultVersion}}
      <select name="default_version">
        {{range .VersionOpts}}<option value="{{.Code}}" {{if eq .Code $.Cfg.DefaultVersion}}selected{{end}}>{{.Code}}</option>{{end}}
      </select>
    </label>

    {{/* The terminal compare set (config "versions") is intentionally NOT here:
         it only affects the CLI, so editing it from the web is pointless and
         confusing. settingsPost preserves it. This page keeps only the web's
         own defaults: the single default_version and the web_versions ticks. */}}
    <div class="row">
      {{.L.WebWebVersions}}
      {{range .WebVersionOpts}}<label><input type="checkbox" name="web_versions" value="{{.Code}}" {{if .Checked}}checked{{end}}> {{.Code}}</label>{{end}}
    </div>

    <div class="row">
      <label><input type="checkbox" name="all" {{if .Cfg.All}}checked{{end}}> {{.L.OptAll}}</label>
      <label><input type="checkbox" name="web_mono" {{if .Cfg.WebMono}}checked{{end}}> {{.L.Mono}}</label>
    </div>

    <label>{{.L.WebPort}}
      <input type="number" name="web_port" value="{{.Cfg.WebPort}}">
    </label>

    <label>books.ini
      <textarea name="books" rows="20">{{.Books}}</textarea>
    </label>

  </form>

</div>

<footer class="licence"><a href="/source">source</a> · AGPL-3.0-or-later</footer>
</body>
</html>