admin

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package admin provides templ-based views for the admin interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIKeyFormPage

func APIKeyFormPage(pc *PageContext, data APIKeyFormData) templ.Component

APIKeyFormPage renders the API key create/edit form or the generated key page.

func APIKeyRow

func APIKeyRow(pc *PageContext, key APIKeyListItem) templ.Component

APIKeyRow renders a single API key table row.

func APIKeysListPage

func APIKeysListPage(pc *PageContext, data APIKeysListData) templ.Component

APIKeysListPage renders the API keys list page.

func AdminLayout

func AdminLayout(pc *PageContext) templ.Component

AdminLayout renders the full admin page with sidebar, header, and content.

func Alert

func Alert(pc *PageContext) templ.Component

Alert renders flash messages with auto-dismiss.

func Breadcrumbs(pc *PageContext) templ.Component

Breadcrumbs renders navigation breadcrumbs with Schema.org markup.

func CacheStatsPage

func CacheStatsPage(pc *PageContext, data CacheStatsViewData) templ.Component

CacheStatsPage renders the cache statistics page.

func CategoriesListPage

func CategoriesListPage(pc *PageContext, data CategoriesListData) templ.Component

CategoriesListPage renders the categories list page.

func CategoryFormPage

func CategoryFormPage(pc *PageContext, data CategoryFormData) templ.Component

CategoryFormPage renders the category create/edit form.

func ConfigPage

func ConfigPage(pc *PageContext, data ConfigViewData) templ.Component

func DashboardPage

func DashboardPage(pc *PageContext, data DashboardData) templ.Component

DashboardPage renders the admin dashboard.

func DocsGuidePage

func DocsGuidePage(pc *PageContext, data DocsGuideViewData) templ.Component

DocsGuidePage renders a single documentation guide page.

func DocsPage

func DocsPage(pc *PageContext, data DocsViewData) templ.Component

DocsPage renders the documentation overview page.

func EventsListPage

func EventsListPage(pc *PageContext, data EventsListData) templ.Component

EventsListPage renders the events list page.

func ExportPage

func ExportPage(pc *PageContext, data ExportViewData) templ.Component

ExportPage renders the content export page.

func FormsFormPage

func FormsFormPage(pc *PageContext, data FormFormViewData) templ.Component

============================================================================= FORM PAGE (create/edit) =============================================================================

func FormsListPage

func FormsListPage(pc *PageContext, data FormsListViewData) templ.Component

============================================================================= LIST PAGE =============================================================================

func FormsSubmissionViewPage

func FormsSubmissionViewPage(pc *PageContext, data SubmissionViewViewData) templ.Component

============================================================================= SUBMISSION VIEW PAGE =============================================================================

func FormsSubmissionsPage

func FormsSubmissionsPage(pc *PageContext, data SubmissionsListViewData) templ.Component

============================================================================= SUBMISSIONS LIST PAGE =============================================================================

func Header(pc *PageContext) templ.Component

Header renders the admin top header bar.

func ImportPage

func ImportPage(pc *PageContext, data ImportViewData) templ.Component

ImportPage renders the content import page.

func LanguageFormPage

func LanguageFormPage(pc *PageContext, data LanguageFormData) templ.Component

LanguageFormPage renders the language create/edit form.

func LanguageRow

func LanguageRow(pc *PageContext, lang LanguageListItem) templ.Component

LanguageRow renders a single language table row.

func LanguagesListPage

func LanguagesListPage(pc *PageContext, data LanguagesListData) templ.Component

LanguagesListPage renders the languages list page.

func LoginPage

func LoginPage(d LoginData) templ.Component

LoginPage renders the login page.

func MediaEditPage

func MediaEditPage(pc *PageContext, data MediaEditViewData) templ.Component

============================================================================= EDIT PAGE =============================================================================

func MediaLibraryPage

func MediaLibraryPage(pc *PageContext, data MediaLibraryViewData) templ.Component

============================================================================= LIBRARY PAGE =============================================================================

func MediaUploadPage

func MediaUploadPage(pc *PageContext, data MediaUploadViewData) templ.Component

============================================================================= UPLOAD PAGE =============================================================================

func MenuFormPage(pc *PageContext, data MenuFormData) templ.Component

MenuFormPage renders the menu create/edit form.

func MenusListPage(pc *PageContext, data MenusListData) templ.Component

MenusListPage renders the menus list page.

func ModulesPage

func ModulesPage(pc *PageContext, data ModulesViewData) templ.Component

ModulesPage renders the modules list page.

func PageFormPage

func PageFormPage(pc *PageContext, data PageFormViewData) templ.Component

============================================================================= PAGE FORM PAGE =============================================================================

func PageHeader(title string, description string) templ.Component

PageHeader renders a page header with title, optional description, and optional action buttons.

func PageVersionsPage

func PageVersionsPage(pc *PageContext, data PageVersionsViewData) templ.Component

============================================================================= PAGE VERSIONS PAGE =============================================================================

func PagesListPage

func PagesListPage(pc *PageContext, data PagesListViewData) templ.Component

============================================================================= PAGES LIST PAGE =============================================================================

func Pagination

func Pagination(pc *PageContext, p PaginationData) templ.Component

Pagination renders pagination controls for admin lists.

func RedirectFormPage

func RedirectFormPage(pc *PageContext, data RedirectFormData) templ.Component

RedirectFormPage renders the redirect create/edit form.

func RedirectRow

func RedirectRow(pc *PageContext, redirect RedirectListItem) templ.Component

RedirectRow renders a single redirect table row.

func RedirectsListPage

func RedirectsListPage(pc *PageContext, data RedirectsListData) templ.Component

RedirectsListPage renders the redirects list page.

func SchedulerListPage

func SchedulerListPage(pc *PageContext, data SchedulerListViewData) templ.Component

func SchedulerTaskFormPage

func SchedulerTaskFormPage(pc *PageContext, data SchedulerTaskFormViewData) templ.Component

func SchedulerTaskRunsPage

func SchedulerTaskRunsPage(pc *PageContext, data SchedulerTaskRunsViewData) templ.Component
func Sidebar(pc *PageContext) templ.Component

Sidebar renders the admin sidebar navigation.

func TagFormPage

func TagFormPage(pc *PageContext, data TagFormData) templ.Component

TagFormPage renders the tag create/edit form.

func TagsListPage

func TagsListPage(pc *PageContext, data TagsListData) templ.Component

TagsListPage renders the tags list page.

func ThemeSettingsPage

func ThemeSettingsPage(pc *PageContext, data ThemeSettingsViewData) templ.Component

ThemeSettingsPage renders the theme settings page.

func ThemesListPage

func ThemesListPage(pc *PageContext, data ThemesListData) templ.Component

ThemesListPage renders the themes list page.

func UserFormPage

func UserFormPage(pc *PageContext, data UserFormData) templ.Component

UserFormPage renders the user create/edit form.

func UsersListPage

func UsersListPage(pc *PageContext, data UsersListData) templ.Component

UsersListPage renders the users list page.

func WebhookDeliveriesPage

func WebhookDeliveriesPage(pc *PageContext, data WebhookDeliveriesViewData) templ.Component

func WebhookFormPage

func WebhookFormPage(pc *PageContext, data WebhookFormViewData) templ.Component

func WebhooksListPage

func WebhooksListPage(pc *PageContext, data WebhooksListViewData) templ.Component

func WidgetsPage

func WidgetsPage(pc *PageContext, data WidgetsViewData) templ.Component

Types

type APIKeyFormData

type APIKeyFormData struct {
	IsEdit           bool
	APIKey           *APIKeyInfo
	PermissionGroups []PermissionGroup
	Errors           map[string]string
	FormValues       map[string]string
	GeneratedKey     string   // Only set after creation to show key once
	GeneratedPerms   []string // Permissions of the generated key
}

APIKeyFormData holds all data for the API key create/edit form.

type APIKeyInfo

type APIKeyInfo struct {
	ID          int64
	Name        string
	KeyPrefix   string
	Permissions string // Raw JSON string for checking contains
	IsActive    bool
	CreatedAt   string
	LastUsedAt  string // Empty if never used
	ExpiresAt   string // Date-only format for input field, empty if no expiration
	HasLastUsed bool
	HasExpires  bool
}

APIKeyInfo holds individual API key data for the form.

type APIKeyListItem

type APIKeyListItem struct {
	ID          int64
	Name        string
	KeyPrefix   string
	Permissions []string // Pre-parsed from JSON
	IsActive    bool
	IsExpired   bool   // Pre-computed: active but past expiration
	LastUsedAt  string // Pre-formatted date string, empty if never used
	ExpiresAt   string // Pre-formatted date string, empty if no expiration
}

APIKeyListItem holds data for a single API key in the list view.

type APIKeysListData

type APIKeysListData struct {
	APIKeys    []APIKeyListItem
	TotalKeys  int64
	Pagination PaginationData
}

APIKeysListData holds all data for the API keys list page.

type ActivityItem

type ActivityItem struct {
	Category  string
	Level     string
	Message   string
	UserName  string
	TimeAgo   string
	CreatedAt string
}

ActivityItem holds activity log data.

type Breadcrumb struct {
	Label  string
	URL    string
	Active bool
}

Breadcrumb represents a breadcrumb navigation item.

type CacheItemView

type CacheItemView struct {
	Name     string
	Kind     string // "config", "sitemap", "menu", "language", "translation", "page", "general"
	Items    int
	Hits     int64
	Misses   int64
	HitRate  float64
	CachedAt string // Pre-formatted, empty if not cached (sitemap)
	Size     int    // Size in bytes (sitemap)
}

CacheItemView holds data for an individual cache entry.

type CacheStatsView

type CacheStatsView struct {
	Hits    int64
	Misses  int64
	Items   int
	HitRate float64
}

CacheStatsView holds total cache statistics.

type CacheStatsViewData

type CacheStatsViewData struct {
	Caches      []CacheItemView
	TotalStats  CacheStatsView
	IsRedis     bool
	IsFallback  bool
	RedisURL    string
	HealthError string
	ResetAt     string // Pre-formatted reset time
}

CacheStatsViewData holds data for the cache stats page.

type CategoriesListData

type CategoriesListData struct {
	Categories []CategoryListItem
	TotalCount int64
}

CategoriesListData holds all data for the categories list page.

type CategoryFormData

type CategoryFormData struct {
	IsEdit           bool
	Category         *CategoryItem
	AllCategories    []CategoryListItem
	AllLanguages     []LanguageOption
	Language         *LanguageOption
	Translations     []CategoryTranslation
	MissingLanguages []LanguageOption
	FormValues       map[string]string
	Errors           map[string]string
}

CategoryFormData holds all data for the category create/edit form.

type CategoryItem

type CategoryItem struct {
	ID           int64
	Name         string
	Slug         string
	Description  string
	LanguageCode string
	ParentID     int64
	HasParent    bool
	Position     int
}

CategoryItem holds individual category data.

type CategoryListItem

type CategoryListItem struct {
	ID           int64
	Name         string
	Slug         string
	Description  string
	LanguageCode string
	UsageCount   int64
	Depth        int
	Children     bool
}

CategoryListItem holds data for a category in the list view.

type CategoryTranslation

type CategoryTranslation struct {
	Category CategoryItem
	Language LanguageOption
}

CategoryTranslation holds data for a category translation.

type CommonLanguageOption

type CommonLanguageOption struct {
	Code       string
	Name       string
	NativeName string
	Direction  string
}

CommonLanguageOption represents a language option for the quick-select dropdown.

type ConfigItemView

type ConfigItemView struct {
	Key         string
	Value       string
	Type        string
	Description string
	Label       string
}

ConfigItemView represents a non-translatable config item.

type ConfigTranslationValueView

type ConfigTranslationValueView struct {
	LanguageCode string
	LanguageName string
	Value        string
}

ConfigTranslationValueView holds a translation value for a specific language.

type ConfigViewData

type ConfigViewData struct {
	Items                []ConfigItemView
	TranslatableItems    []TranslatableConfigItemView
	Errors               map[string]string
	HasMultipleLanguages bool
}

ConfigViewData holds all data for the config page.

type ConflictStrategyView

type ConflictStrategyView struct {
	Value       string
	Label       string
	Description string
}

ConflictStrategyView holds a conflict strategy option.

type DashboardData

type DashboardData struct {
	Stats                  DashboardStats
	RecentSubmissions      []RecentSubmission
	WebhookHealth          []WebhookHealthItem
	RecentFailedDeliveries []RecentFailedDelivery
	TranslationCoverage    []TranslationCoverage
	RecentActivity         []ActivityItem
}

DashboardData holds the data for the dashboard page.

type DashboardStats

type DashboardStats struct {
	TotalPages          int64
	PublishedPages      int64
	DraftPages          int64
	TotalUsers          int64
	TotalMedia          int64
	TotalForms          int64
	UnreadSubmissions   int64
	ActiveLanguages     int64
	TotalWebhooks       int64
	FailedDeliveries24h int64
	CacheHitRate        float64
	CacheItems          int64
}

DashboardStats holds dashboard statistics.

type DocsEndpointGroupView

type DocsEndpointGroupView struct {
	Name      string
	Endpoints []DocsEndpointView
}

DocsEndpointGroupView groups related endpoints.

type DocsEndpointView

type DocsEndpointView struct {
	Method      string
	Path        string
	Description string
	Auth        string
}

DocsEndpointView describes a single API/route endpoint.

type DocsGuideView

type DocsGuideView struct {
	Slug  string
	Title string
}

DocsGuideView represents a documentation guide link.

type DocsGuideViewData

type DocsGuideViewData struct {
	Title   string
	Content string // Trusted HTML content from local markdown files
}

DocsGuideViewData holds data for a single guide page.

type DocsSystemInfoView

type DocsSystemInfoView struct {
	Version        string
	GitCommit      string
	BuildTime      string
	GoVersion      string
	Environment    string
	ServerPort     int
	DBPath         string
	ActiveTheme    string
	CacheType      string
	EnabledModules int
	TotalModules   int
	Uptime         string
}

DocsSystemInfoView holds system-level information for display.

type DocsViewData

type DocsViewData struct {
	System    DocsSystemInfoView
	Endpoints []DocsEndpointGroupView
	Guides    []DocsGuideView
}

DocsViewData holds all data for the docs overview page.

type EventItem

type EventItem struct {
	ID            int64
	Level         string // "info", "warning", "error"
	Category      string
	Message       string
	Details       string // Formatted metadata
	DetailsLong   bool   // True if details > 80 chars
	IPAddress     string // Masked in demo mode (for display)
	RawIPAddress  string // Unmasked (for ban button data-ip)
	IsOwnIP       bool
	IsBanned      bool // Pre-computed sentinel state
	IsWhitelisted bool // Pre-computed sentinel state
	RequestURL    string
	CreatedAt     string
	UserName      string
}

EventItem holds data for a single event row.

type EventsListData

type EventsListData struct {
	Events         []EventItem
	TotalEvents    int64
	Level          string // Current level filter
	Category       string // Current category filter
	Levels         []string
	Categories     []string
	SentinelActive bool
	Pagination     PaginationData
}

EventsListData holds all data for the events list page.

type ExportViewData

type ExportViewData struct{}

ExportViewData holds data for the export page.

type FormFieldView

type FormFieldView struct {
	ID          int64  `json:"id"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	Label       string `json:"label"`
	Placeholder string `json:"placeholder"`
	HelpText    string `json:"help_text"`
	Options     string `json:"options"`
	Validation  string `json:"validation"`
	IsRequired  bool   `json:"is_required"`
}

FormFieldView represents a form field for JSON serialization.

type FormFormViewData

type FormFormViewData struct {
	IsEdit          bool
	FormID          int64
	FormName        string
	FormSlug        string
	FormTitle       string
	FormDescription string
	SuccessMessage  string
	EmailTo         string
	IsActive        bool
	LanguageCode    string
	Fields          []FormFieldView
	FieldTypes      []string
	Errors          map[string]string
	FormValues      map[string]string
	// Language/Translation
	HasMultipleLanguages bool
	AllLanguages         []LanguageOption
	Language             *LanguageOption
	Translations         []FormTranslationInfoView
	MissingLanguages     []LanguageOption
	HcaptchaEnabled      bool
	FieldsJSON           string
	FieldTypesJSON       string
	IsDemoMode           bool
}

FormFormViewData holds data for the form create/edit page.

type FormListItemView

type FormListItemView struct {
	ID              int64
	Name            string
	Title           string
	Slug            string
	LanguageCode    string
	IsActive        bool
	SubmissionCount int64
	UnreadCount     int64
}

FormListItemView represents a form in the list.

type FormTranslationInfoView

type FormTranslationInfoView struct {
	LanguageCode string
	LanguageName string
	FormID       int64
	FormName     string
}

FormTranslationInfoView holds info about a form translation.

type FormsListViewData

type FormsListViewData struct {
	Forms []FormListItemView
}

FormsListViewData holds data for the forms list page.

type HookHandlerViewItem

type HookHandlerViewItem struct {
	Name     string
	Module   string
	Priority int
}

HookHandlerViewItem holds data for a hook handler.

type HookViewItem

type HookViewItem struct {
	Name     string
	Handlers []HookHandlerViewItem
}

HookViewItem holds data for a hook in the list view.

type ImportErrorView

type ImportErrorView struct {
	Entity  string
	ID      string
	Message string
}

ImportErrorView holds a single import error.

type ImportResultView

type ImportResultView struct {
	Success      bool
	DryRun       bool
	TotalCreated int
	TotalUpdated int
	TotalSkipped int
	Created      map[string]int
	Updated      map[string]int
	Skipped      map[string]int
	Errors       []ImportErrorView
}

ImportResultView holds the result of an import operation.

type ImportUploadedDataView

type ImportUploadedDataView struct {
	HasPages      bool
	HasCategories bool
	HasTags       bool
	HasMedia      bool
	HasMenus      bool
	HasForms      bool
	HasUsers      bool
	HasLanguages  bool
	HasConfig     bool
}

ImportUploadedDataView holds flags for what data is in the uploaded file.

type ImportViewData

type ImportViewData struct {
	ConflictStrategies []ConflictStrategyView
	ValidationResult   *ValidationResultView
	ImportResult       *ImportResultView
	UploadedData       *ImportUploadedDataView
	IsZipFile          bool
	HasMediaFiles      bool
}

ImportViewData holds data for the import page.

type LangOption

type LangOption struct {
	Code string
	Name string
}

LangOption represents a language option for the admin UI language switcher.

type LanguageFormData

type LanguageFormData struct {
	IsEdit          bool
	Language        *LanguageInfo
	CommonLanguages []CommonLanguageOption
	Errors          map[string]string
	FormValues      map[string]string
}

LanguageFormData holds all data for the language create/edit form.

type LanguageInfo

type LanguageInfo struct {
	ID         int64
	Code       string
	Name       string
	NativeName string
	Direction  string
	IsDefault  bool
	IsActive   bool
	Position   int64
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

LanguageInfo holds individual language data for the form.

type LanguageListItem

type LanguageListItem struct {
	ID         int64
	Code       string
	Name       string
	NativeName string
	Direction  string
	IsDefault  bool
	IsActive   bool
	Position   int64
}

LanguageListItem holds data for a language in the list view.

type LanguageOption

type LanguageOption struct {
	Code       string
	Name       string
	NativeName string
}

LanguageOption holds language selector option data.

type LanguagesListData

type LanguagesListData struct {
	Languages      []LanguageListItem
	TotalLanguages int64
}

LanguagesListData holds all data for the languages list page.

type LoginData

type LoginData struct {
	Title           string
	AdminLang       string
	Flash           string
	FlashType       string
	LangOptions     []LangOption
	HcaptchaEnabled bool
	HcaptchaWidget  string
}

LoginData holds data for the login page.

func (LoginData) T

func (d LoginData) T(key string, args ...any) string

T translates a key using the admin language.

type MediaEditViewData

type MediaEditViewData struct {
	Media            MediaItemView
	Variants         []MediaVariantView
	Folders          []MediaFolderView
	CurrentFolderID  int64
	HasCurrentFolder bool
	Languages        []MediaLanguageView
	Translations     map[string]MediaTranslationView
	Errors           map[string]string
	FormValues       map[string]string
}

MediaEditViewData holds data for the media edit page.

type MediaFolderView

type MediaFolderView struct {
	ID        int64
	Name      string
	HasParent bool
}

MediaFolderView represents a media folder.

type MediaItemView

type MediaItemView struct {
	ID            int64
	Filename      string
	Alt           string
	ThumbnailURL  string
	OriginalURL   string
	IsImage       bool
	TypeIcon      string // "video", "file-text", "file"
	Size          string // formatted bytes
	MimeType      string
	Width         int64
	Height        int64
	HasDimensions bool
	CreatedAt     string
	UUID          string
	FolderID      int64
	HasFolderID   bool
}

MediaItemView represents a media item with computed fields.

type MediaLanguageView

type MediaLanguageView struct {
	Code       string
	NativeName string
}

MediaLanguageView represents a language for media translations.

type MediaLibraryViewData

type MediaLibraryViewData struct {
	Media      []MediaItemView
	Folders    []MediaFolderView
	TotalCount int64
	Filter     string
	FolderID   *int64
	Search     string
	Pagination PaginationData
}

MediaLibraryViewData holds data for the media library page.

type MediaTranslationView

type MediaTranslationView struct {
	Alt     string
	Caption string
}

MediaTranslationView holds translation data for display.

type MediaUploadViewData

type MediaUploadViewData struct {
	Folders          []MediaFolderView
	MaxSize          int64
	MaxSizeFormatted string
	AllowedExt       string
	FormatsHint      string
}

MediaUploadViewData holds data for the media upload page.

type MediaVariantView

type MediaVariantView struct {
	Type      string
	TypeLabel string
	Width     int64
	Height    int64
	Size      string // formatted bytes
}

MediaVariantView represents an image variant.

type MenuFormData struct {
	IsEdit     bool
	Menu       *MenuInfo
	ItemsJSON  string // Pre-serialized JSON for Alpine.js data-items attribute
	Pages      []MenuPageItem
	Targets    []string
	Languages  []LanguageOption
	Errors     map[string]string
	FormValues map[string]string
}

MenuFormData holds all data for the menu create/edit form.

type MenuInfo struct {
	ID           int64
	Name         string
	Slug         string
	LanguageCode string
}

MenuInfo holds individual menu data for the form.

type MenuListItem struct {
	ID           int64
	Name         string
	Slug         string
	LanguageCode string
	UpdatedAt    time.Time
	IsProtected  bool // true when slug == "main" || slug == "footer"
}

MenuListItem holds data for a menu in the list view.

type MenuPageItem struct {
	ID    int64
	Title string
	Slug  string
}

MenuPageItem holds page data for the add-pages section.

type MenusListData struct {
	Menus []MenuListItem
}

MenusListData holds all data for the menus list page.

type ModuleViewItem

type ModuleViewItem struct {
	Name              string
	Version           string
	Description       string
	AdminURL          string
	Active            bool
	ShowInSidebar     bool
	HasMigrations     bool
	MigrationsApplied int
	MigrationCount    int
	MigrationsPending int
	IsEmbedded        bool
}

ModuleViewItem holds data for a module in the list view.

type ModulesViewData

type ModulesViewData struct {
	Modules []ModuleViewItem
	Hooks   []HookViewItem
}

ModulesViewData holds all data for the modules list page.

type PageCategoryNodeView

type PageCategoryNodeView struct {
	ID          int64
	Name        string
	Description string
	Depth       int
}

PageCategoryNodeView represents a category with depth for tree display.

type PageCategoryView

type PageCategoryView struct {
	Name string
}

PageCategoryView represents a category in the pages list.

type PageContext

type PageContext struct {
	Title          string
	User           UserInfo
	Flash          string
	FlashType      string
	SiteName       string
	CurrentPath    string
	AdminLang      string
	LangOptions    []LangOption
	Breadcrumbs    []Breadcrumb
	SidebarModules []SidebarModule
}

PageContext carries shared data for all admin templ views.

func (*PageContext) HasPrefix

func (pc *PageContext) HasPrefix(prefix string) bool

HasPrefix returns true if the current path starts with the given prefix.

func (*PageContext) IsActive

func (pc *PageContext) IsActive(path string) bool

IsActive returns true if the given path matches the current path.

func (*PageContext) IsAdmin

func (pc *PageContext) IsAdmin() bool

IsAdmin returns true if the user has admin role.

func (*PageContext) IsEditor

func (pc *PageContext) IsEditor() bool

IsEditor returns true if the user has at least editor role.

func (*PageContext) T

func (pc *PageContext) T(key string, args ...any) string

T translates a key using the admin language.

func (*PageContext) TDefault

func (pc *PageContext) TDefault(key string, defaultVal string) string

TDefault translates a key, falling back to defaultVal if the key is not found.

func (*PageContext) UserInitial

func (pc *PageContext) UserInitial() string

UserInitial returns the first character of the user's name for avatar.

type PageFeaturedImageView

type PageFeaturedImageView struct {
	Thumbnail string
}

PageFeaturedImageView holds featured image data for display.

type PageFormAliasView

type PageFormAliasView struct {
	ID    int64
	Alias string
}

PageFormAliasView holds alias data for the form.

type PageFormCategoryView

type PageFormCategoryView struct {
	ID int64 `json:"id"`
}

PageFormCategoryView holds category data for the form category selector.

type PageFormFeaturedImageView

type PageFormFeaturedImageView struct {
	ID        int64  `json:"id"`
	Filename  string `json:"filename"`
	Filepath  string `json:"filepath"`
	Thumbnail string `json:"thumbnail"`
	Mimetype  string `json:"mimetype"`
}

PageFormFeaturedImageView holds featured image data for the form.

type PageFormTagView

type PageFormTagView struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

PageFormTagView holds tag data for the form tag selector.

type PageFormViewData

type PageFormViewData struct {
	IsEdit        bool
	PageID        int64
	PageTitle     string
	PageSlug      string
	PageBody      string
	PageStatus    string
	PageType      string
	Statuses      []string
	PageTypes     []string
	AllCategories []PageCategoryNodeView
	Tags          []PageFormTagView
	Categories    []PageFormCategoryView
	FeaturedImage *PageFormFeaturedImageView
	Aliases       []PageFormAliasView
	Errors        map[string]string
	FormValues    map[string]string
	// Language/Translation
	HasMultipleLanguages bool
	AllLanguages         []LanguageOption
	Language             *LanguageOption
	Translations         []PageTranslationView
	MissingLanguages     []LanguageOption
	// SEO
	MetaTitle       string
	MetaDescription string
	MetaKeywords    string
	OgImageID       string
	CanonicalURL    string
	NoIndex         bool
	NoFollow        bool
	// Scheduling
	ScheduledAt    string
	HasScheduledAt bool
	ScheduledAtFmt string
	// Checkboxes
	HideFeaturedImage bool
	ExcludeFromLists  bool
	IsDemoMode        bool
}

PageFormViewData holds data for the page form page.

type PageLanguageView

type PageLanguageView struct {
	Code string
	Name string
}

PageLanguageView represents a language badge.

type PageListItemView

type PageListItemView struct {
	ID               int64
	Title            string
	Slug             string
	Status           string
	IsScheduled      bool
	ScheduledAtTitle string
	UpdatedAt        string
	FeaturedImage    *PageFeaturedImageView
	Tags             []PageTagView
	Categories       []PageCategoryView
	Language         *PageLanguageView
	IsDemoPublished  bool // true if demo mode AND status=published
}

PageListItemView represents a page in the list.

type PageTagView

type PageTagView struct {
	Name string
}

PageTagView represents a tag in the pages list.

type PageTranslationView

type PageTranslationView struct {
	Language LanguageOption
	PageID   int64
	Title    string
	Status   string
}

PageTranslationView holds translation info for the form.

type PageVersionView

type PageVersionView struct {
	ID            int64
	Title         string
	Body          string
	ChangedByName string
	CreatedAt     string
}

PageVersionView represents a version in the list.

type PageVersionsViewData

type PageVersionsViewData struct {
	PageID     int64
	PageTitle  string
	TotalCount int64
	Versions   []PageVersionView
	Pagination PaginationData
}

PageVersionsViewData holds data for the versions page.

type PagesListViewData

type PagesListViewData struct {
	Pages          []PageListItemView
	TotalCount     int64
	StatusFilter   string
	CategoryFilter int64
	LanguageFilter string
	SearchFilter   string
	AllCategories  []PageCategoryNodeView
	AllLanguages   []LanguageOption
	Statuses       []string
	Pagination     PaginationData
	IsDemoMode     bool
}

PagesListViewData holds data for the pages list page.

type PaginationData

type PaginationData struct {
	CurrentPage int
	TotalPages  int
	TotalItems  int64
	HasFirst    bool
	HasPrev     bool
	HasNext     bool
	HasLast     bool
	FirstURL    string
	PrevURL     string
	NextURL     string
	LastURL     string
	Pages       []PaginationPage
}

PaginationData holds pagination state for admin list views. This is a view-layer type to avoid circular imports with the handler package.

func (PaginationData) ShouldShow

func (p PaginationData) ShouldShow() bool

ShouldShow returns true if pagination should be displayed.

type PaginationPage

type PaginationPage struct {
	Number     int
	URL        string
	IsCurrent  bool
	IsEllipsis bool
}

PaginationPage represents a single page link.

type PermissionGroup

type PermissionGroup struct {
	TitleKey    string // i18n key for the group title
	Permissions []PermissionOption
}

PermissionGroup represents a group of related permissions.

type PermissionOption

type PermissionOption struct {
	Value   string
	DescKey string // i18n key for the description
	Checked bool
}

PermissionOption represents a single permission checkbox.

type RecentFailedDelivery

type RecentFailedDelivery struct {
	WebhookID   int64
	WebhookName string
	Event       string
	Status      string
	CreatedAt   string
}

RecentFailedDelivery holds failed delivery data.

type RecentSubmission

type RecentSubmission struct {
	ID        int64
	FormID    int64
	FormName  string
	IsRead    bool
	CreatedAt string
}

RecentSubmission holds form submission data.

type RedirectFormData

type RedirectFormData struct {
	IsEdit      bool
	Redirect    *RedirectInfo
	StatusCodes []RedirectStatusCodeOption
	TargetTypes []string
	Errors      map[string]string
	FormValues  map[string]string
}

RedirectFormData holds all data for the redirect create/edit form.

type RedirectInfo

type RedirectInfo struct {
	ID         int64
	SourcePath string
	TargetURL  string
	StatusCode int64
	IsWildcard bool
	TargetType string
	Enabled    bool
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

RedirectInfo holds individual redirect data for the form.

type RedirectListItem

type RedirectListItem struct {
	ID         int64
	SourcePath string
	TargetURL  string
	StatusCode int64
	IsWildcard bool
	TargetType string
	Enabled    bool
}

RedirectListItem holds data for a redirect in the list view.

type RedirectStatusCodeOption

type RedirectStatusCodeOption struct {
	Code  int
	Label string
}

RedirectStatusCodeOption represents a status code option for the form select.

type RedirectsListData

type RedirectsListData struct {
	Redirects  []RedirectListItem
	TotalCount int64
}

RedirectsListData holds all data for the redirects list page.

type SchedulerJobViewItem

type SchedulerJobViewItem struct {
	Source          string
	Name            string
	Description     string
	DefaultSchedule string
	Schedule        string
	IsOverridden    bool
	LastRun         string
	NextRun         string
	CanTrigger      bool
}

SchedulerJobViewItem represents a system job in the scheduler list.

type SchedulerListViewData

type SchedulerListViewData struct {
	Jobs       []SchedulerJobViewItem
	Tasks      []SchedulerTaskViewItem
	IsDemoMode bool
}

SchedulerListViewData holds all data for the scheduler list page.

type SchedulerTaskFormViewData

type SchedulerTaskFormViewData struct {
	TaskID         int64
	Name           string
	URL            string
	Schedule       string
	TimeoutSeconds int64
	IsEdit         bool
	IsDemoMode     bool
}

SchedulerTaskFormViewData holds data for the task form page.

type SchedulerTaskRunView

type SchedulerTaskRunView struct {
	Status          string
	StatusCode      int64
	HasStatusCode   bool
	DurationMs      int64
	HasDuration     bool
	StartedAt       string
	ErrorMessage    string
	HasErrorMessage bool
}

SchedulerTaskRunView represents a single task run.

type SchedulerTaskRunsViewData

type SchedulerTaskRunsViewData struct {
	TaskID       int64
	TaskName     string
	TaskURL      string
	TaskSchedule string
	TaskTimeout  int64
	TaskIsActive bool
	TotalCount   int64
	Runs         []SchedulerTaskRunView
	Pagination   PaginationData
	IsDemoMode   bool
}

SchedulerTaskRunsViewData holds data for the task runs page.

type SchedulerTaskViewItem

type SchedulerTaskViewItem struct {
	ID       int64
	Name     string
	URL      string
	Schedule string
	IsActive bool
	LastRun  string
}

SchedulerTaskViewItem represents a custom task in the scheduler list.

type SidebarModule

type SidebarModule struct {
	Name     string
	Label    string
	AdminURL string
}

SidebarModule represents a module sidebar entry.

type SubmissionFieldView

type SubmissionFieldView struct {
	Label string
	Name  string
	Type  string
	Value string
}

SubmissionFieldView represents a field in the submission view.

type SubmissionItemView

type SubmissionItemView struct {
	ID        int64
	Preview   string
	CreatedAt string
	IPAddress string
	IsRead    bool
}

SubmissionItemView represents a submission in the list.

type SubmissionViewViewData

type SubmissionViewViewData struct {
	FormID       int64
	FormName     string
	SubmissionID int64
	CreatedAt    string
	IPAddress    string
	UserAgent    string
	Fields       []SubmissionFieldView
	RawJSON      string
}

SubmissionViewViewData holds data for viewing a single submission.

type SubmissionsListViewData

type SubmissionsListViewData struct {
	FormID      int64
	FormName    string
	FormSlug    string
	TotalCount  int64
	UnreadCount int64
	Submissions []SubmissionItemView
	Pagination  PaginationData
	IsDemoMode  bool
}

SubmissionsListViewData holds data for the submissions list page.

type TagFormData

type TagFormData struct {
	IsEdit           bool
	Tag              *TagItem
	AllLanguages     []LanguageOption
	Language         *LanguageOption
	Translations     []TagTranslation
	MissingLanguages []LanguageOption
	FormValues       map[string]string
	Errors           map[string]string
}

TagFormData holds all data for the tag create/edit form.

type TagItem

type TagItem struct {
	ID           int64
	Name         string
	Slug         string
	LanguageCode string
}

TagItem holds individual tag data.

type TagListItem

type TagListItem struct {
	ID           int64
	Name         string
	Slug         string
	LanguageCode string
	UsageCount   int64
	CreatedAt    time.Time
}

TagListItem holds data for a tag in the list view.

type TagTranslation

type TagTranslation struct {
	Tag      TagItem
	Language LanguageOption
}

TagTranslation holds data for a tag translation.

type TagsListData

type TagsListData struct {
	Tags       []TagListItem
	TotalCount int64
	Pagination PaginationData
}

TagsListData holds all data for the tags list page.

type ThemeSettingView

type ThemeSettingView struct {
	Key     string
	Label   string
	Type    string
	Default string
	Options []string
	Value   string
	Error   string
}

ThemeSettingView holds data for a single theme setting in the settings form.

type ThemeSettingsViewData

type ThemeSettingsViewData struct {
	ThemeName       string
	ThemeConfigName string
	IsActive        bool
	Settings        []ThemeSettingView
	IsDemoMode      bool
}

ThemeSettingsViewData holds all data for the theme settings page.

type ThemeViewItem

type ThemeViewItem struct {
	Name              string
	ConfigName        string
	ConfigVersion     string
	ConfigAuthor      string
	ConfigDescription string
	ConfigScreenshot  string
	IsActive          bool
	IsEmbedded        bool
	HasSettings       bool
	SettingsURL       string
}

ThemeViewItem holds data for a single theme in the list view.

type ThemesListData

type ThemesListData struct {
	Themes []ThemeViewItem
}

ThemesListData holds all data for the themes list page.

type TranslatableConfigItemView

type TranslatableConfigItemView struct {
	Key          string
	Label        string
	Description  string
	Type         string
	Translations []ConfigTranslationValueView
}

TranslatableConfigItemView holds a translatable config item with translations.

type TranslationCoverage

type TranslationCoverage struct {
	LanguageCode string
	TotalPages   int64
	IsDefault    bool
}

TranslationCoverage holds translation coverage data.

type UserFormData

type UserFormData struct {
	IsEdit     bool
	User       *UserItem
	Roles      []string
	FormValues map[string]string
	Errors     map[string]string
}

UserFormData holds all data for the user create/edit form.

type UserInfo

type UserInfo struct {
	ID    int64
	Name  string
	Email string
	Role  string
}

UserInfo holds user data for the admin views.

type UserItem

type UserItem struct {
	ID    int64
	Name  string
	Email string
	Role  string
}

UserItem holds individual user data.

type UserListItem

type UserListItem struct {
	ID            int64
	Name          string
	Email         string
	Role          string
	CreatedAt     time.Time
	LastLoginAt   *time.Time
	IsCurrentUser bool
}

UserListItem holds data for a user in the list view.

type UsersListData

type UsersListData struct {
	Users      []UserListItem
	TotalCount int64
	Pagination PaginationData
}

UsersListData holds all data for the users list page.

type ValidationErrorView

type ValidationErrorView struct {
	Entity  string
	Message string
}

ValidationErrorView holds a single validation error.

type ValidationResultView

type ValidationResultView struct {
	Valid     bool
	Entities  map[string]int
	Conflicts map[string][]string
	Errors    []ValidationErrorView
}

ValidationResultView holds the result of import file validation.

type WebhookDeliveriesViewData

type WebhookDeliveriesViewData struct {
	WebhookID   int64
	WebhookName string
	Deliveries  []WebhookDeliveryView
	TotalCount  int64
	Pagination  PaginationData
}

WebhookDeliveriesViewData holds data for the deliveries page.

type WebhookDeliveryView

type WebhookDeliveryView struct {
	ID              int64
	Event           string
	Status          string
	Attempts        int64
	ResponseCode    int64
	HasResponseCode bool
	ErrorMessage    string
	HasErrorMessage bool
	Payload         string
	ResponseBody    string
	HasResponseBody bool
	CreatedAt       string
	DeliveredAt     string
	HasDeliveredAt  bool
	NextRetryAt     string
	HasNextRetryAt  bool
	UpdatedAt       string
	CanRetry        bool
}

WebhookDeliveryView represents a single delivery.

type WebhookEventInfoView

type WebhookEventInfoView struct {
	Type        string
	Description string
}

WebhookEventInfoView represents a webhook event type for the form.

type WebhookFormViewData

type WebhookFormViewData struct {
	WebhookID   int64
	IsEdit      bool
	Events      []WebhookEventInfoView
	Errors      map[string]string
	FormValues  map[string]string
	FormEvents  []string
	FormHeaders map[string]string
	CreatedAt   string
	UpdatedAt   string
}

WebhookFormViewData holds data for the webhook form page.

type WebhookHealthItem

type WebhookHealthItem struct {
	Name         string
	IsActive     bool
	HealthStatus string
	SuccessRate  float64
}

WebhookHealthItem holds webhook health data.

type WebhookListItemView

type WebhookListItemView struct {
	ID                  int64
	Name                string
	URL                 string
	Events              []string
	IsActive            bool
	TotalDelivered      int64
	TotalPending        int64
	TotalDead           int64
	SuccessRate         float64
	HealthStatus        string
	LastSuccessfulAt    string
	HasLastSuccessfulAt bool
}

WebhookListItemView represents a webhook in the list.

type WebhooksListViewData

type WebhooksListViewData struct {
	Webhooks      []WebhookListItemView
	TotalWebhooks int64
}

WebhooksListViewData holds data for the webhooks list page.

type WidgetAreaView

type WidgetAreaView struct {
	AreaID          string
	AreaName        string
	AreaDescription string
	Widgets         []WidgetItemView
}

WidgetAreaView represents a widget area with its widgets.

type WidgetItemView

type WidgetItemView struct {
	ID         int64
	WidgetType string
	Title      string
	HasTitle   bool
}

WidgetItemView represents a single widget in a widget area.

type WidgetTypeView

type WidgetTypeView struct {
	ID          string
	Name        string
	Description string
}

WidgetTypeView represents a widget type option.

type WidgetsViewData

type WidgetsViewData struct {
	ThemeName   string
	WidgetAreas []WidgetAreaView
	WidgetTypes []WidgetTypeView
}

WidgetsViewData holds all data for the widgets list page.

Jump to

Keyboard shortcuts

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