Rename RenderData to BaseRenderData
RenderData will be used for an interface.
This commit is contained in:
parent
29e0879dd9
commit
d8a875a5f7
2 changed files with 12 additions and 12 deletions
|
@ -54,7 +54,7 @@ func registerRoutes(p *koushin.GoPlugin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MailboxRenderData struct {
|
type MailboxRenderData struct {
|
||||||
koushin.RenderData
|
koushin.BaseRenderData
|
||||||
Mailbox *imap.MailboxStatus
|
Mailbox *imap.MailboxStatus
|
||||||
Mailboxes []*imap.MailboxInfo
|
Mailboxes []*imap.MailboxInfo
|
||||||
Messages []IMAPMessage
|
Messages []IMAPMessage
|
||||||
|
@ -115,7 +115,7 @@ func handleGetMailbox(ectx echo.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.Render(http.StatusOK, "mailbox.html", &MailboxRenderData{
|
return ctx.Render(http.StatusOK, "mailbox.html", &MailboxRenderData{
|
||||||
RenderData: *koushin.NewRenderData(ctx),
|
BaseRenderData: *koushin.NewBaseRenderData(ctx),
|
||||||
Mailbox: mbox,
|
Mailbox: mbox,
|
||||||
Mailboxes: mailboxes,
|
Mailboxes: mailboxes,
|
||||||
Messages: msgs,
|
Messages: msgs,
|
||||||
|
@ -143,7 +143,7 @@ func handleLogin(ectx echo.Context) error {
|
||||||
return ctx.Redirect(http.StatusFound, "/mailbox/INBOX")
|
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 {
|
func handleLogout(ectx echo.Context) error {
|
||||||
|
@ -155,7 +155,7 @@ func handleLogout(ectx echo.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MessageRenderData struct {
|
type MessageRenderData struct {
|
||||||
koushin.RenderData
|
koushin.BaseRenderData
|
||||||
Mailboxes []*imap.MailboxInfo
|
Mailboxes []*imap.MailboxInfo
|
||||||
Mailbox *imap.MailboxStatus
|
Mailbox *imap.MailboxStatus
|
||||||
Message *IMAPMessage
|
Message *IMAPMessage
|
||||||
|
@ -239,7 +239,7 @@ func handleGetPart(ctx *koushin.Context, raw bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.Render(http.StatusOK, "message.html", &MessageRenderData{
|
return ctx.Render(http.StatusOK, "message.html", &MessageRenderData{
|
||||||
RenderData: *koushin.NewRenderData(ctx),
|
BaseRenderData: *koushin.NewBaseRenderData(ctx),
|
||||||
Mailboxes: mailboxes,
|
Mailboxes: mailboxes,
|
||||||
Mailbox: mbox,
|
Mailbox: mbox,
|
||||||
Message: msg,
|
Message: msg,
|
||||||
|
@ -251,7 +251,7 @@ func handleGetPart(ctx *koushin.Context, raw bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ComposeRenderData struct {
|
type ComposeRenderData struct {
|
||||||
koushin.RenderData
|
koushin.BaseRenderData
|
||||||
Message *OutgoingMessage
|
Message *OutgoingMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ func handleCompose(ectx echo.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.Render(http.StatusOK, "compose.html", &ComposeRenderData{
|
return ctx.Render(http.StatusOK, "compose.html", &ComposeRenderData{
|
||||||
RenderData: *koushin.NewRenderData(ctx),
|
BaseRenderData: *koushin.NewBaseRenderData(ctx),
|
||||||
Message: &msg,
|
Message: &msg,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
10
template.go
10
template.go
|
@ -24,15 +24,15 @@ type GlobalRenderData struct {
|
||||||
Extra map[string]interface{}
|
Extra map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RenderData is the base type for templates. It should be extended with new
|
// BaseRenderData is the base type for templates. It should be extended with
|
||||||
// template-specific fields.
|
// new template-specific fields.
|
||||||
type RenderData struct {
|
type BaseRenderData struct {
|
||||||
Global GlobalRenderData
|
Global GlobalRenderData
|
||||||
// Additional plugin-specific data
|
// Additional plugin-specific data
|
||||||
Extra map[string]interface{}
|
Extra map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRenderData(ctx *Context) *RenderData {
|
func NewBaseRenderData(ctx *Context) *BaseRenderData {
|
||||||
global := GlobalRenderData{Extra: make(map[string]interface{})}
|
global := GlobalRenderData{Extra: make(map[string]interface{})}
|
||||||
|
|
||||||
if ctx.Session != nil {
|
if ctx.Session != nil {
|
||||||
|
@ -40,7 +40,7 @@ func NewRenderData(ctx *Context) *RenderData {
|
||||||
global.Username = ctx.Session.username
|
global.Username = ctx.Session.username
|
||||||
}
|
}
|
||||||
|
|
||||||
return &RenderData{
|
return &BaseRenderData{
|
||||||
Global: global,
|
Global: global,
|
||||||
Extra: make(map[string]interface{}),
|
Extra: make(map[string]interface{}),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue