Rename RenderData to BaseRenderData

RenderData will be used for an interface.
This commit is contained in:
Simon Ser 2019-12-17 13:27:20 +01:00
parent 29e0879dd9
commit d8a875a5f7
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
2 changed files with 12 additions and 12 deletions

View file

@ -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,
})
}

View file

@ -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{}),
}