@@ -3,11 +3,11 @@ package controller
33import (
44 "github.com/chenhg5/go-admin/context"
55 "github.com/chenhg5/go-admin/modules/auth"
6+ "github.com/chenhg5/go-admin/modules/language"
67 "github.com/chenhg5/go-admin/modules/logger"
78 "github.com/chenhg5/go-admin/modules/menu"
89 "github.com/chenhg5/go-admin/plugins/admin/modules/constant"
910 "github.com/chenhg5/go-admin/plugins/admin/modules/parameter"
10- "github.com/chenhg5/go-admin/plugins/admin/modules/response"
1111 "github.com/chenhg5/go-admin/plugins/admin/modules/table"
1212 "github.com/chenhg5/go-admin/template"
1313 "github.com/chenhg5/go-admin/template/types"
@@ -53,15 +53,29 @@ func GlobalDeferHandler(ctx *context.Context) {
5353 return
5454 }
5555
56- response .Error (ctx , errMsg )
56+ alert := aAlert ().
57+ SetTitle (template2 .HTML (`<i class="icon fa fa-warning"></i> ` + language .Get ("error" ) + `!` )).
58+ SetTheme ("warning" ).
59+ SetContent (template2 .HTML (errMsg )).
60+ GetContent ()
61+
62+ user := auth .Auth (ctx )
63+
64+ tmpl , tmplName := aTemplate ().GetTemplate (isPjax (ctx ))
65+ buf := template .Execute (tmpl , tmplName , user , types.Panel {
66+ Content : alert ,
67+ Description : "error" ,
68+ Title : "error" ,
69+ }, config , menu .GetGlobalMenu (user ).SetActiveClass (config .UrlRemovePrefix (ctx .Path ())))
70+ ctx .Html (http .StatusOK , buf .String ())
5771 return
5872 }
5973}
6074
6175func setFormWithReturnErrMessage (ctx * context.Context , errMsg string , kind string ) {
6276
6377 alert := aAlert ().
64- SetTitle (template2 .HTML (`<i class="icon fa fa-warning"></i> Error !` )).
78+ SetTitle (template2 .HTML (`<i class="icon fa fa-warning"></i> ` + language . Get ( "error" ) + ` !` )).
6579 SetTheme ("warning" ).
6680 SetContent (template2 .HTML (errMsg )).
6781 GetContent ()
0 commit comments