handlers

package
v1.0.48 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserIDKey           = "user_id"
	OriginalUserIDKey   = "original_user_id"
	UserRoleKey         = "user_role"
	OriginalUserRoleKey = "original_user_role"
	FlashCookiePrefix   = "flash"
)

Variables

This section is empty.

Functions

func ActionRequired added in v1.0.42

func ActionRequired(w http.ResponseWriter, r *http.Request)

func DashBoard added in v1.0.42

func DashBoard(w http.ResponseWriter, r *http.Request)

func DashBoardIcon added in v1.0.42

func DashBoardIcon(w http.ResponseWriter, r *http.Request)

func DraftsToComplete added in v1.0.42

func DraftsToComplete(w http.ResponseWriter, r *http.Request)

func Home added in v1.0.42

func Home(w http.ResponseWriter, r *http.Request)

func InternalServerError added in v1.0.42

func InternalServerError(w http.ResponseWriter, r *http.Request)

func NotFound added in v1.0.42

func NotFound(w http.ResponseWriter, r *http.Request)

func RecentActivity added in v1.0.42

func RecentActivity(w http.ResponseWriter, r *http.Request)

Types

type BaseContext

type BaseContext struct {
	CurrentURL      *url.URL
	Flash           []flash.Flash
	Timezone        *time.Location
	Loc             *gotext.Locale
	User            *models.Person
	UserRole        string
	OriginalUser    *models.Person
	CSRFToken       string
	CSRFTag         template.HTML
	FrontendBaseUrl string
}

also add fields to Yield method

func (BaseContext) Yield

func (c BaseContext) Yield(pairs ...any) map[string]any

type BaseHandler

type BaseHandler struct {
	Router          *ich.Mux
	Logger          *zap.SugaredLogger
	SessionName     string
	SessionStore    sessions.Store
	UserService     backends.UserService
	Timezone        *time.Location
	Loc             *gotext.Locale
	BaseURL         *url.URL
	FrontendBaseUrl string
}

TODO handlers should only have access to a url builder, the session and maybe the localizer

func (BaseHandler) ActionError

func (h BaseHandler) ActionError(w http.ResponseWriter, r *http.Request, ctx BaseContext, msg string, err error, ID string)

func (BaseHandler) AddFlash

func (h BaseHandler) AddFlash(r *http.Request, w http.ResponseWriter, f flash.Flash) error

func (*BaseHandler) ErrorModal

func (h *BaseHandler) ErrorModal(w http.ResponseWriter, r *http.Request, errID string, ctx BaseContext)

func (*BaseHandler) InternalServerError

func (h *BaseHandler) InternalServerError(w http.ResponseWriter, r *http.Request, ctx BaseContext)

func (BaseHandler) NewContext

func (h BaseHandler) NewContext(r *http.Request, w http.ResponseWriter) (BaseContext, error)

func (*BaseHandler) NotFound

func (h *BaseHandler) NotFound(w http.ResponseWriter, r *http.Request, ctx BaseContext)

func (BaseHandler) PathFor

func (h BaseHandler) PathFor(name string, pairs ...string) *url.URL

func (BaseHandler) URLFor

func (h BaseHandler) URLFor(name string, pairs ...string) *url.URL

func (BaseHandler) Wrap

type YieldErrorDialog

type YieldErrorDialog struct {
	Message     string
	RedirectURL string
}

type YieldModalError

type YieldModalError struct {
	BaseContext
	ID string
}

type YieldNotFound

type YieldNotFound struct {
	BaseContext
	PageTitle        string
	ActiveNav        string
	ErrorTitle       string
	ErrorDescription string
}

Directories

Path Synopsis
TODO this replicates to much of publicationviewing and publicationsearching
TODO this replicates to much of publicationviewing and publicationsearching

Jump to

Keyboard shortcuts

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