Browse Source

go fmt

master
Simon Ser 4 years ago
parent
commit
835e9e5033
No known key found for this signature in database GPG Key ID: FDE7BE0E88F5E48
3 changed files with 17 additions and 17 deletions
  1. +7
    -7
      handlers.go
  2. +4
    -4
      plugin_lua.go
  3. +6
    -6
      template.go

+ 7
- 7
handlers.go 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,
})
}

+ 4
- 4
plugin_lua.go 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 {


+ 6
- 6
template.go 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
}

Loading…
Cancel
Save