Tweaks
This commit is contained in:
@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
templ Home(request *requests.Request, pc PageContext) {
|
||||
@baseLayout(request, pc) {
|
||||
@baseLayout(request, BaseLayoutContext{Title: pc.Title, ActivePage: "home"}) {
|
||||
<p>Bacon ipsum dolor amet venison bacon picanha jerky tenderloin. Hamburger sausage meatball chislic salami. Ball tip tenderloin chuck, venison strip steak kielbasa short loin bresaola short ribs cupim drumstick shoulder pork t-bone. Burgdoggen cupim meatball picanha meatloaf, jowl leberkas kevin. T-bone jowl ham hock salami tenderloin.</p>
|
||||
<p>Beef ribs frankfurter corned beef ground round pork, sausage drumstick. Corned beef turducken beef ribs, tongue burgdoggen capicola kielbasa short loin pork belly tail frankfurter ribeye strip steak meatloaf. Alcatra frankfurter salami cupim strip steak leberkas jerky ham hock biltong swine ball tip prosciutto t-bone andouille. Pork loin hamburger chuck frankfurter ham shankle jowl sausage chislic chicken tenderloin. Capicola tongue beef ribs flank, doner sirloin tri-tip pastrami. Porchetta andouille pork fatback jerky, pancetta pig filet mignon leberkas kielbasa sirloin.</p>
|
||||
<p>Biltong landjaeger drumstick meatball boudin pork chop turducken jerky hamburger filet mignon flank. Venison turducken pork belly, pork chop ground round buffalo strip steak ribeye alcatra pancetta flank salami chislic. Landjaeger flank andouille short ribs. Shoulder beef ribs chuck, corned beef frankfurter turducken prosciutto.</p>
|
||||
|
||||
@ -87,7 +87,7 @@ func Home(request *requests.Request, pc PageContext) templ.Component {
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = baseLayout(request, pc).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = baseLayout(request, BaseLayoutContext{Title: pc.Title, ActivePage: "home"}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@ -4,7 +4,12 @@ import (
|
||||
"fiber-sessions/app/router/requests"
|
||||
)
|
||||
|
||||
templ baseLayout(request *requests.Request, pc PageContext) {
|
||||
type BaseLayoutContext struct {
|
||||
Title string
|
||||
ActivePage string
|
||||
}
|
||||
|
||||
templ baseLayout(request *requests.Request, pc BaseLayoutContext) {
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
@ -14,7 +14,12 @@ import (
|
||||
"fiber-sessions/app/router/requests"
|
||||
)
|
||||
|
||||
func baseLayout(request *requests.Request, pc PageContext) templ.Component {
|
||||
type BaseLayoutContext struct {
|
||||
Title string
|
||||
ActivePage string
|
||||
}
|
||||
|
||||
func baseLayout(request *requests.Request, pc BaseLayoutContext) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
@ -43,7 +48,7 @@ func baseLayout(request *requests.Request, pc PageContext) templ.Component {
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(pc.Title)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/templates/layout.templ`, Line: 15, Col: 20}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/templates/layout.templ`, Line: 20, Col: 20}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -177,7 +182,7 @@ func baseLayout(request *requests.Request, pc PageContext) templ.Component {
|
||||
var templ_7745c5c3_Var13 string
|
||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(request.User.FirstName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/templates/layout.templ`, Line: 49, Col: 37}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/templates/layout.templ`, Line: 54, Col: 37}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
|
||||
@ -54,7 +54,7 @@ templ LoginFormContent(content LoginFormValidationContent) {
|
||||
}
|
||||
|
||||
templ RenderLogin(request *requests.Request, pc PageContext) {
|
||||
@baseLayout(request, pc) {
|
||||
@baseLayout(request, BaseLayoutContext{Title: pc.Title, ActivePage: "login"}) {
|
||||
<div class="card ms-auto me-auto" style="max-width: 500px;">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title mb-4">
|
||||
|
||||
@ -233,7 +233,7 @@ func RenderLogin(request *requests.Request, pc PageContext) templ.Component {
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = baseLayout(request, pc).Render(templ.WithChildren(ctx, templ_7745c5c3_Var11), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = baseLayout(request, BaseLayoutContext{Title: pc.Title, ActivePage: "login"}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var11), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@ -5,14 +5,14 @@ import (
|
||||
)
|
||||
|
||||
templ ProtectedPage(request *requests.Request, pc PageContext) {
|
||||
@baseLayout(request, pc) {
|
||||
@baseLayout(request, BaseLayoutContext{Title: pc.Title, ActivePage: "protected-page"}) {
|
||||
if request.UserAuthenticated() {
|
||||
<div class="alert alert-success">
|
||||
Some protected content.
|
||||
</div>
|
||||
} else {
|
||||
<div class="alert alert-danger">
|
||||
Can't access to this protected content!
|
||||
Ubable to access to this protected content!
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ func ProtectedPage(request *requests.Request, pc PageContext) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Var4 := `Can't access to this protected content!`
|
||||
templ_7745c5c3_Var4 := `Ubable to access to this protected content!`
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
@ -67,7 +67,7 @@ func ProtectedPage(request *requests.Request, pc PageContext) templ.Component {
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = baseLayout(request, pc).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = baseLayout(request, BaseLayoutContext{Title: pc.Title, ActivePage: "protected-page"}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user