From ffcc9eeb1746971d7d009822ae65a1201c54e289 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Mon, 7 Oct 2024 03:45:49 +0300 Subject: Мелкие правки админки MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/tpl/error.templ | 8 +++++--- pkg/tpl/error_templ.go | 23 +++++++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) (limited to 'pkg/tpl') diff --git a/pkg/tpl/error.templ b/pkg/tpl/error.templ index 8045c1a..a2e9438 100644 --- a/pkg/tpl/error.templ +++ b/pkg/tpl/error.templ @@ -1,8 +1,10 @@ package tpl -templ ErrorPage(err string) { +import "strconv" + +templ ErrorPage(code int, message string) { @Layout(HeaderParams{}) { -

Ошибка!

-

{ err }

+

Ошибка { strconv.Itoa(code) }!

+

{ message }

} } diff --git a/pkg/tpl/error_templ.go b/pkg/tpl/error_templ.go index cc13ddd..03dcb92 100644 --- a/pkg/tpl/error_templ.go +++ b/pkg/tpl/error_templ.go @@ -8,7 +8,9 @@ package tpl import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" -func ErrorPage(err string) templ.Component { +import "strconv" + +func ErrorPage(code int, message string) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -41,19 +43,32 @@ func ErrorPage(err string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Ошибка!

") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Ошибка ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(err) + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(code)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/tpl/error.templ`, Line: 6, Col: 10} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/tpl/error.templ`, Line: 7, Col: 39} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("!

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var4 string + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(message) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/tpl/error.templ`, Line: 8, Col: 14} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err -- cgit v1.2.3