inbox

package
v1.0.1-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmailListTemplate = tmpl.MustCompile(&EmailList{}, tmpl.UseFuncs(tmpl.FuncMap{
		"hex": func(id primitive.ObjectID) string {
			return id.Hex()
		},
		"join": func(strs []string) string {
			return strings.Join(strs, ", ")
		},
		"formatTimeSince": formatTimeSince,
	}))
)
View Source
var EmailListTmplFS embed.FS
View Source
var EmailViewTmplFS embed.FS
View Source
var InboxPageTmplFS embed.FS
View Source
var Template = tmpl.MustCompile(
	&InboxPage{},
	tmpl.UseFuncs(tmpl.FuncMap{
		"html": func(v string) template.HTML {
			return template.HTML(v)
		},
		"hex": func(id primitive.ObjectID) string {
			return id.Hex()
		},
		"join": func(strs []string) string {
			return strings.Join(strs, ", ")
		},
		"formatTimeSince": formatTimeSince,
	}),
)

Template can be used to render the inbox page.

Functions

This section is empty.

Types

type EmailList

type EmailList struct {
	// Emails is a list of emails to display in the inbox.
	Emails []*model.Email
	// Current is the currently selected email.
	Current *model.Email
}

func (*EmailList) TemplateText

func (t *EmailList) TemplateText() string

type EmailView

type EmailView struct {
	Current *model.Email
}

func (*EmailView) TemplateText

func (t *EmailView) TemplateText() string

type InboxPage

type InboxPage struct {
	// Page is a template for a base html page.
	// It exposes the `body` template slot.
	html.Page `tmpl:"page"` // <- name the template, so it can be used as a target

	EmailList EmailList `tmpl:"email-list"`
	EmailView EmailView `tmpl:"email-view"`

	// Current is the currently selected email.
	Current *model.Email
}

func (*InboxPage) TemplateText

func (t *InboxPage) TemplateText() string

type LoaderData

type LoaderData struct {
	Emails  []*model.Email
	Current *model.Email
}

type RouteModule

type RouteModule struct {
	SmtpService smtp.Service
}

RouteModule is the torque route module for the landing page.

func (*RouteModule) Action

func (rm *RouteModule) Action(wr http.ResponseWriter, req *http.Request) error

func (*RouteModule) Load

func (rm *RouteModule) Load(req *http.Request) (any, error)

func (*RouteModule) Render

func (rm *RouteModule) Render(wr http.ResponseWriter, req *http.Request, ld any) error

func (*RouteModule) Subscribe

func (rm *RouteModule) Subscribe(wr http.ResponseWriter, req *http.Request) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL