summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/api/util/template.go10
-rw-r--r--internal/web/confirmemail.go4
-rw-r--r--internal/web/login-info.go2
-rw-r--r--web/template/confirm-email.tmpl (renamed from web/template/confirm_email.tmpl)0
-rw-r--r--web/template/confirmed-email.tmpl (renamed from web/template/confirmed_email.tmpl)0
-rw-r--r--web/template/login-info.tmpl (renamed from web/template/login_info.tmpl)0
-rw-r--r--web/template/page.tmpl4
7 files changed, 14 insertions, 6 deletions
diff --git a/internal/api/util/template.go b/internal/api/util/template.go
index 990874028..ec04a4d97 100644
--- a/internal/api/util/template.go
+++ b/internal/api/util/template.go
@@ -236,6 +236,16 @@ func templatePage(
obj map[string]any,
) {
const pageTmpl = "page.tmpl"
+
+ // Render given template inside the page.
obj["pageContent"] = template
+
+ // Inject specific page class by trimming
+ // ".tmpl" suffix. In the page template
+ // (see page.tmpl) this will be appended
+ // with "-page", so "index.tmpl" for example
+ // ends up with class "page index-page".
+ obj["pageClass"] = template[:len(template)-5]
+
c.HTML(code, pageTmpl, obj)
}
diff --git a/internal/web/confirmemail.go b/internal/web/confirmemail.go
index e512761f4..323de6bb2 100644
--- a/internal/web/confirmemail.go
+++ b/internal/web/confirmemail.go
@@ -77,7 +77,7 @@ func (m *Module) confirmEmailGETHandler(c *gin.Context) {
// Serve page where user can click button
// to POST confirmation to same endpoint.
page := apiutil.WebPage{
- Template: "confirm_email.tmpl",
+ Template: "confirm-email.tmpl",
Instance: instance,
Extra: map[string]any{
"email": email,
@@ -127,7 +127,7 @@ func (m *Module) confirmEmailPOSTHandler(c *gin.Context) {
// Serve page informing user that their
// email address is now confirmed.
page := apiutil.WebPage{
- Template: "confirmed_email.tmpl",
+ Template: "confirmed-email.tmpl",
Instance: instance,
Extra: map[string]any{
"email": user.Email,
diff --git a/internal/web/login-info.go b/internal/web/login-info.go
index bd52f72ef..9aca768b6 100644
--- a/internal/web/login-info.go
+++ b/internal/web/login-info.go
@@ -50,7 +50,7 @@ func (m *Module) loginGETHandler(c *gin.Context) {
}
page := apiutil.WebPage{
- Template: "login_info.tmpl",
+ Template: "login-info.tmpl",
Instance: instance,
OGMeta: apiutil.OGBase(instance),
Stylesheets: []string{cssAbout, cssLoginInfo},
diff --git a/web/template/confirm_email.tmpl b/web/template/confirm-email.tmpl
index d1932acd9..d1932acd9 100644
--- a/web/template/confirm_email.tmpl
+++ b/web/template/confirm-email.tmpl
diff --git a/web/template/confirmed_email.tmpl b/web/template/confirmed-email.tmpl
index 2dc605e4b..2dc605e4b 100644
--- a/web/template/confirmed_email.tmpl
+++ b/web/template/confirmed-email.tmpl
diff --git a/web/template/login_info.tmpl b/web/template/login-info.tmpl
index 238e3e9d2..238e3e9d2 100644
--- a/web/template/login_info.tmpl
+++ b/web/template/login-info.tmpl
diff --git a/web/template/page.tmpl b/web/template/page.tmpl
index fad0fc3b9..7dccc7469 100644
--- a/web/template/page.tmpl
+++ b/web/template/page.tmpl
@@ -71,9 +71,8 @@ image/webp
{{- end }}
<title>{{- template "instanceTitle" . -}}</title>
</head>
- <body>
+ <body class="page{{- if .pageClass }} {{ .pageClass }}-page{{- end -}}">
{{- include "login_button.tmpl" . | indent 3 }}
- <div class="page">
<header class="page-header">
{{- include "page_header.tmpl" . | indent 3 }}
</header>
@@ -83,6 +82,5 @@ image/webp
<footer class="page-footer">
{{- include "page_footer.tmpl" . | indent 3 }}
</footer>
- </div>
</body>
</html> \ No newline at end of file