mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-02-24 00:38:51 +01:00
[feature] Add page-specific class per template (#3814)
* [feature] Add page-specific class per template * cheeky bit cheaper
This commit is contained in:
parent
a03a35a5d6
commit
8829ee187a
7 changed files with 14 additions and 6 deletions
|
@ -236,6 +236,16 @@ func templatePage(
|
||||||
obj map[string]any,
|
obj map[string]any,
|
||||||
) {
|
) {
|
||||||
const pageTmpl = "page.tmpl"
|
const pageTmpl = "page.tmpl"
|
||||||
|
|
||||||
|
// Render given template inside the page.
|
||||||
obj["pageContent"] = template
|
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)
|
c.HTML(code, pageTmpl, obj)
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ func (m *Module) confirmEmailGETHandler(c *gin.Context) {
|
||||||
// Serve page where user can click button
|
// Serve page where user can click button
|
||||||
// to POST confirmation to same endpoint.
|
// to POST confirmation to same endpoint.
|
||||||
page := apiutil.WebPage{
|
page := apiutil.WebPage{
|
||||||
Template: "confirm_email.tmpl",
|
Template: "confirm-email.tmpl",
|
||||||
Instance: instance,
|
Instance: instance,
|
||||||
Extra: map[string]any{
|
Extra: map[string]any{
|
||||||
"email": email,
|
"email": email,
|
||||||
|
@ -127,7 +127,7 @@ func (m *Module) confirmEmailPOSTHandler(c *gin.Context) {
|
||||||
// Serve page informing user that their
|
// Serve page informing user that their
|
||||||
// email address is now confirmed.
|
// email address is now confirmed.
|
||||||
page := apiutil.WebPage{
|
page := apiutil.WebPage{
|
||||||
Template: "confirmed_email.tmpl",
|
Template: "confirmed-email.tmpl",
|
||||||
Instance: instance,
|
Instance: instance,
|
||||||
Extra: map[string]any{
|
Extra: map[string]any{
|
||||||
"email": user.Email,
|
"email": user.Email,
|
||||||
|
|
|
@ -50,7 +50,7 @@ func (m *Module) loginGETHandler(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
page := apiutil.WebPage{
|
page := apiutil.WebPage{
|
||||||
Template: "login_info.tmpl",
|
Template: "login-info.tmpl",
|
||||||
Instance: instance,
|
Instance: instance,
|
||||||
OGMeta: apiutil.OGBase(instance),
|
OGMeta: apiutil.OGBase(instance),
|
||||||
Stylesheets: []string{cssAbout, cssLoginInfo},
|
Stylesheets: []string{cssAbout, cssLoginInfo},
|
||||||
|
|
|
@ -71,9 +71,8 @@ image/webp
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<title>{{- template "instanceTitle" . -}}</title>
|
<title>{{- template "instanceTitle" . -}}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="page{{- if .pageClass }} {{ .pageClass }}-page{{- end -}}">
|
||||||
{{- include "login_button.tmpl" . | indent 3 }}
|
{{- include "login_button.tmpl" . | indent 3 }}
|
||||||
<div class="page">
|
|
||||||
<header class="page-header">
|
<header class="page-header">
|
||||||
{{- include "page_header.tmpl" . | indent 3 }}
|
{{- include "page_header.tmpl" . | indent 3 }}
|
||||||
</header>
|
</header>
|
||||||
|
@ -83,6 +82,5 @@ image/webp
|
||||||
<footer class="page-footer">
|
<footer class="page-footer">
|
||||||
{{- include "page_footer.tmpl" . | indent 3 }}
|
{{- include "page_footer.tmpl" . | indent 3 }}
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in a new issue