diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-17 13:27:20 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-12-17 13:27:20 +0100 |
commit | d8a875a5f74f90c2ca52c61e72ddb88f78d97277 (patch) | |
tree | e0c189cda0ee0d968e7842033e840e1b5b8efee0 | |
parent | 29e0879dd988d7467f5e28ec9673fd8f436cc5f0 (diff) | |
download | alps-d8a875a5f74f90c2ca52c61e72ddb88f78d97277.tar.gz alps-d8a875a5f74f90c2ca52c61e72ddb88f78d97277.zip |
Rename RenderData to BaseRenderData
RenderData will be used for an interface.
-rw-r--r-- | plugins/base/routes.go | 14 | ||||
-rw-r--r-- | template.go | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/plugins/base/routes.go b/plugins/base/routes.go index bf1b90d..fe3e946 100644 --- a/plugins/base/routes.go +++ b/plugins/base/routes.go @@ -54,7 +54,7 @@ func registerRoutes(p *koushin.GoPlugin) { } type MailboxRenderData struct { - koushin.RenderData + koushin.BaseRenderData Mailbox *imap.MailboxStatus Mailboxes []*imap.MailboxInfo Messages []IMAPMessage @@ -115,7 +115,7 @@ func handleGetMailbox(ectx echo.Context) error { } return ctx.Render(http.StatusOK, "mailbox.html", &MailboxRenderData{ - RenderData: *koushin.NewRenderData(ctx), + BaseRenderData: *koushin.NewBaseRenderData(ctx), Mailbox: mbox, Mailboxes: mailboxes, Messages: msgs, @@ -143,7 +143,7 @@ func handleLogin(ectx echo.Context) error { return ctx.Redirect(http.StatusFound, "/mailbox/INBOX") } - return ctx.Render(http.StatusOK, "login.html", koushin.NewRenderData(ctx)) + return ctx.Render(http.StatusOK, "login.html", koushin.NewBaseRenderData(ctx)) } func handleLogout(ectx echo.Context) error { @@ -155,7 +155,7 @@ func handleLogout(ectx echo.Context) error { } type MessageRenderData struct { - koushin.RenderData + koushin.BaseRenderData Mailboxes []*imap.MailboxInfo Mailbox *imap.MailboxStatus Message *IMAPMessage @@ -239,7 +239,7 @@ func handleGetPart(ctx *koushin.Context, raw bool) error { } return ctx.Render(http.StatusOK, "message.html", &MessageRenderData{ - RenderData: *koushin.NewRenderData(ctx), + BaseRenderData: *koushin.NewBaseRenderData(ctx), Mailboxes: mailboxes, Mailbox: mbox, Message: msg, @@ -251,7 +251,7 @@ func handleGetPart(ctx *koushin.Context, raw bool) error { } type ComposeRenderData struct { - koushin.RenderData + koushin.BaseRenderData Message *OutgoingMessage } @@ -353,7 +353,7 @@ func handleCompose(ectx echo.Context) error { } return ctx.Render(http.StatusOK, "compose.html", &ComposeRenderData{ - RenderData: *koushin.NewRenderData(ctx), + BaseRenderData: *koushin.NewBaseRenderData(ctx), Message: &msg, }) } diff --git a/template.go b/template.go index 4f33e5e..379b6d5 100644 --- a/template.go +++ b/template.go @@ -24,15 +24,15 @@ type GlobalRenderData struct { Extra map[string]interface{} } -// RenderData is the base type for templates. It should be extended with new -// template-specific fields. -type RenderData struct { +// BaseRenderData is the base type for templates. It should be extended with +// new template-specific fields. +type BaseRenderData struct { Global GlobalRenderData // Additional plugin-specific data Extra map[string]interface{} } -func NewRenderData(ctx *Context) *RenderData { +func NewBaseRenderData(ctx *Context) *BaseRenderData { global := GlobalRenderData{Extra: make(map[string]interface{})} if ctx.Session != nil { @@ -40,7 +40,7 @@ func NewRenderData(ctx *Context) *RenderData { global.Username = ctx.Session.username } - return &RenderData{ + return &BaseRenderData{ Global: global, Extra: make(map[string]interface{}), } |