From ce1418144772b35371c69f577d48d7d3adab06f4 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Wed, 23 Aug 2023 17:27:37 +0300 Subject: [PATCH] feat: tab title, tailwind reformat, a todo --- handlers/login.go | 2 +- handlers/settings.go | 2 +- middlewares/auth.go | 1 + static/styles.css | 18 +++++++++--------- template/templates/common/base.tmpl | 2 ++ tixe.go | 2 +- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/handlers/login.go b/handlers/login.go index 46361d7..8f9050c 100644 --- a/handlers/login.go +++ b/handlers/login.go @@ -9,6 +9,6 @@ import ( ) func Login(c *gin.Context) { - html := template.TmplEngine.Render("login.tmpl", map[string]interface{}{"notauthed": true, "oidcloginvisual": config.TixeConfig.OidcLoginVisual}) + html := template.TmplEngine.Render("login.tmpl", map[string]interface{}{"title": "login","notauthed": true, "oidcloginvisual": config.TixeConfig.OidcLoginVisual}) c.Data(http.StatusOK, "text/html", html) } diff --git a/handlers/settings.go b/handlers/settings.go index 15e8ada..189b34e 100644 --- a/handlers/settings.go +++ b/handlers/settings.go @@ -24,6 +24,6 @@ func Settings(c *gin.Context) { settingsData := SettingsData { } - html := template.TmplEngine.Render("settings.tmpl", map[string]interface{}{"user": user, "data": settingsData}) + html := template.TmplEngine.Render("settings.tmpl", map[string]interface{}{"title": "settings", "user": user, "data": settingsData}) c.Data(http.StatusOK, "text/html", html) } diff --git a/middlewares/auth.go b/middlewares/auth.go index a8a11c9..52c64a0 100644 --- a/middlewares/auth.go +++ b/middlewares/auth.go @@ -9,6 +9,7 @@ import ( func IsAuthenticated(c *gin.Context) { if sessions.Default(c).Get("profile") == nil { + // TODO: This should probably be validated somehow... DB lookup or something. c.Redirect(http.StatusSeeOther, "/login") } else { c.Next() diff --git a/static/styles.css b/static/styles.css index a14b5dc..b630ad7 100644 --- a/static/styles.css +++ b/static/styles.css @@ -558,6 +558,11 @@ video { width: 1rem; } +.w-fit { + width: -moz-fit-content; + width: fit-content; +} + .w-full { width: 100%; } @@ -567,11 +572,6 @@ video { width: max-content; } -.w-fit { - width: -moz-fit-content; - width: fit-content; -} - .min-w-max { min-width: -moz-max-content; min-width: max-content; @@ -658,6 +658,10 @@ video { stroke: #facc15; } +.p-1 { + padding: 0.25rem; +} + .p-2 { padding: 0.5rem; } @@ -666,10 +670,6 @@ video { padding: 1rem; } -.p-1 { - padding: 0.25rem; -} - .text-lg { font-size: 1.125rem; line-height: 1.75rem; diff --git a/template/templates/common/base.tmpl b/template/templates/common/base.tmpl index 406bac1..b727ab1 100644 --- a/template/templates/common/base.tmpl +++ b/template/templates/common/base.tmpl @@ -7,6 +7,8 @@ + + {{ .title }}
diff --git a/tixe.go b/tixe.go index 32d96e9..504f936 100644 --- a/tixe.go +++ b/tixe.go @@ -34,7 +34,7 @@ func handleNoRoute(c *gin.Context) { session := sessions.Default(c) user := session.Get("user") - html := template.TmplEngine.Render("404.tmpl", map[string]interface{}{"user": user}) + html := template.TmplEngine.Render("404.tmpl", map[string]interface{}{"title": "404", "user": user}) c.Data(http.StatusNotFound, "text/html", html) } -- 2.44.1