templates

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfirmError = Data{
	PageTitle:    "Confirm",
	ContentTitle: "Confirm Error",
	Content: `An error occurred when you requested to confirm your account.
				The problem has been forwarded to our team automatically. We will look into it and come
                back to you. We apologise for this inconvenience.`,
}

ConfirmError encapsulates the information displayed to the user when confirming an account fails.

View Source
var ConfirmSuccess = Data{
	PageTitle:    "Confirm",
	ContentTitle: "Confirmation Successful",
	Content:      "Your account has been confirmed. You will now receive an email whenever there are new heavy metal releases to headbang to.",
}

ConfirmSuccess encapsulates the information displayed to the user when confirming an account succeeds.

View Source
var NoDuplicateUsersError = Data{
	PageTitle:    "Start",
	ContentTitle: "Start Service Error",
	Content: `We are unable to process your request to sign up for our service again using the same email address
				that is currently associated with an active account. Our policy prohibits multiple accounts 
				with the same email address.`,
}

NoDuplicateUsersError encapsulates the information displayed to the user when stopping their service fails.

View Source
var StopError = Data{
	PageTitle:    "Stop",
	ContentTitle: "Stop Service Error",
	Content: `An error occurred when you requested to stop using our service.
				The problem has been forwarded to our team automatically. We will look into it and come
                back to you. We apologise for this inconvenience.`,
}

StopError encapsulates the information displayed to the user when stopping their service fails.

View Source
var UserLimitReachedError = Data{
	PageTitle:    "User Limit Reached",
	ContentTitle: "User Limit Reached",
	Content: `You cannot register because the user limit has been reached. This limit depends on the SendGrid API key. 
				You can sponsor the author of this project or buy him a coffee for him to have enough money to purchase
				the paid SendGrid plan to increase the limit. You will find the details here: 
				https://github.com/reaper47/heavy-metal-notifier?tab=readme-ov-file#sponsors.`,
}

UserLimitReachedError encapsulates the information displayed to the user when the user limit has been reached. The limit depends on the SendGrid API key.

Functions

func Render

func Render(w http.ResponseWriter, name string, data any) error

Render is a wrapper for template.ExecuteTemplate.

func RenderEmail

func RenderEmail(name string, data any) string

RenderEmail is a wrapper for template.ExecuteTemplate on email templates.

Types

type Data

type Data struct {
	ShowNav       bool
	IsAboutPage   bool
	IsContactPage bool
	IsMessageSent bool
	IsHomePage    bool

	PageTitle    string
	ContentTitle string
	Content      string
	EmailBase64  string
}

Data holds general template data.

type DataError

type DataError struct {
	Text string
}

DataError holds data on an error.

type EmailData

type EmailData struct {
	From    string
	Message string
	URL     string

	EmailBase64 string
	Name        string
	Releases    []models.Release
	Text        string
}

EmailData holds data for email templates.

type EmailTemplate added in v1.3.0

type EmailTemplate string

EmailTemplate represents the name of a .mjml email template.

const (
	EmailContact      EmailTemplate = "contact.mjml"
	EmailEndOfService EmailTemplate = "end-of-service.mjml"
	EmailErrorAdmin   EmailTemplate = "error-admin.mjml"
	EmailIntro        EmailTemplate = "intro.mjml"
	EmailReleases     EmailTemplate = "releases.mjml"
)

func (EmailTemplate) String added in v1.3.0

func (e EmailTemplate) String() string

String represents the email template as a string, being the file name.

func (EmailTemplate) Subject added in v1.3.0

func (e EmailTemplate) Subject() string

Subject returns the subject of the email according to the type of email being sent.

Jump to

Keyboard shortcuts

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