templates

package
v0.0.0-...-1d800d4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: AGPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(appName string, i18nOptions I18nOptions, am assets.Manager) error

func RespondHTML

func RespondHTML(c *httpUtils.Context, body Renderer, err error, s *session.Session, ps *PublicSettings, flushSession func(c *httpUtils.Context, session *session.Session) error)

func RespondHTMLCustomStatus

func RespondHTMLCustomStatus(c *httpUtils.Context, code int, body Renderer, err error, s *session.Session, ps *PublicSettings, flushSession func(c *httpUtils.Context, session *session.Session) error)

Types

type AllowedImageName

type AllowedImageName struct {
	AdminOnly bool                  `json:"adminOnly"`
	Name      sharedTypes.ImageName `json:"name"`
	Desc      string                `json:"desc"`
}

type AngularLayoutData

type AngularLayoutData struct {
	CommonData
}

func (*AngularLayoutData) CSP

func (d *AngularLayoutData) CSP() string

func (*AngularLayoutData) Entrypoint

func (d *AngularLayoutData) Entrypoint() string

type BetaProgramParticipate

type BetaProgramParticipate struct {
	MarketingLayoutData

	AlreadyInBetaProgram bool
}

func (*BetaProgramParticipate) Entrypoint

func (d *BetaProgramParticipate) Entrypoint() string

func (*BetaProgramParticipate) Meta

func (d *BetaProgramParticipate) Meta() []metaEntry

func (*BetaProgramParticipate) Render

func (d *BetaProgramParticipate) Render() ([]byte, string, error)

type CommonData

type CommonData struct {
	Settings *PublicSettings

	Session       session.PublicData
	ThemeModifier string
	Title         string
	TitleLocale   string

	HideFooter            bool
	HideNavBar            bool
	DeferCSSBundleLoading bool
	RobotsNoindexNofollow bool
	Viewport              bool
}

func (*CommonData) CurrentLngCode

func (d *CommonData) CurrentLngCode() string

func (*CommonData) LoggedIn

func (d *CommonData) LoggedIn() bool

func (*CommonData) Meta

func (d *CommonData) Meta() []metaEntry

func (*CommonData) ResourceHints

func (d *CommonData) ResourceHints() string

type DetachRole

type DetachRole string

func (DetachRole) Validate

func (r DetachRole) Validate() error

type EditorBootstrap

type EditorBootstrap struct {
	AllowedImageNames    []AllowedImageName           `json:"allowedImageNames"`
	AnonymousAccessToken project.AccessToken          `json:"anonymousAccessToken"`
	SystemMessages       []systemMessage.Full         `json:"systemMessages"`
	JWTProject           string                       `json:"jwtCompile"`
	JWTLoggedInUser      string                       `json:"jwtLoggedInUser"`
	JWTSpelling          string                       `json:"jwtSpelling"`
	Project              project.LoadEditorViewPublic `json:"project"`
	RootDocPath          sharedTypes.PathName         `json:"rootDocPath"`
	User                 user.WithLoadEditorInfo      `json:"user"`
	Anonymous            bool                         `json:"anonymous"`
	IsRestrictedUser     project.IsRestrictedUser     `json:"isRestrictedTokenMember"`
	DetachRole           DetachRole                   `json:"detachRole"`
}

type EditorSettings

type EditorSettings struct {
	MaxDocLength           int64                  `json:"max_doc_length"`
	MaxEntitiesPerProject  int64                  `json:"maxEntitiesPerProject"`
	MaxUploadSize          int64                  `json:"maxUploadSize"`
	WsURL                  string                 `json:"wsUrl"`
	WsRetryHandshake       int64                  `json:"wsRetryHandshake"`
	EditorThemes           []string               `json:"editorThemes"`
	TextExtensions         []sharedTypes.FileType `json:"textExtensions"`
	ValidRootDocExtensions []sharedTypes.FileType `json:"validRootDocExtensions"`
	WikiEnabled            bool                   `json:"wikiEnabled"`
	EnablePdfCaching       bool                   `json:"enablePdfCaching"`
	ResetServiceWorker     bool                   `json:"resetServiceWorker"`
}

type General400Data

type General400Data struct {
	NoJsLayoutData
	Message string
}

func (*General400Data) Render

func (d *General400Data) Render() ([]byte, string, error)

type General404Data

type General404Data struct {
	MarketingLayoutData
}

func (*General404Data) Render

func (d *General404Data) Render() ([]byte, string, error)

type General500Data

type General500Data struct {
	NoJsLayoutData
}

func (*General500Data) Render

func (d *General500Data) Render() ([]byte, string, error)

type GeneralUnsupportedBrowserData

type GeneralUnsupportedBrowserData struct {
	NoJsLayoutData
	FromURL *sharedTypes.URL
}

func (*GeneralUnsupportedBrowserData) Render

func (d *GeneralUnsupportedBrowserData) Render() ([]byte, string, error)

type I18nOptions

type I18nOptions struct {
	DefaultLang   string              `json:"default_lang"`
	SubdomainLang []I18nSubDomainLang `json:"subdomain_lang"`
}

func (*I18nOptions) Languages

func (o *I18nOptions) Languages() translations.Languages

func (*I18nOptions) Validate

func (o *I18nOptions) Validate() error

type I18nSubDomainLang

type I18nSubDomainLang struct {
	Hide    bool   `json:"hide"`
	LngCode string `json:"lng_code"`
}

type LearnPageData

type LearnPageData struct {
	MarketingLayoutData

	PageContent     template.HTML
	ContentsContent template.HTML
}

func (*LearnPageData) CSP

func (d *LearnPageData) CSP() string

func (*LearnPageData) Render

func (d *LearnPageData) Render() ([]byte, string, error)

type MarketingLayoutData

type MarketingLayoutData struct {
	CommonData
}

func (*MarketingLayoutData) CSP

func (d *MarketingLayoutData) CSP() string

func (*MarketingLayoutData) Entrypoint

func (d *MarketingLayoutData) Entrypoint() string
type NavElement struct {
	Class string `json:"class"`
	Label string `json:"label"`
	Text  string `json:"text"`
	URL   string `json:"url"`
}
type NavElementWithDivider struct {
	NavElement
	Divider bool `json:"divider"`
}
type NavElementWithDropDown struct {
	NavElement
	Dropdown []NavElementWithDivider `json:"dropdown"`
}
type NavOptions struct {
	HeaderExtras []NavElementWithDropDown `json:"header_extras"`
	LeftFooter   []NavElement             `json:"left_footer"`
	RightFooter  []NavElement             `json:"right_footer"`
	Title        string                   `json:"title"`
}

type NoJsLayoutData

type NoJsLayoutData struct {
	CommonData
}

func (*NoJsLayoutData) CSP

func (d *NoJsLayoutData) CSP() string

func (*NoJsLayoutData) Entrypoint

func (d *NoJsLayoutData) Entrypoint() string

type OpenInOverleafDocumentationData

type OpenInOverleafDocumentationData struct {
	MarketingLayoutData
	// contains filtered or unexported fields
}

func (*OpenInOverleafDocumentationData) Entrypoint

func (d *OpenInOverleafDocumentationData) Entrypoint() string

func (*OpenInOverleafDocumentationData) GatewayURL

func (d *OpenInOverleafDocumentationData) GatewayURL() string

func (*OpenInOverleafDocumentationData) Render

type OpenInOverleafGatewayData

type OpenInOverleafGatewayData struct {
	MarketingLayoutData
	Params json.RawMessage
}

func (*OpenInOverleafGatewayData) Entrypoint

func (d *OpenInOverleafGatewayData) Entrypoint() string

func (*OpenInOverleafGatewayData) Meta

func (d *OpenInOverleafGatewayData) Meta() []metaEntry

func (*OpenInOverleafGatewayData) Render

func (d *OpenInOverleafGatewayData) Render() ([]byte, string, error)

type PrefetchedProjectsBlob

type PrefetchedProjectsBlob struct {
	TotalSize int                      `json:"totalSize"`
	Projects  []ProjectListProjectView `json:"projects"`
}

type ProjectEditorData

type ProjectEditorData struct {
	AngularLayoutData
	EditorBootstrap *EditorBootstrap
}

func (*ProjectEditorData) CSP

func (d *ProjectEditorData) CSP() string

func (*ProjectEditorData) Entrypoint

func (d *ProjectEditorData) Entrypoint() string

func (*ProjectEditorData) Meta

func (d *ProjectEditorData) Meta() []metaEntry

func (*ProjectEditorData) Render

func (d *ProjectEditorData) Render() ([]byte, string, error)

func (*ProjectEditorData) ResourceHints

func (d *ProjectEditorData) ResourceHints() string

type ProjectEditorDetachedData

type ProjectEditorDetachedData struct {
	MarketingLayoutData
	EditorBootstrap *EditorBootstrap
}

func (*ProjectEditorDetachedData) CSP

func (*ProjectEditorDetachedData) Entrypoint

func (d *ProjectEditorDetachedData) Entrypoint() string

func (*ProjectEditorDetachedData) Meta

func (d *ProjectEditorDetachedData) Meta() []metaEntry

func (*ProjectEditorDetachedData) Render

func (d *ProjectEditorDetachedData) Render() ([]byte, string, error)

func (*ProjectEditorDetachedData) ResourceHints

func (d *ProjectEditorDetachedData) ResourceHints() string

type ProjectListData

type ProjectListData struct {
	AngularLayoutData

	PrefetchedProjectsBlob PrefetchedProjectsBlob
	Tags                   []tag.Full
	JWTLoggedInUser        string
	Notifications          notification.Notifications
	UserEmails             []user.EmailDetailsWithDefaultFlag
	SuggestedLngCode       string
	SystemMessages         []systemMessage.Full
}

func (*ProjectListData) Entrypoint

func (d *ProjectListData) Entrypoint() string

func (*ProjectListData) Meta

func (d *ProjectListData) Meta() []metaEntry

func (*ProjectListData) Render

func (d *ProjectListData) Render() ([]byte, string, error)

type ProjectListProjectView

type ProjectListProjectView struct {
	Id                sharedTypes.UUID                    `json:"id"`
	Name              project.Name                        `json:"name"`
	LastUpdatedAt     time.Time                           `json:"lastUpdated"`
	LastUpdatedBy     user.WithPublicInfoAndNonStandardId `json:"lastUpdatedBy"`
	PublicAccessLevel project.PublicAccessLevel           `json:"publicAccessLevel"`
	AccessLevel       sharedTypes.PrivilegeLevel          `json:"accessLevel"`
	AccessSource      project.AccessSource                `json:"source"`
	Archived          bool                                `json:"archived"`
	Trashed           bool                                `json:"trashed"`
	Owner             user.WithPublicInfoAndNonStandardId `json:"owner"`
}

type ProjectTokenAccessData

type ProjectTokenAccessData struct {
	AngularLayoutData

	PostURL     *sharedTypes.URL
	ProjectName project.Name
}

func (*ProjectTokenAccessData) Meta

func (d *ProjectTokenAccessData) Meta() []metaEntry

func (*ProjectTokenAccessData) Render

func (d *ProjectTokenAccessData) Render() ([]byte, string, error)

type ProjectViewInviteData

type ProjectViewInviteData struct {
	MarketingLayoutData

	SharedProjectData SharedProjectData
	ProjectId         sharedTypes.UUID
	Token             projectInvite.Token
	Valid             bool
}

func (*ProjectViewInviteData) Render

func (d *ProjectViewInviteData) Render() ([]byte, string, error)

type PublicSentryOptions

type PublicSentryOptions struct {
	Frontend SentryFrontendOptions `json:"frontend"`
}

type PublicSettings

type PublicSettings struct {
	AppName                   string
	AdminEmail                sharedTypes.Email
	CDNURL                    sharedTypes.URL
	CSPs                      csp.CSPs
	EditorSettings            EditorSettings
	I18n                      I18nOptions
	Nav                       NavOptions
	Sentry                    PublicSentryOptions
	SiteURL                   sharedTypes.URL
	StatusPageURL             *sharedTypes.URL
	TranslatedLanguages       map[string]string
	ZipFileSizeLimit          int64
	EmailConfirmationDisabled bool
	RegistrationDisabled      bool
	RobotsNoindex             bool
}

func (*PublicSettings) ShowLanguagePicker

func (s *PublicSettings) ShowLanguagePicker() bool

type Renderer

type Renderer interface {
	CSP() string
	Entrypoint() string
	Render() ([]byte, string, error)
	ResourceHints() string
}

type SentryFrontendOptions

type SentryFrontendOptions struct {
	Dsn                string `json:"dsn"`
	Environment        string `json:"environment,omitempty"`
	Release            string `json:"release,omitempty"`
	Commit             string `json:"commit,omitempty"`
	AllowedOriginRegex string `json:"allowedOriginRegex,omitempty"`
}

type SharedProjectData

type SharedProjectData struct {
	ProjectName project.Name `form:"project_name"`
	UserName    string       `form:"user_first_name"`
}

func (*SharedProjectData) FromQuery

func (d *SharedProjectData) FromQuery(q url.Values) error

func (*SharedProjectData) IsSet

func (d *SharedProjectData) IsSet() bool

func (*SharedProjectData) Preprocess

func (d *SharedProjectData) Preprocess()

type UserActivateData

type UserActivateData struct {
	MarketingLayoutData
	Email sharedTypes.Email
	Token oneTimeToken.OneTimeToken
}

func (*UserActivateData) Render

func (d *UserActivateData) Render() ([]byte, string, error)

type UserConfirmEmailData

type UserConfirmEmailData struct {
	MarketingLayoutData
	Token oneTimeToken.OneTimeToken
}

func (*UserConfirmEmailData) Render

func (d *UserConfirmEmailData) Render() ([]byte, string, error)

type UserLoginData

type UserLoginData struct {
	MarketingLayoutData
}

func (*UserLoginData) Render

func (d *UserLoginData) Render() ([]byte, string, error)

type UserLogoutData

type UserLogoutData struct {
	MarketingLayoutData
}

func (*UserLogoutData) Render

func (d *UserLogoutData) Render() ([]byte, string, error)

type UserPasswordResetData

type UserPasswordResetData struct {
	MarketingLayoutData
	Email sharedTypes.Email
}

func (*UserPasswordResetData) Render

func (d *UserPasswordResetData) Render() ([]byte, string, error)

type UserReconfirmData

type UserReconfirmData struct {
	MarketingLayoutData
	Email sharedTypes.Email
}

func (*UserReconfirmData) Render

func (d *UserReconfirmData) Render() ([]byte, string, error)

type UserRegisterData

type UserRegisterData struct {
	MarketingLayoutData
	SharedProjectData SharedProjectData
}

func (*UserRegisterData) Render

func (d *UserRegisterData) Render() ([]byte, string, error)

type UserRestrictedData

type UserRestrictedData struct {
	MarketingLayoutData
}

func (*UserRestrictedData) Render

func (d *UserRestrictedData) Render() ([]byte, string, error)

type UserSessionsData

type UserSessionsData struct {
	MarketingLayoutData
	CurrentSession session.LoginMetadata
	OtherSessions  []session.LoginMetadata
}

func (*UserSessionsData) Render

func (d *UserSessionsData) Render() ([]byte, string, error)

type UserSetPasswordData

type UserSetPasswordData struct {
	MarketingLayoutData
	Email              sharedTypes.Email
	PasswordResetToken oneTimeToken.OneTimeToken
}

func (*UserSetPasswordData) Render

func (d *UserSetPasswordData) Render() ([]byte, string, error)

type UserSettingsData

type UserSettingsData struct {
	MarketingLayoutData
	User *user.ForSettingsPage
}

func (*UserSettingsData) Entrypoint

func (d *UserSettingsData) Entrypoint() string

func (*UserSettingsData) Meta

func (d *UserSettingsData) Meta() []metaEntry

func (*UserSettingsData) Render

func (d *UserSettingsData) Render() ([]byte, string, error)

Jump to

Keyboard shortcuts

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