mirror of
https://github.com/kataras/iris.git
synced 2025-12-31 00:37:05 +00:00
builtin html template functions changes
This commit is contained in:
@@ -118,7 +118,10 @@ func main() {
|
||||
}
|
||||
|
||||
func renderSigninForm(ctx iris.Context) {
|
||||
ctx.View("signin", iris.Map{"Title": "Signin Page"})
|
||||
if err := ctx.View("signin", iris.Map{"Title": "Signin Page"}); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func renderMemberPage(s *auth.Auth[User]) iris.Handler {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<body>
|
||||
<div class="container">
|
||||
<main>{{ template "content" . }}</main>
|
||||
<footer style="position: fixed; bottom: 0; width: 100%;">{{ partial "partials/footer" .}}</footer>
|
||||
<footer style="position: fixed; bottom: 0; width: 100%;">{{ partial "partials/footer" . }}</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -377,9 +377,12 @@ func main() {
|
||||
// ctx.View("user.html", user)
|
||||
//
|
||||
// Directly (user as .user variable):
|
||||
ctx.View("user.html", iris.Map{
|
||||
if err := ctx.View("user.html", iris.Map{
|
||||
"user": user,
|
||||
})
|
||||
}); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
app.Get("/logout/{provider}", func(ctx iris.Context) {
|
||||
@@ -395,11 +398,17 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.View("user.html", gothUser)
|
||||
if err := ctx.View("user.html", gothUser); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
ctx.View("index.html", providerIndex)
|
||||
if err := ctx.View("index.html", providerIndex); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
// http://localhost:3000
|
||||
|
||||
@@ -42,5 +42,8 @@ func register(ctx iris.Context) {
|
||||
|
||||
func registerForm(ctx iris.Context) {
|
||||
ctx.ViewData("SiteKey", siteKey)
|
||||
ctx.View("register_form.html")
|
||||
if err := ctx.View("register_form.html"); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user