go fmt
This commit is contained in:
parent
3748b4413e
commit
835e9e5033
3 changed files with 17 additions and 17 deletions
14
handlers.go
14
handlers.go
|
@ -68,11 +68,11 @@ func handleGetMailbox(ectx echo.Context) error {
|
||||||
|
|
||||||
return ctx.Render(http.StatusOK, "mailbox.html", &MailboxRenderData{
|
return ctx.Render(http.StatusOK, "mailbox.html", &MailboxRenderData{
|
||||||
RenderData: *NewRenderData(ctx),
|
RenderData: *NewRenderData(ctx),
|
||||||
Mailbox: mbox,
|
Mailbox: mbox,
|
||||||
Mailboxes: mailboxes,
|
Mailboxes: mailboxes,
|
||||||
Messages: msgs,
|
Messages: msgs,
|
||||||
PrevPage: prevPage,
|
PrevPage: prevPage,
|
||||||
NextPage: nextPage,
|
NextPage: nextPage,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ func handleGetPart(ctx *context, raw bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.Render(http.StatusOK, "message.html", &MessageRenderData{
|
return ctx.Render(http.StatusOK, "message.html", &MessageRenderData{
|
||||||
RenderData: *NewRenderData(ctx),
|
RenderData: *NewRenderData(ctx),
|
||||||
Mailbox: mbox,
|
Mailbox: mbox,
|
||||||
Message: msg,
|
Message: msg,
|
||||||
Body: body,
|
Body: body,
|
||||||
|
@ -283,6 +283,6 @@ func handleCompose(ectx echo.Context) error {
|
||||||
|
|
||||||
return ctx.Render(http.StatusOK, "compose.html", &ComposeRenderData{
|
return ctx.Render(http.StatusOK, "compose.html", &ComposeRenderData{
|
||||||
RenderData: *NewRenderData(ctx),
|
RenderData: *NewRenderData(ctx),
|
||||||
Message: &msg,
|
Message: &msg,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ import (
|
||||||
|
|
||||||
type luaRoute struct {
|
type luaRoute struct {
|
||||||
method string
|
method string
|
||||||
path string
|
path string
|
||||||
f *lua.LFunction
|
f *lua.LFunction
|
||||||
}
|
}
|
||||||
|
|
||||||
type luaPlugin struct {
|
type luaPlugin struct {
|
||||||
|
@ -94,8 +94,8 @@ func (p *luaPlugin) SetRoutes(group *echo.Group) {
|
||||||
for _, r := range p.routes {
|
for _, r := range p.routes {
|
||||||
group.Match([]string{r.method}, r.path, func(ctx echo.Context) error {
|
group.Match([]string{r.method}, r.path, func(ctx echo.Context) error {
|
||||||
err := p.state.CallByParam(lua.P{
|
err := p.state.CallByParam(lua.P{
|
||||||
Fn: r.f,
|
Fn: r.f,
|
||||||
NRet: 0,
|
NRet: 0,
|
||||||
Protect: true,
|
Protect: true,
|
||||||
}, luar.New(p.state, ctx))
|
}, luar.New(p.state, ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
12
template.go
12
template.go
|
@ -28,7 +28,7 @@ type GlobalRenderData struct {
|
||||||
// template-specific fields.
|
// template-specific fields.
|
||||||
type RenderData struct {
|
type RenderData struct {
|
||||||
Global GlobalRenderData
|
Global GlobalRenderData
|
||||||
Extra map[string]interface{}
|
Extra map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRenderData(ctx *context) *RenderData {
|
func NewRenderData(ctx *context) *RenderData {
|
||||||
|
@ -41,13 +41,13 @@ func NewRenderData(ctx *context) *RenderData {
|
||||||
|
|
||||||
return &RenderData{
|
return &RenderData{
|
||||||
Global: global,
|
Global: global,
|
||||||
Extra: make(map[string]interface{}),
|
Extra: make(map[string]interface{}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type renderer struct {
|
type renderer struct {
|
||||||
base *template.Template
|
base *template.Template
|
||||||
themes map[string]*template.Template
|
themes map[string]*template.Template
|
||||||
defaultTheme string
|
defaultTheme string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,8 +127,8 @@ func loadTemplates(logger echo.Logger, defaultTheme string, plugins []Plugin) (*
|
||||||
}
|
}
|
||||||
|
|
||||||
return &renderer{
|
return &renderer{
|
||||||
base: base,
|
base: base,
|
||||||
themes: themes,
|
themes: themes,
|
||||||
defaultTheme: defaultTheme,
|
defaultTheme: defaultTheme,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue