templates

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

templ: version: v0.2.707

templ: version: v0.2.707

templ: version: v0.2.707

templ: version: v0.2.707

templ: version: v0.2.707

templ: version: v0.2.707

templ: version: v0.2.707

templ: version: v0.2.707

templ: version: v0.2.707

Index

Constants

View Source
const (
	TopMessageContextKey                 = "_top_message"
	LoginMessageContextKey               = "_login_message"
	LoginRedirectContextKey              = "_login_redirect"
	ForgotPasswordEmailMessageContextKey = "_forgot_password_email_message"
	ForgotPasswordFormMessageContextKey  = "_forgot_password_form_message"
	ChangePasswordContextKey             = "_change_password"
)
View Source
const (
	CustomHeadPartial   = "custom_head"
	CustomFooterPartial = "custom_footer"
	CustomMenuPartial   = "custom_menu"
)
View Source
const (
	CSRFTokenContextKey = "_csrf"
	CSRFTokenLookup     = "form:" + CSRFTokenContextKey

	UserContextKey    = "user"
	URLPathContextKey = "_url_path"
	TitleContextKey   = "_njudge_title"

	UsersContextKey         = "_njudge_users"
	ProblemsContextKey      = "_njudge_problems"
	ProblemsStoreContextKey = "_njudge_problems_store"
	PartialsStoreContextKey = "_njudge_partials_store"
)

Variables

This section is empty.

Functions

func Admin added in v0.5.0

func Admin() templ.Component

func CSRFHidden added in v0.5.0

func CSRFHidden() templ.Component

func ClearTemporaryFlashesMiddleware added in v0.5.0

func ClearTemporaryFlashesMiddleware() echo.MiddlewareFunc

func DeleteFlash added in v0.5.0

func DeleteFlash(c echo.Context, name string)

func Error added in v0.5.0

func Error(message string) templ.Component

func ForgotPasswordEmail added in v0.5.0

func ForgotPasswordEmail() templ.Component

func ForgotPasswordForm added in v0.5.0

func ForgotPasswordForm(vm ForgotPasswordFormViewModel) templ.Component

func GetFlash added in v0.5.0

func GetFlash(c echo.Context, name string) interface{}

func Home added in v0.5.0

func Home(news string) templ.Component

func Info added in v0.5.0

func Info(message string) templ.Component

func Login added in v0.5.0

func Login(vm LoginViewModel) templ.Component

func Middleware added in v0.5.0

func Middleware(users njudge.Users, ps njudge.Problems, problemStore problems.Store, partialsStore Store) echo.MiddlewareFunc

func MoveFlashesToContextMiddleware added in v0.5.0

func MoveFlashesToContextMiddleware() echo.MiddlewareFunc

func Page added in v0.5.0

func Page() templ.Component

func PageWithContent added in v0.5.0

func PageWithContent(content string) templ.Component

func Pagination added in v0.5.0

func Pagination(links []PaginationLink) templ.Component

func Problem added in v0.5.0

func Problem(vm ProblemViewModel) templ.Component

func ProblemEdit added in v0.6.0

func ProblemEdit(vm ProblemEditViewModel) templ.Component

func ProblemList added in v0.5.0

func ProblemList(vm ProblemListViewModel) templ.Component

func ProblemRanklist added in v0.5.0

func ProblemRanklist(vm ProblemRanklistViewModel) templ.Component

func ProblemStatus added in v0.5.0

func ProblemStatus(vm SubmissionsViewModel) templ.Component

func ProblemSubmit added in v0.5.0

func ProblemSubmit(vm ProblemSubmitViewModel) templ.Component

func ProblemsetRanklist added in v0.6.0

func ProblemsetRanklist(vm ProblemsetRanklistViewModel) templ.Component

func Profile added in v0.5.0

func Profile(vm ProfileViewModel) templ.Component

func ProfileSettings added in v0.5.0

func ProfileSettings(vm ProfileSettingsViewModel) templ.Component

func ProfileSubmissions added in v0.5.0

func ProfileSubmissions(vm ProfileSubmissionsViewModel) templ.Component

func Register added in v0.5.0

func Register(vm RegisterViewModel) templ.Component

func Render added in v0.5.0

func Render(ctx echo.Context, statusCode int, t templ.Component) error

func SetFlash added in v0.5.0

func SetFlash(c echo.Context, name string, value interface{})

func Status added in v0.5.0

func Submission added in v0.5.0

func Submission(vm SubmissionViewModel) templ.Component

func SubmissionFeedback added in v0.5.0

func SubmissionFeedback(s njudge.Submission) templ.Component

func SubmissionFeedbackUpdate added in v0.5.0

func SubmissionFeedbackUpdate(s njudge.Submission) templ.Component

func SubmissionRow added in v0.5.0

func SubmissionRow(s njudge.Submission) templ.Component

func SubmissionRowUpdate added in v0.5.0

func SubmissionRowUpdate(s njudge.Submission) templ.Component

func SubmissionStatusText added in v0.5.0

func SubmissionStatusText(s njudge.Submission) templ.Component

func Submissions added in v0.5.0

func Submissions(vm SubmissionsViewModel) templ.Component

func TaskArchive added in v0.5.0

func TaskArchive(vm TaskArchiveViewModel) templ.Component

func Tr added in v0.5.0

func Tr(ctx context.Context, key string, args ...any) string

func TrCs added in v0.5.0

Types

type Cached added in v0.5.0

type Cached struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

func NewCached added in v0.5.0

func NewCached(db *sql.DB, validFor time.Duration) *Cached

func (*Cached) Get added in v0.5.0

func (pc *Cached) Get(name string) (string, error)

type CategoryFilterOption added in v0.5.0

type CategoryFilterOption struct {
	Name     string
	Value    string
	Selected bool
}

type Empty added in v0.5.0

type Empty struct{}

func (Empty) Get added in v0.5.0

func (e Empty) Get(name string) (string, error)

type ForgotPasswordFormViewModel added in v0.5.0

type ForgotPasswordFormViewModel struct {
	Name string
	Key  string
}

type LanguageCompileCommand added in v0.6.0

type LanguageCompileCommand struct {
	Name    string
	Command string
}
type Link struct {
	Text string
	Href templ.SafeURL
}

type LoginViewModel added in v0.5.0

type LoginViewModel struct {
	GoogleAuthEnabled  bool
	ValidationMessages []string
}

type PaginationData added in v0.5.0

type PaginationData struct {
	Page      int    `query:"_page"`
	PerPage   int    `query:"_perPage"`
	SortDir   string `query:"_sortDir"`
	SortField string `query:"_sortField"`
}

func ParsePaginationData added in v0.5.0

func ParsePaginationData(c echo.Context) (*PaginationData, error)
type PaginationLink struct {
	Name     string
	Active   bool
	Disabled bool
	Url      string
}
func Links(page, perPage int, cnt int64, qu url.Values) ([]PaginationLink, error)

Links generates links for cnt elements such that every page contains perPage elements, and we are on page

func LinksWithCountLimit added in v0.5.0

func LinksWithCountLimit(page, perPage int, cnt int64, qu url.Values, pageLimit int) ([]PaginationLink, error)

LinksWithCountLimit filters links generated by Links around page in a pageLimit range

type ProblemEditViewModel added in v0.6.0

type ProblemEditViewModel struct {
	Categories []CategoryFilterOption
	Visible    bool
	Author     string
	Tags       []ProblemTag
}

type ProblemListProblem added in v0.5.0

type ProblemListProblem struct {
	Name   string
	Titles problems.Contents

	Visible  bool
	UserInfo *njudge.ProblemUserInfo

	ShowTags    bool
	Tags        []njudge.Tag
	SolverCount int

	CategoryLink Link
}

type ProblemListViewModel added in v0.5.0

type ProblemListViewModel struct {
	Name         string
	Pages        []PaginationLink
	Problems     []ProblemListProblem
	SolverSorter SortColumn

	Filtered bool

	Tags                  []njudge.Tag
	TitleFilter           string
	TagsFilter            string
	CategoryFilterOptions []CategoryFilterOption
}

type ProblemRanklistRow added in v0.5.0

type ProblemRanklistRow struct {
	SubmissionID int
	Name         string
	Text         string
	Solved       bool

	SortKey int64 //sort by (SortKey, SubmissionID)
}

type ProblemRanklistViewModel added in v0.5.0

type ProblemRanklistViewModel struct {
	ScoredProblem bool
	TimeRows      []ProblemRanklistRow
	MemRows       []ProblemRanklistRow
	SizeRows      []ProblemRanklistRow
	ScoresRows    []ProblemRanklistRow
}

type ProblemSubmitViewModel added in v0.5.0

type ProblemSubmitViewModel struct {
	Problemset string
	Name       string
	Title      string
	UserInfo   *njudge.ProblemUserInfo
	Languages  []language.Language
}

type ProblemTag added in v0.6.0

type ProblemTag struct {
	Name  string
	User  string
	Added time.Time
}

type ProblemViewModel added in v0.5.0

type ProblemViewModel struct {
	Title         string
	Problemset    string
	Name          string
	DisplayLimits bool
	TimeLimit     int
	InputFile     string
	OutputFile    string
	MemoryLimit   memory.Amount
	ShowTags      bool
	Tags          []njudge.Tag
	Author        string
	TaskTypeName  string

	CanEdit    bool
	CanAddTags bool

	LanguageCompileCommands []LanguageCompileCommand
	Languages               []language.Language
	UserInfo                *njudge.ProblemUserInfo

	Attachments problems.Attachments
	Statements  problems.Contents
	Statement   *problems.LocalizedData

	TagsToAdd []njudge.Tag
}

type ProblemsetRanklistRow added in v0.6.0

type ProblemsetRanklistRow struct {
	Place  int
	Name   string
	Points string
}

type ProblemsetRanklistViewModel added in v0.6.0

type ProblemsetRanklistViewModel struct {
	Rows  []ProblemsetRanklistRow
	Pages []PaginationLink
}

type ProfileSettingsViewModel added in v0.5.0

type ProfileSettingsViewModel struct {
	Name                templ.SafeURL
	ShowTagsForUnsolved bool
}

type ProfileSubmission added in v0.5.0

type ProfileSubmission struct {
	ID          int
	ProblemName string
}

type ProfileSubmissionsViewModel added in v0.5.0

type ProfileSubmissionsViewModel struct {
	Name                 templ.SafeURL
	SubmissionsViewModel SubmissionsViewModel
}

type ProfileViewModel added in v0.5.0

type ProfileViewModel struct {
	Name              templ.SafeURL
	GravatarHash      string
	Points            float64
	RanklistPosition  int
	SolvedProblems    []ProfileSubmission
	AttemptedProblems []ProfileSubmission
}

type RegisterViewModel added in v0.5.0

type RegisterViewModel struct {
	ValidationMessages []string

	TempName  string
	TempEmail string
}

type SortColumn added in v0.5.0

type SortColumn struct {
	Order njudge.SortDirection
	Href  string
}

type Store added in v0.5.0

type Store interface {
	Get(name string) (string, error)
}

type SubmissionViewModel added in v0.5.0

type SubmissionViewModel struct {
	CanRejudge    bool
	DisplaySource bool

	Submission njudge.Submission
}

type SubmissionsViewModel added in v0.5.0

type SubmissionsViewModel struct {
	Pages       []PaginationLink
	Submissions []njudge.Submission
}

type TaskArchiveViewModel added in v0.5.0

type TaskArchiveViewModel struct {
	Root         njudge.TaskArchiveNode
	ProblemLinks map[int]Link
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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