This commit is contained in:
Simon Ser 2019-12-10 17:39:42 +01:00
parent 3748b4413e
commit 835e9e5033
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
3 changed files with 17 additions and 17 deletions

View file

@ -68,11 +68,11 @@ func handleGetMailbox(ectx echo.Context) error {
return ctx.Render(http.StatusOK, "mailbox.html", &MailboxRenderData{
RenderData: *NewRenderData(ctx),
Mailbox: mbox,
Mailboxes: mailboxes,
Messages: msgs,
PrevPage: prevPage,
NextPage: nextPage,
Mailbox: mbox,
Mailboxes: mailboxes,
Messages: msgs,
PrevPage: prevPage,
NextPage: nextPage,
})
}
@ -173,7 +173,7 @@ func handleGetPart(ctx *context, raw bool) error {
}
return ctx.Render(http.StatusOK, "message.html", &MessageRenderData{
RenderData: *NewRenderData(ctx),
RenderData: *NewRenderData(ctx),
Mailbox: mbox,
Message: msg,
Body: body,
@ -283,6 +283,6 @@ func handleCompose(ectx echo.Context) error {
return ctx.Render(http.StatusOK, "compose.html", &ComposeRenderData{
RenderData: *NewRenderData(ctx),
Message: &msg,
Message: &msg,
})
}

View file

@ -12,8 +12,8 @@ import (
type luaRoute struct {
method string
path string
f *lua.LFunction
path string
f *lua.LFunction
}
type luaPlugin struct {
@ -94,8 +94,8 @@ func (p *luaPlugin) SetRoutes(group *echo.Group) {
for _, r := range p.routes {
group.Match([]string{r.method}, r.path, func(ctx echo.Context) error {
err := p.state.CallByParam(lua.P{
Fn: r.f,
NRet: 0,
Fn: r.f,
NRet: 0,
Protect: true,
}, luar.New(p.state, ctx))
if err != nil {

View file

@ -28,7 +28,7 @@ type GlobalRenderData struct {
// template-specific fields.
type RenderData struct {
Global GlobalRenderData
Extra map[string]interface{}
Extra map[string]interface{}
}
func NewRenderData(ctx *context) *RenderData {
@ -41,13 +41,13 @@ func NewRenderData(ctx *context) *RenderData {
return &RenderData{
Global: global,
Extra: make(map[string]interface{}),
Extra: make(map[string]interface{}),
}
}
type renderer struct {
base *template.Template
themes map[string]*template.Template
base *template.Template
themes map[string]*template.Template
defaultTheme string
}
@ -127,8 +127,8 @@ func loadTemplates(logger echo.Logger, defaultTheme string, plugins []Plugin) (*
}
return &renderer{
base: base,
themes: themes,
base: base,
themes: themes,
defaultTheme: defaultTheme,
}, nil
}