frontend

package
v0.0.0-...-c97fb91 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountHandler

type AccountHandler struct {
	Frontend *Frontend
}

AccountHandler for the application.

func (*AccountHandler) ServeHTTP

func (h *AccountHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type AdminDashboardHandler

type AdminDashboardHandler struct {
	Frontend *Frontend
}

AdminDashboardHandler for the application.

func (*AdminDashboardHandler) ServeHTTP

DashboardHandler for /admin.

type AdminHandler

type AdminHandler struct {
	Frontend *Frontend
	// contains filtered or unexported fields
}

AdminHandler for the application.

func (*AdminHandler) Load

func (h *AdminHandler) Load()

Load /admin routes.

func (*AdminHandler) ServeHTTP

func (h *AdminHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type AdminReportsHandler

type AdminReportsHandler struct {
	Frontend *Frontend
}

AdminReportsHandler for the application.

func (*AdminReportsHandler) ServeHTTP

func (h *AdminReportsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

UsersHandler for /admin/reports.

type AdminRolesHandler

type AdminRolesHandler struct {
	Frontend *Frontend
}

AdminRolesHandler for the application.

func (*AdminRolesHandler) ServeHTTP

func (h *AdminRolesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

UsersHandler for /admin/roles.

type AdminSecurityHandler

type AdminSecurityHandler struct {
	Frontend *Frontend
}

AdminSecurityHandler for the application.

func (*AdminSecurityHandler) ServeHTTP

func (h *AdminSecurityHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

UsersHandler for /admin/security.

type AdminUsersHandler

type AdminUsersHandler struct {
	Frontend *Frontend
}

AdminUsersHandler for the application.

func (*AdminUsersHandler) ServeHTTP

func (h *AdminUsersHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

UsersHandler for /admin/users.

type Breadcrumb struct {
	Text   string
	Link   string
	Active bool
}

Breadcrumb shows where the user is currently.

type Frontend

type Frontend struct {
	Modules *services.Modules
	// contains filtered or unexported fields
}

Frontend helpers.

func (*Frontend) HTTPError

func (f *Frontend) HTTPError(w http.ResponseWriter, r *http.Request, code int, errs ...error)

HTTPError renders an user-friendly error page.

func (*Frontend) Respond

func (f *Frontend) Respond(w http.ResponseWriter, r *http.Request, resp *HTMLResponse)

Respond HTML to the browser.

NOTE(henvic): Regarding why we need to use a second template execution when printing with the layout, please see: https://groups.google.com/d/msg/golang-nuts/PRLloHrJrDU/lDYA6Pq_l8QJ https://stackoverflow.com/questions/28830543/how-to-use-a-field-of-struct-or-variable-value-as-template-name/28831138#28831138

type HTMLResponse

type HTMLResponse struct {
	Template      string
	Title         string
	CanonicalLink string
	Breadcrumb    []Breadcrumb
	Content       interface{}
	SkipLayout    bool

	Params *HTMLResponseParams
}

HTMLResponse to send to the client.

type HTMLResponseParams

type HTMLResponseParams struct {
	Settings  *config.Settings
	CSRFField template.HTML
	Request   *http.Request
	User      *services.User
}

HTMLResponseParams injected into the template object.

type HTTPErrorHandlerTemplate

type HTTPErrorHandlerTemplate struct {
	StatusCode int
	StatusText string
	Errors     []error
}

HTTPErrorHandlerTemplate to use when rendering 'Internal Server Error' pages and the like.

type HomepageHandler

type HomepageHandler struct {
	Frontend *Frontend
}

HomepageHandler handles the / page.

func (*HomepageHandler) ServeHTTP

func (h *HomepageHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type LoginForm

type LoginForm struct {
	Email      string
	RememberMe bool

	Error error
}

LoginForm for /login.

type LoginHandler

type LoginHandler struct {
	Frontend *Frontend
}

LoginHandler handles the user authentication.

func (*LoginHandler) ServeHTTP

func (h *LoginHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type LogoutHandler

type LogoutHandler struct {
	Frontend *Frontend
}

LogoutHandler manages the logout endpoint.

func (*LogoutHandler) ServeHTTP

func (h *LogoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ProductHandler

type ProductHandler struct {
	Frontend *Frontend
}

ProductHandler for the application.

func (*ProductHandler) ServeHTTP

func (h *ProductHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Router

type Router struct {
	Frontend *Frontend
	// contains filtered or unexported fields
}

Router for the webpages.

func (*Router) Load

func (rh *Router) Load(modules *services.Modules)

Load HTTP handlers.

func (*Router) ServeHTTP

func (rh *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)

type SearchHandler

type SearchHandler struct {
	Frontend *Frontend
}

SearchHandler for the application.

func (*SearchHandler) ServeHTTP

func (h *SearchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type StaticHandler

type StaticHandler struct {
	Frontend *Frontend
}

StaticHandler checks permission to see if the user is able to access static content, and serve them. This is useful to provide files such as favicon.ico, or other stuff that aren't supposed to be stored in the CDN.

func (*StaticHandler) ServeHTTP

func (h *StaticHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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