summaryrefslogtreecommitdiff
path: root/internal/web/render.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-29 14:24:16 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-29 14:24:16 +0200
commit855859bdaac101e7e87d5cb0237b7c30f4f4b371 (patch)
treee0d4af3c9082c4b7ceba2d05471c6a162cfe2940 /internal/web/render.go
parent18578434f41d4fe34438c2f171388109a288c18c (diff)
downloadlectio-855859bdaac101e7e87d5cb0237b7c30f4f4b371.tar.gz
lectio-855859bdaac101e7e87d5cb0237b7c30f4f4b371.zip
web: declutter the UI, fix date arrows, red * for bookmarked verses in reader
Daily page (index.html): - Date arrows now step the date input client-side and dispatch its change, so they move relative to the CURRENT day and update the shown date (they were stuck one step from the initial date, computed server-side). - Theme picker removed (theme lives only in /settings now); bookmarks link removed (bookmarks belong to the reader, not the daily readings). - reader/settings nav + the download links move to a right-aligned .controls-side cluster; essential controls (date, lectionary, versions, parts, layout, mono) stay on the left. mono stops its change bubbling so it no longer refetches. Reader (reader.html + RenderPassage): a bookmarked verse now shows a red "*" (end of line in columns, after the verse number interlinear). Threaded a marked set (keyed "chap:verse") through the reader render path only; the daily RenderReadings path is untouched. Settings (settings.html): Save button moved to the top; removed offline (dead), width and pager (CLI/TUI-only, no web effect) -- their config values are preserved since the handler no longer reads/zeroes them. Footer: source/licence centred. Web tests + full suite green both build modes.
Diffstat (limited to 'internal/web/render.go')
-rw-r--r--internal/web/render.go26
1 files changed, 17 insertions, 9 deletions
diff --git a/internal/web/render.go b/internal/web/render.go
index 3ea52e3..b7fb3ed 100644
--- a/internal/web/render.go
+++ b/internal/web/render.go
@@ -59,6 +59,7 @@ type columnView struct {
type blockView struct {
VNum, Text string
Refrain bool
+ Marked bool // the reader flags a bookmarked verse with a red "*"
}
// ilSectionView, ilVerseView and ilLineView are what
@@ -74,8 +75,9 @@ type ilSectionView struct {
}
type ilVerseView struct {
- VNum string
- Lines []ilLineView
+ VNum string
+ Lines []ilLineView
+ Marked bool // the reader flags a bookmarked verse with a red "*"
}
type ilLineView struct {
@@ -314,19 +316,21 @@ func UnionChapters(canonical string) []int {
// name in the sigla dialect (the section heading is "<name> <chap>"). versions
// are corpus versions; one lacking the chapter shows a localized "(not in X)"
// note (columns) or is skipped (interlinear). lang localizes the version labels.
-func RenderPassage(canonical, name string, chap int, versions []string, display, lang string) template.HTML {
+// marked (keyed by "chap:verse") flags verses that carry a bookmark, so the
+// reader can show a red "*"; pass nil for no marks.
+func RenderPassage(canonical, name string, chap int, versions []string, display, lang string, marked map[string]bool) template.HTML {
heading := fmt.Sprintf("%s %d", name, chap)
switch display {
case "interlinear":
- return renderTemplate("readings-interlinear.html", passageInterlinear(canonical, heading, chap, versions, lang))
+ return renderTemplate("readings-interlinear.html", passageInterlinear(canonical, heading, chap, versions, lang, marked))
case "vertical":
- return renderTemplate("readings-vertical.html", passageColumns(canonical, heading, chap, versions, lang))
+ return renderTemplate("readings-vertical.html", passageColumns(canonical, heading, chap, versions, lang, marked))
default:
- return renderTemplate("readings.html", passageColumns(canonical, heading, chap, versions, lang))
+ return renderTemplate("readings.html", passageColumns(canonical, heading, chap, versions, lang, marked))
}
}
-func passageColumns(canonical, heading string, chap int, versions []string, lang string) []sectionView {
+func passageColumns(canonical, heading string, chap int, versions []string, lang string, marked map[string]bool) []sectionView {
cols := make([]columnView, 0, len(versions))
for _, v := range versions {
verses := bible.Verses(v, canonical, chap)
@@ -335,14 +339,15 @@ func passageColumns(canonical, heading string, chap int, versions []string, lang
blocks = append(blocks, blockView{Text: fmt.Sprintf(i18n.Get(lang).NoVersion, v)})
}
for _, ve := range verses {
- blocks = append(blocks, blockView{VNum: fmt.Sprintf("%d:%d", ve.Chapter, ve.Verse), Text: ve.Text})
+ vnum := fmt.Sprintf("%d:%d", ve.Chapter, ve.Verse)
+ blocks = append(blocks, blockView{VNum: vnum, Text: ve.Text, Marked: marked[vnum]})
}
cols = append(cols, columnView{Label: webVersionLabel(v, lang), Blocks: blocks})
}
return []sectionView{{Heading: heading, PartID: "reader", Columns: cols}}
}
-func passageInterlinear(canonical, heading string, chap int, versions []string, lang string) []ilSectionView {
+func passageInterlinear(canonical, heading string, chap int, versions []string, lang string, marked map[string]bool) []ilSectionView {
var sets []verseSet
for _, v := range versions {
verses := bible.Verses(v, canonical, chap)
@@ -357,6 +362,9 @@ func passageInterlinear(canonical, heading string, chap int, versions []string,
return []ilSectionView{view}
}
view.Verses = interleaveVerses(sets)
+ for i := range view.Verses {
+ view.Verses[i].Marked = marked[view.Verses[i].VNum]
+ }
return []ilSectionView{view}
}