package web import ( "git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi" "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" ) templ legalLink(l LegalLink) { if l.External { { i18n.T(ctx, LegalTitleID(l.Kind)) } } else { { i18n.T(ctx, LegalTitleID(l.Kind)) } } } // siteFooter links the API documentation and the platform's legal // documents. templ siteFooter(links []LegalLink) { } templ legalBody(html string) { } // LegalPage shows a platform legal document. // LegalPage shows a platform legal document: inside the console for // signed-in users, with a plain header for everyone else, who must be able // to read it too. templ LegalPage(p Page, me *Me, html string) { if me != nil { @consoleShell(p, *me) { @legalBody(html) } } else { @Layout(p) {
@brandLockup("/")
{ i18n.T(ctx, "auth.login.title") } @languageSwitch(p.Languages)
@legalBody(html)
} } } // PublicLegalPage shows a legal document of a status page. templ PublicLegalPage(s agentapi.PageSnapshot, a PublicAssets, kind, html, back string) { { i18n.T(ctx, LegalTitleID(kind)) } · { s.Title } @faviconLinks()

{ "← " + s.Title }

@legalBody(html)
} // LegalForm is the stored state of one legal document. type LegalForm struct { Kind string URL string Markdown string // Consent marks documents every account accepts, which can be put // before everyone again. Consent bool } // LegalSettingsPage edits legal documents. apiBase plus the kind is the // endpoint each form saves to. templ LegalSettingsPage(p Page, me Me, titleID, introID, apiBase, next string, docs []LegalForm) { @consoleShell(p, me) { @settingsHeading(titleID, introID) for _, d := range docs {
@sectionHeading(LegalTitleID(d.Kind))
@formError()
{ i18n.T(ctx, "legal.markdown") } @MarkdownEditor("markdown", d.Markdown, 14, 100000, MarkdownDocument)

{ i18n.T(ctx, "legal.hint") }

if d.Consent { @checkbox(i18n.T(ctx, "legal.new_version"), "new_version", false)

{ i18n.T(ctx, "legal.new_version_hint") }

} @submit(i18n.T(ctx, "common.save"))
} } }