Documentation
¶
Overview ¶
Package handler implements HTTP handlers for the admin interface, including user management, page editing, configuration, and authentication.
Package handler provides HTTP handlers for the application.
Index ¶
- Constants
- Variables
- func CalculateTotalPages(totalItems, perPage int) int
- func ClampPage(page, totalPages int) int
- func FindDefaultLanguage(languages []store.Language) *store.Language
- func IsImageMime(mimeType string) bool
- func ListActiveLanguagesWithFallback(ctx context.Context, queries *store.Queries) []store.Language
- func ListAndCount[T any](listFn func() ([]T, error), countFn func() (int64, error)) ([]T, int64, error)
- func NormalizePagination(page, totalItems, perPage int) (normalizedPage, totalPages int)
- func ParseIDParam(r *http.Request) (int64, error)
- func ParseIntParam(r *http.Request, param string, defaultVal, minVal, maxVal int) int
- func ParsePageParam(r *http.Request) int
- func ParsePerPageParam(r *http.Request, defaultPerPage, maxPerPage int) int
- func ParseQueryInt64(r *http.Request, name string) int64
- func ParseURLParamInt64(r *http.Request, name string) (int64, error)
- func ValidateSlugForUpdate(slug, currentSlug string, checkExists SlugExistsFunc) string
- func ValidateSlugFormat(slug string) string
- func ValidateSlugWithChecker(slug string, checkExists SlugExistsFunc) string
- type APIKeyFormData
- type APIKeysHandler
- func (h *APIKeysHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *APIKeysHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *APIKeysHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *APIKeysHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *APIKeysHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *APIKeysHandler) Update(w http.ResponseWriter, r *http.Request)
- type APIKeysListData
- type ActivityItem
- type AddFieldRequest
- type AddItemRequest
- type AdminHandler
- type AdminPagination
- func (p AdminPagination) FirstURL() string
- func (p AdminPagination) LastURL() string
- func (p AdminPagination) NextURL() string
- func (p AdminPagination) PageRange() string
- func (p AdminPagination) PageURL(page int) string
- func (p AdminPagination) PrevURL() string
- func (p AdminPagination) ShouldShow() bool
- type AdminPaginationPage
- type AuthHandler
- type AuthorView
- type BaseTemplateData
- type CacheHandler
- type CacheStatsData
- type CategoriesListData
- type CategoryFormData
- type CategoryPageData
- type CategoryTranslationInfo
- type CategoryTreeNode
- type CategoryView
- type Check
- type ConfigFormData
- type ConfigHandler
- type ConfigItem
- type ConfigLanguage
- type ConfigTranslationValue
- type ConflictStrategyOption
- type CreateWidgetRequest
- type DashboardData
- type DashboardStats
- type DocsEndpoint
- type DocsEndpointGroup
- type DocsGuide
- type DocsGuideData
- type DocsHandler
- type DocsPageData
- type DocsSystemInfo
- type EventWithUser
- type EventsHandler
- type EventsListData
- type ExportFormData
- type FeaturedImageData
- type FooterWidget
- type FormFormData
- type FormListItem
- type FormsHandler
- func (h *FormsHandler) AddField(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) DeleteField(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) DeleteSubmission(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) ExportSubmissions(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) ReorderFields(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) SetDispatcher(d *webhook.Dispatcher)
- func (h *FormsHandler) Show(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) Submissions(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) Submit(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) Update(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) UpdateField(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) ViewSubmission(w http.ResponseWriter, r *http.Request)
- type FormsListData
- type FrontendHandler
- func (h *FrontendHandler) Blog(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Category(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Home(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) NotFound(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Page(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) PageByID(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Robots(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Search(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Security(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Sitemap(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Tag(w http.ResponseWriter, r *http.Request)
- type HealthHandler
- type HealthStatus
- type HealthStatusPublic
- type HomeData
- type HrefLangLink
- type ImportExportHandler
- func (h *ImportExportHandler) Export(w http.ResponseWriter, r *http.Request)
- func (h *ImportExportHandler) ExportForm(w http.ResponseWriter, r *http.Request)
- func (h *ImportExportHandler) Import(w http.ResponseWriter, r *http.Request)
- func (h *ImportExportHandler) ImportForm(w http.ResponseWriter, r *http.Request)
- func (h *ImportExportHandler) ImportValidate(w http.ResponseWriter, r *http.Request)
- type ImportFormData
- type LanguageFormData
- type LanguageView
- type LanguagesHandler
- func (h *LanguagesHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *LanguagesHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *LanguagesHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *LanguagesHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *LanguagesHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *LanguagesHandler) SetDefault(w http.ResponseWriter, r *http.Request)
- func (h *LanguagesHandler) Update(w http.ResponseWriter, r *http.Request)
- type LanguagesListData
- type ListData
- type MediaEditData
- type MediaHandler
- func (h *MediaHandler) API(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) CreateFolder(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) DeleteFolder(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) Library(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) MoveMedia(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) SetDispatcher(d *webhook.Dispatcher)
- func (h *MediaHandler) Update(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) UpdateFolder(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) Upload(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) UploadForm(w http.ResponseWriter, r *http.Request)
- type MediaItem
- type MediaLibraryData
- type MediaTranslationData
- type MenuFormData
- type MenuItem
- type MenuItemNode
- type MenusHandler
- func (h *MenusHandler) AddItem(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) DeleteItem(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) Reorder(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) Update(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) UpdateItem(w http.ResponseWriter, r *http.Request)
- type MenusListData
- type ModulesHandler
- type ModulesListData
- type MoveWidgetRequest
- type NotFoundData
- type PageCategoryNode
- type PageData
- type PageFormData
- type PageTranslationInfo
- type PageVersionsData
- type PageView
- type PagesHandler
- func (h *PagesHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) RestoreVersion(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) SetDispatcher(d *webhook.Dispatcher)
- func (h *PagesHandler) TogglePublish(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) Translate(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) Update(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) Versions(w http.ResponseWriter, r *http.Request)
- type PagesListData
- type Pagination
- type PaginationPage
- type PublicFormData
- type RecentFailedDelivery
- type RecentPost
- type RecentSubmission
- type ReorderFieldsRequest
- type ReorderItem
- type ReorderRequest
- type ReorderWidgetsRequest
- type SearchData
- type SiteData
- type SlugExistsChecker
- type SlugExistsFunc
- type SocialLink
- type SubcategoryView
- type SubmissionListItem
- type SubmissionViewData
- type SubmissionsListData
- type SystemInfo
- type TagFormData
- type TagPageData
- type TagTranslationInfo
- type TagView
- type TagsListData
- type TaxonomyHandler
- func (h *TaxonomyHandler) CreateCategory(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) CreateTag(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) DeleteCategory(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) DeleteTag(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) EditCategoryForm(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) EditTagForm(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) ListCategories(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) ListTags(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) NewCategoryForm(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) NewTagForm(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) SearchCategories(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) SearchTags(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) TranslateCategory(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) TranslateTag(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) UpdateCategory(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) UpdateTag(w http.ResponseWriter, r *http.Request)
- type ThemeListData
- type ThemeSettingsData
- type ThemesHandler
- type ToggleActiveRequest
- type ToggleActiveResponse
- type ToggleSidebarRequest
- type ToggleSidebarResponse
- type TranslatableConfigItem
- type TranslationCoverage
- type TranslationLink
- type UpdateFieldRequest
- type UpdateItemRequest
- type UpdateWidgetRequest
- type UploadFormData
- type UserFormData
- type UsersHandler
- func (h *UsersHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *UsersHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *UsersHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *UsersHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *UsersHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *UsersHandler) SetDispatcher(d *webhook.Dispatcher)
- func (h *UsersHandler) Update(w http.ResponseWriter, r *http.Request)
- type UsersListData
- type WebhookDeliveriesData
- type WebhookFormData
- type WebhookHealthItem
- type WebhookWithStats
- type WebhooksHandler
- func (h *WebhooksHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) Deliveries(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) RetryDelivery(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) Test(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) Update(w http.ResponseWriter, r *http.Request)
- type WebhooksListData
- type WidgetAreaWithWidgets
- type WidgetsHandler
- func (h *WidgetsHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *WidgetsHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *WidgetsHandler) GetWidget(w http.ResponseWriter, r *http.Request)
- func (h *WidgetsHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *WidgetsHandler) MoveWidget(w http.ResponseWriter, r *http.Request)
- func (h *WidgetsHandler) Reorder(w http.ResponseWriter, r *http.Request)
- func (h *WidgetsHandler) Update(w http.ResponseWriter, r *http.Request)
- type WidgetsListData
Constants ¶
const ( // RouteRoot is the root path. RouteRoot = "/" // RouteSuffixNew is the suffix for "new" routes. RouteSuffixNew = "/new" // RouteSuffixSearch is the suffix for search routes. RouteSuffixSearch = "/search" // RouteSuffixUpload is the suffix for upload routes. RouteSuffixUpload = "/upload" // RouteSuffixReorder is the suffix for reorder routes. RouteSuffixReorder = "/reorder" // RouteSuffixMove is the suffix for move routes. RouteSuffixMove = "/move" // RouteSuffixTranslate is the suffix for translation routes. RouteSuffixTranslate = "/translate/{langCode}" // RouteSuffixFolders is the suffix for folder routes. RouteSuffixFolders = "/folders" // RouteParamID is the ID parameter pattern. RouteParamID = "/{id}" // RouteParamSlug is the slug parameter pattern. RouteParamSlug = "/{slug}" // RoutePageByID is the page by ID route pattern (redirects to slug URL). RoutePageByID = "/page/{id}" // RouteTagSlug is the tag slug route pattern. RouteTagSlug = "/tag/{slug}" // RouteCategorySlug is the category slug route pattern. RouteCategorySlug = "/category/{slug}" // RouteFormsSlug is the forms slug route pattern. RouteFormsSlug = "/forms/{slug}" // RouteSubmissionsSubID is the submissions sub-ID route pattern. RouteSubmissionsSubID = "/submissions/{subId}" // RouteItemsItemID is the items item-ID route pattern. RouteItemsItemID = "/items/{itemId}" // RouteFieldsFieldID is the fields field-ID route pattern. RouteFieldsFieldID = "/fields/{fieldId}" // RouteLogin is the login route. RouteLogin = "/login" // RouteLogout is the logout route. RouteLogout = "/logout" // RouteLanguage is the public language switch route. RouteLanguage = "/language" // RouteBlog is the blog route. RouteBlog = "/blog" // RouteUsers is the users admin route. RouteUsers = "/users" // RouteLanguages is the languages admin route. RouteLanguages = "/languages" // RoutePages is the pages admin route. RoutePages = "/pages" // RouteTags is the tags admin route. RouteTags = "/tags" // RouteCategories is the categories admin route. RouteCategories = "/categories" // RouteMedia is the media admin route. RouteMedia = "/media" // RouteMenus is the menus admin route. RouteMenus = "/menus" // RouteForms is the forms admin route. RouteForms = "/forms" // RouteWidgets is the widgets admin route. RouteWidgets = "/widgets" // RouteAPIKeys is the API keys admin route. RouteAPIKeys = "/api-keys" // RouteWebhooks is the webhooks admin route. RouteWebhooks = "/webhooks" // RouteExport is the export admin route. RouteExport = "/export" // RouteImport is the import admin route. RouteImport = "/import" // RouteConfig is the config admin route. RouteConfig = "/config" // RouteDocs is the site docs admin route. RouteDocs = "/docs" // RouteDocsSlug is the site docs guide route pattern. RouteDocsSlug = RouteDocs + RouteParamSlug // RouteUsersID is the users ID route pattern. RouteUsersID = RouteUsers + RouteParamID // RouteLanguagesID is the languages ID route pattern. RouteLanguagesID = RouteLanguages + RouteParamID // RoutePagesID is the pages ID route pattern. RoutePagesID = RoutePages + RouteParamID // RouteTagsID is the tags ID route pattern. RouteTagsID = RouteTags + RouteParamID // RouteCategoriesID is the categories ID route pattern. RouteCategoriesID = RouteCategories + RouteParamID // RouteMediaID is the media ID route pattern. RouteMediaID = RouteMedia + RouteParamID // RouteMediaFoldersID is the media folders ID route pattern. RouteMediaFoldersID = RouteMedia + RouteSuffixFolders + RouteParamID // RouteMenusID is the menus ID route pattern. RouteMenusID = RouteMenus + RouteParamID // RouteFormsID is the forms ID route pattern. RouteFormsID = RouteForms + RouteParamID // RouteThemeSettings is the theme settings route pattern. RouteThemeSettings = "/themes/{name}/settings" // RouteWidgetsID is the widgets ID route pattern. RouteWidgetsID = RouteWidgets + RouteParamID // RouteAPIKeysID is the API keys ID route pattern. RouteAPIKeysID = RouteAPIKeys + RouteParamID // RouteWebhooksID is the webhooks ID route pattern. RouteWebhooksID = RouteWebhooks + RouteParamID )
Route pattern constants for chi router registration.
const ( // LogCacheManagerInit is the log message for cache manager initialization. LogCacheManagerInit = "cache manager initialized" // UploadsDirPath is the default uploads directory path. UploadsDirPath = "./uploads" // HeaderContentType is the Content-Type HTTP header name. HeaderContentType = "Content-Type" )
Utility constants used by main.go.
const ( PageStatusDraft = "draft" PageStatusPublished = "published" )
Page statuses
const ( RoleAdmin = "admin" RoleEditor = "editor" RolePublic = "public" // Public users have no admin access )
User roles
const APIKeysPerPage = 10
APIKeysPerPage is the number of API keys to display per page.
const DeliveriesPerPage = 25
DeliveriesPerPage is the number of deliveries to display per page.
const DocsDir = "./docs"
DocsDir is the default directory containing documentation files.
const EventsPerPage = 25
EventsPerPage is the number of events to display per page.
const MediaPerPage = 24
MediaPerPage is the number of media items to display per page.
const MinPasswordLength = 12
MinPasswordLength is the minimum required password length.
const PagesPerPage = 10
PagesPerPage is the number of pages to display per page.
const SessionKeyUserID = "user_id"
SessionKeyUserID is the session key for storing the authenticated user ID.
const TagsPerPage = 20
TagsPerPage is the number of tags to display per page.
const UsersPerPage = 10
UsersPerPage is the number of users to display per page.
const VersionsPerPage = 20
VersionsPerPage is the number of versions to display per page.
Variables ¶
var ValidPageStatuses = []string{PageStatusDraft, PageStatusPublished}
ValidPageStatuses contains all valid page statuses.
var ValidRoles = []string{RoleAdmin, RoleEditor, RolePublic}
ValidRoles contains all valid user roles.
var WidgetTypes = []struct { ID string Name string Description string }{ {"text", "Text/HTML", "Custom text or HTML content"}, {"recent_posts", "Recent Posts", "Display recent blog posts"}, {"categories", "Categories", "Display category list"}, {"tags", "Tags", "Display tag cloud"}, {"search", "Search", "Search form widget"}, {"custom_menu", "Custom Menu", "Display a navigation menu"}, }
WidgetTypes defines available widget types.
Functions ¶
func CalculateTotalPages ¶
CalculateTotalPages calculates the number of pages for the given total items and items per page.
func FindDefaultLanguage ¶
FindDefaultLanguage returns a pointer to the default language from a slice. Returns nil if no default language is found or the slice is empty.
func IsImageMime ¶
IsImageMime checks if the MIME type is an image.
func ListActiveLanguagesWithFallback ¶
ListActiveLanguagesWithFallback returns all active languages, or an empty slice on error. This is useful when the languages list is needed for display but not critical for the operation.
func ListAndCount ¶
func ListAndCount[T any]( listFn func() ([]T, error), countFn func() (int64, error), ) ([]T, int64, error)
ListAndCount executes list and count queries, returning combined results. This is a generic helper for paginated list endpoints.
func NormalizePagination ¶
NormalizePagination calculates total pages and clamps the current page to a valid range. Returns the normalized page number and total pages.
func ParseIDParam ¶
ParseIDParam parses the "id" URL parameter from the request as int64. Returns the parsed ID or an error if the parameter is missing or invalid.
func ParseIntParam ¶
ParseIntParam parses an integer query parameter from the request. Returns defaultVal if the parameter is missing, empty, or invalid. If minVal > 0, values below minVal return defaultVal. If maxVal > 0, values above maxVal return defaultVal.
func ParsePageParam ¶
ParsePageParam parses the "page" query parameter from the request. Returns 1 if the parameter is missing, empty, or invalid.
func ParsePerPageParam ¶
ParsePerPageParam parses the "per_page" query parameter from the request. Returns the default value if the parameter is missing, empty, or invalid. The value is clamped to the range [1, maxPerPage].
func ParseQueryInt64 ¶
ParseQueryInt64 parses a named query parameter as a positive int64. Returns 0 if the parameter is missing, empty, invalid, or not positive.
func ParseURLParamInt64 ¶
ParseURLParamInt64 parses a named URL parameter from the request as int64. Returns the parsed value or an error if the parameter is missing or invalid.
func ValidateSlugForUpdate ¶
func ValidateSlugForUpdate(slug, currentSlug string, checkExists SlugExistsFunc) string
ValidateSlugForUpdate validates a slug for update operations. Skips validation if the slug hasn't changed from the current value.
func ValidateSlugFormat ¶
ValidateSlugFormat validates only the slug format without checking existence. Use this when uniqueness checking is not required.
func ValidateSlugWithChecker ¶
func ValidateSlugWithChecker(slug string, checkExists SlugExistsFunc) string
ValidateSlugWithChecker validates a slug using a custom existence checker. Returns an error message string if validation fails, or empty string if valid.
Types ¶
type APIKeyFormData ¶
type APIKeyFormData struct {
APIKey *store.ApiKey
Permissions []string
Errors map[string]string
FormValues map[string]string
IsEdit bool
GeneratedKey string // Only set after creation to show the key once
}
APIKeyFormData holds data for the API key form template.
type APIKeysHandler ¶
type APIKeysHandler struct {
// contains filtered or unexported fields
}
APIKeysHandler handles API key management routes.
func NewAPIKeysHandler ¶
func NewAPIKeysHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *APIKeysHandler
NewAPIKeysHandler creates a new APIKeysHandler.
func (*APIKeysHandler) Create ¶
func (h *APIKeysHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/api-keys - creates a new API key.
func (*APIKeysHandler) Delete ¶
func (h *APIKeysHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/api-keys/{id} - deletes (deactivates) an API key.
func (*APIKeysHandler) EditForm ¶
func (h *APIKeysHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/api-keys/{id} - displays the edit API key form.
func (*APIKeysHandler) List ¶
func (h *APIKeysHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/api-keys - displays a paginated list of API keys.
func (*APIKeysHandler) NewForm ¶
func (h *APIKeysHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/api-keys/new - displays the new API key form.
func (*APIKeysHandler) Update ¶
func (h *APIKeysHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/api-keys/{id} - updates an existing API key.
type APIKeysListData ¶
type APIKeysListData struct {
APIKeys []store.ApiKey
TotalKeys int64
Pagination AdminPagination
}
APIKeysListData holds data for the API keys list template.
type ActivityItem ¶
type ActivityItem struct {
ID int64
Level string // info, warning, error
Category string // auth, page, user, config, system, cache
Message string
UserName string
UserEmail string
CreatedAt string
TimeAgo string
}
ActivityItem represents a recent activity event for dashboard display.
type AddFieldRequest ¶
type AddFieldRequest struct {
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"`
}
AddFieldRequest represents the JSON request for adding a form field.
type AddItemRequest ¶
type AddItemRequest struct {
Title string `json:"title"`
URL string `json:"url"`
Target string `json:"target"`
PageID *int64 `json:"page_id"`
ParentID *int64 `json:"parent_id"`
CSSClass string `json:"css_class"`
}
AddItemRequest represents the JSON request for adding a menu item.
type AdminHandler ¶
type AdminHandler struct {
// contains filtered or unexported fields
}
AdminHandler handles admin routes.
func NewAdminHandler ¶
func NewAdminHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, cacheManager *cache.Manager) *AdminHandler
NewAdminHandler creates a new AdminHandler.
func (*AdminHandler) Dashboard ¶
func (h *AdminHandler) Dashboard(w http.ResponseWriter, r *http.Request)
Dashboard renders the admin dashboard with stats and recent activity.
func (*AdminHandler) SetLanguage ¶
func (h *AdminHandler) SetLanguage(w http.ResponseWriter, r *http.Request)
SetLanguage changes the admin UI language preference. POST /admin/language
type AdminPagination ¶
type AdminPagination struct {
CurrentPage int
TotalPages int
TotalItems int64
PerPage int
HasFirst bool
HasPrev bool
HasNext bool
HasLast bool
FirstPage int
PrevPage int
NextPage int
LastPage int
Pages []AdminPaginationPage
BaseURL string
QueryString string
}
AdminPagination holds pagination data for admin templates.
func BuildAdminPagination ¶
func BuildAdminPagination(currentPage, totalItems, perPage int, baseURL string, queryParams url.Values) AdminPagination
BuildAdminPagination creates pagination data for admin templates. baseURL is the path without query string (e.g., "/admin/events") queryParams are the current query parameters to preserve (e.g., filters)
func (AdminPagination) FirstURL ¶
func (p AdminPagination) FirstURL() string
FirstURL returns the URL for the first page.
func (AdminPagination) LastURL ¶
func (p AdminPagination) LastURL() string
LastURL returns the URL for the last page.
func (AdminPagination) NextURL ¶
func (p AdminPagination) NextURL() string
NextURL returns the URL for the next page.
func (AdminPagination) PageRange ¶
func (p AdminPagination) PageRange() string
PageRange returns a description of the current page range.
func (AdminPagination) PageURL ¶
func (p AdminPagination) PageURL(page int) string
PageURL returns the URL for a specific page number.
func (AdminPagination) PrevURL ¶
func (p AdminPagination) PrevURL() string
PrevURL returns the URL for the previous page.
func (AdminPagination) ShouldShow ¶
func (p AdminPagination) ShouldShow() bool
ShouldShow returns true if pagination should be displayed (more than 1 page).
type AdminPaginationPage ¶
AdminPaginationPage represents a single page link in admin pagination.
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
AuthHandler handles authentication routes.
func NewAuthHandler ¶
func NewAuthHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, lp *middleware.LoginProtection, hr *module.HookRegistry) *AuthHandler
NewAuthHandler creates a new AuthHandler.
func (*AuthHandler) Login ¶
func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request)
Login handles the login form submission.
func (*AuthHandler) LoginForm ¶
func (h *AuthHandler) LoginForm(w http.ResponseWriter, r *http.Request)
LoginForm renders the login page. Redirects already-authenticated users: admin/editor → dashboard, others → homepage.
func (*AuthHandler) Logout ¶
func (h *AuthHandler) Logout(w http.ResponseWriter, r *http.Request)
Logout handles user logout.
func (*AuthHandler) SetLanguage ¶
func (h *AuthHandler) SetLanguage(w http.ResponseWriter, r *http.Request)
SetLanguage changes the UI language preference on the login page. POST /language
type AuthorView ¶
AuthorView represents an author for template rendering.
type BaseTemplateData ¶
type BaseTemplateData struct {
// SEO Meta
Title string
MetaDescription string
MetaKeywords string
Canonical string
FeaturedImage string
Robots string // Robots directive (index,follow / noindex,nofollow)
OGImage string // Open Graph image (absolute URL)
OGType string // Open Graph type (website, article)
JSONLD template.JS // JSON-LD structured data
// Site info
SiteName string
SiteURL string
SiteLogo string
SiteTagline string
RequestURI string
CurrentPath string
Year int
// Layout options
BodyClass string
ShowSidebar bool
// Page - set when rendering a single page (for Open Graph article type)
Page *PageView
// Site data
Site SiteData
// Theme settings - key-value pairs from theme configuration
ThemeSettings map[string]string
CustomCSS string
// Menus - MainMenu/FooterMenu for code, Navigation/FooterNav for templates
MainMenu []MenuItem
// Footer
CopyrightText string
SocialLinks []SocialLink
// Search
ShowSearch bool
SearchQuery string
// Widgets - map of widget area ID to widgets
Widgets map[string][]service.WidgetView
// Language support
CurrentLanguage *LanguageView // Current language for the request
Languages []LanguageView // All active languages
Translations []TranslationLink // Available translations for current page
HrefLangs []HrefLangLink // hreflang links for SEO
LangCode string // Current language code (shortcut)
LangDirection string // Current language direction (ltr/rtl)
LangPrefix string // URL prefix for current language (e.g., "/ru" or "" for default)
ShowLanguagePicker bool // Whether to show language picker
}
BaseTemplateData contains common fields expected by all frontend templates.
type CacheHandler ¶
type CacheHandler struct {
// contains filtered or unexported fields
}
CacheHandler handles cache management routes.
func NewCacheHandler ¶
func NewCacheHandler(renderer *render.Renderer, sm *scs.SessionManager, cm *cache.Manager, es *service.EventService) *CacheHandler
NewCacheHandler creates a new CacheHandler.
func (*CacheHandler) Clear ¶
func (h *CacheHandler) Clear(w http.ResponseWriter, r *http.Request)
Clear handles POST /admin/cache/clear - clears all caches.
func (*CacheHandler) ClearConfig ¶
func (h *CacheHandler) ClearConfig(w http.ResponseWriter, r *http.Request)
ClearConfig handles POST /admin/cache/clear/config - clears config cache.
func (*CacheHandler) ClearSitemap ¶
func (h *CacheHandler) ClearSitemap(w http.ResponseWriter, r *http.Request)
ClearSitemap handles POST /admin/cache/clear/sitemap - clears sitemap cache.
func (*CacheHandler) Stats ¶
func (h *CacheHandler) Stats(w http.ResponseWriter, r *http.Request)
Stats handles GET /admin/cache - displays cache statistics.
type CacheStatsData ¶
type CacheStatsData struct {
Caches []cache.ManagerCacheStats
TotalStats cache.Stats
Info cache.ManagerInfo
IsRedis bool
HealthError string // Non-empty if health check failed
}
CacheStatsData holds data for the cache stats template.
type CategoriesListData ¶
type CategoriesListData struct {
Categories []CategoryTreeNode
TotalCount int64
}
CategoriesListData holds data for the categories list template.
type CategoryFormData ¶
type CategoryFormData struct {
Category *store.Category
AllCategories []CategoryTreeNode // For parent selector
Errors map[string]string
FormValues map[string]string
IsEdit bool
Language *store.Language // Current category language
AllLanguages []store.Language // All active languages for selection
Translations []CategoryTranslationInfo // Existing translations
MissingLanguages []store.Language // Languages without translations
}
CategoryFormData holds data for the category form template.
type CategoryPageData ¶
type CategoryPageData struct {
BaseTemplateData
Category CategoryView
Pages []PageView
Pagination Pagination
PageCount int
Subcategories []SubcategoryView
// Sidebar data for themes that show sidebar on category pages
Categories []CategoryView
Tags []TagView
RecentPages []PageView
}
CategoryPageData holds data for category archive templates.
type CategoryTranslationInfo ¶
CategoryTranslationInfo holds information about a category translation.
type CategoryTreeNode ¶
type CategoryTreeNode struct {
Category store.Category
Children []CategoryTreeNode
Depth int
UsageCount int64
LanguageCode string
LanguageName string
}
CategoryTreeNode represents a category with its children for tree display.
type CategoryView ¶
type CategoryView struct {
ID int64
Name string
Slug string
Description string
URL string
PageCount int64
}
CategoryView represents a category for template rendering.
type Check ¶
type Check struct {
Status string `json:"status"`
Message string `json:"message,omitempty"`
Latency string `json:"latency,omitempty"`
}
Check represents a single health check result.
type ConfigFormData ¶
type ConfigFormData struct {
Items []ConfigItem // Non-translatable items
TranslatableItems []TranslatableConfigItem // Translatable items with language tabs
Languages []ConfigLanguage // Available languages for translation
Errors map[string]string
HasMultipleLanguages bool
}
ConfigFormData holds data for the config form template.
type ConfigHandler ¶
type ConfigHandler struct {
// contains filtered or unexported fields
}
ConfigHandler handles configuration management routes.
func NewConfigHandler ¶
func NewConfigHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, cm *cache.Manager) *ConfigHandler
NewConfigHandler creates a new ConfigHandler.
func (*ConfigHandler) List ¶
func (h *ConfigHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/config - displays configuration settings.
func (*ConfigHandler) Update ¶
func (h *ConfigHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/config - updates configuration values.
type ConfigItem ¶
type ConfigItem struct {
Key string
Value string
Type string
Description string
Label string
Translatable bool
}
ConfigItem represents a config item with display metadata.
type ConfigLanguage ¶
ConfigLanguage represents a language option for the config form.
type ConfigTranslationValue ¶
type ConfigTranslationValue struct {
LanguageID int64
LanguageCode string
LanguageName string
Value string
}
ConfigTranslationValue holds a translation value for a specific language.
type ConflictStrategyOption ¶
ConflictStrategyOption represents a conflict strategy for the dropdown.
type CreateWidgetRequest ¶
type CreateWidgetRequest struct {
Theme string `json:"theme"`
Area string `json:"area"`
WidgetType string `json:"widget_type"`
Title string `json:"title"`
Content string `json:"content"`
Settings string `json:"settings"`
}
CreateWidgetRequest represents the JSON request for creating a widget.
type DashboardData ¶
type DashboardData struct {
Stats DashboardStats
RecentSubmissions []RecentSubmission
WebhookHealth []WebhookHealthItem
RecentFailedDeliveries []RecentFailedDelivery
TranslationCoverage []TranslationCoverage
RecentActivity []ActivityItem
}
DashboardData holds all dashboard data including stats and recent items.
type DashboardStats ¶
type DashboardStats struct {
TotalPages int64
PublishedPages int64
DraftPages int64
TotalUsers int64
TotalMedia int64
TotalForms int64
UnreadSubmissions int64
// Webhook stats
TotalWebhooks int64
ActiveWebhooks int64
FailedDeliveries24h int64
// Phase 4 additions
TotalLanguages int64
ActiveLanguages int64
CacheHitRate float64
CacheHits int64
CacheMisses int64
CacheItems int
CacheBackendType string // "memory" or "redis"
}
DashboardStats holds the statistics displayed on the dashboard.
type DocsEndpoint ¶
DocsEndpoint describes a single API/route endpoint.
type DocsEndpointGroup ¶
type DocsEndpointGroup struct {
Name string
Endpoints []DocsEndpoint
}
DocsEndpointGroup groups related endpoints.
type DocsGuideData ¶
DocsGuideData holds data for the guide viewer page.
type DocsHandler ¶
type DocsHandler struct {
// contains filtered or unexported fields
}
DocsHandler handles the site documentation admin page.
func NewDocsHandler ¶
func NewDocsHandler(renderer *render.Renderer, cfg *config.Config, registry *module.Registry, startTime time.Time, versionInfo *version.Info) *DocsHandler
NewDocsHandler creates a new DocsHandler.
func (*DocsHandler) Guide ¶
func (h *DocsHandler) Guide(w http.ResponseWriter, r *http.Request)
Guide handles GET /admin/docs/{slug} - displays a specific documentation guide.
func (*DocsHandler) Overview ¶
func (h *DocsHandler) Overview(w http.ResponseWriter, r *http.Request)
Overview handles GET /admin/docs - displays the site documentation overview.
type DocsPageData ¶
type DocsPageData struct {
System DocsSystemInfo
Endpoints []DocsEndpointGroup
Guides []DocsGuide
}
DocsPageData holds data for the site docs overview page.
type DocsSystemInfo ¶
type DocsSystemInfo 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
}
DocsSystemInfo contains system-level information for display.
type EventWithUser ¶
type EventWithUser struct {
ID int64
Level string
Category string
Message string
Metadata string
Details string // Formatted metadata as readable text
DetailsLong bool // True if details exceed display threshold
CreatedAt string
UserName string
UserEmail string
}
EventWithUser represents an event with associated user info.
type EventsHandler ¶
type EventsHandler struct {
// contains filtered or unexported fields
}
EventsHandler handles event log viewing routes.
func NewEventsHandler ¶
func NewEventsHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *EventsHandler
NewEventsHandler creates a new EventsHandler.
func (*EventsHandler) List ¶
func (h *EventsHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/events - displays a paginated list of events.
type EventsListData ¶
type EventsListData struct {
Events []EventWithUser
TotalEvents int64
Level string
Category string
Levels []string
Categories []string
Pagination AdminPagination
}
EventsListData holds data for the events list template.
type ExportFormData ¶
type ExportFormData struct {
PageStatuses []string
}
ExportFormData holds data for the export form template.
type FeaturedImageData ¶
type FeaturedImageData struct {
ID int64
Filename string
Filepath string
Thumbnail string
Mimetype string
}
FeaturedImageData holds featured image data for the template.
type FooterWidget ¶
type FooterWidget struct {
}
FooterWidget represents a widget in the footer area.
type FormFormData ¶
type FormFormData struct {
Form *store.Form
Fields []store.FormField
FieldTypes []string
Errors map[string]string
FormValues map[string]string
IsEdit bool
}
FormFormData holds data for the form create/edit template.
type FormListItem ¶
FormListItem represents a form with submission counts.
type FormsHandler ¶
type FormsHandler struct {
// contains filtered or unexported fields
}
FormsHandler handles form management routes.
func NewFormsHandler ¶
func NewFormsHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *FormsHandler
NewFormsHandler creates a new FormsHandler.
func (*FormsHandler) AddField ¶
func (h *FormsHandler) AddField(w http.ResponseWriter, r *http.Request)
AddField handles POST /admin/forms/{id}/fields - adds a form field.
func (*FormsHandler) Create ¶
func (h *FormsHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/forms - creates a new form.
func (*FormsHandler) Delete ¶
func (h *FormsHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/forms/{id} - deletes a form.
func (*FormsHandler) DeleteField ¶
func (h *FormsHandler) DeleteField(w http.ResponseWriter, r *http.Request)
DeleteField handles DELETE /admin/forms/{id}/fields/{fieldId} - deletes a form field.
func (*FormsHandler) DeleteSubmission ¶
func (h *FormsHandler) DeleteSubmission(w http.ResponseWriter, r *http.Request)
DeleteSubmission handles DELETE /admin/forms/{id}/submissions/{subId} - deletes a submission.
func (*FormsHandler) EditForm ¶
func (h *FormsHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/forms/{id} - displays the form builder.
func (*FormsHandler) ExportSubmissions ¶
func (h *FormsHandler) ExportSubmissions(w http.ResponseWriter, r *http.Request)
ExportSubmissions handles POST /admin/forms/{id}/submissions/export - exports submissions as CSV.
func (*FormsHandler) List ¶
func (h *FormsHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/forms - displays a list of forms.
func (*FormsHandler) NewForm ¶
func (h *FormsHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/forms/new - displays the new form form.
func (*FormsHandler) ReorderFields ¶
func (h *FormsHandler) ReorderFields(w http.ResponseWriter, r *http.Request)
ReorderFields handles POST /admin/forms/{id}/fields/reorder - reorders form fields.
func (*FormsHandler) SetDispatcher ¶
func (h *FormsHandler) SetDispatcher(d *webhook.Dispatcher)
SetDispatcher sets the webhook dispatcher for event dispatching.
func (*FormsHandler) Show ¶
func (h *FormsHandler) Show(w http.ResponseWriter, r *http.Request)
Show handles GET /forms/{slug} - displays a public form.
func (*FormsHandler) Submissions ¶
func (h *FormsHandler) Submissions(w http.ResponseWriter, r *http.Request)
Submissions handles GET /admin/forms/{id}/submissions - lists form submissions.
func (*FormsHandler) Submit ¶
func (h *FormsHandler) Submit(w http.ResponseWriter, r *http.Request)
Submit handles POST /forms/{slug} - processes form submission.
func (*FormsHandler) Update ¶
func (h *FormsHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/forms/{id} - updates a form.
func (*FormsHandler) UpdateField ¶
func (h *FormsHandler) UpdateField(w http.ResponseWriter, r *http.Request)
UpdateField handles PUT /admin/forms/{id}/fields/{fieldId} - updates a form field.
func (*FormsHandler) ViewSubmission ¶
func (h *FormsHandler) ViewSubmission(w http.ResponseWriter, r *http.Request)
ViewSubmission handles GET /admin/forms/{id}/submissions/{subId} - views a submission.
type FormsListData ¶
type FormsListData struct {
Forms []FormListItem
}
FormsListData holds data for the forms list template.
type FrontendHandler ¶
type FrontendHandler struct {
// contains filtered or unexported fields
}
FrontendHandler handles public frontend routes.
func NewFrontendHandler ¶
func NewFrontendHandler(db *sql.DB, themeManager *theme.Manager, cacheManager *cache.Manager, logger *slog.Logger, menuService *service.MenuService) *FrontendHandler
NewFrontendHandler creates a new FrontendHandler. If menuService is nil, a new one will be created. Pass a shared menuService for cache consistency.
func (*FrontendHandler) Blog ¶
func (h *FrontendHandler) Blog(w http.ResponseWriter, r *http.Request)
Blog handles the blog listing page displaying all published posts.
func (*FrontendHandler) Category ¶
func (h *FrontendHandler) Category(w http.ResponseWriter, r *http.Request)
Category handles category archive display.
func (*FrontendHandler) Home ¶
func (h *FrontendHandler) Home(w http.ResponseWriter, r *http.Request)
Home handles the homepage.
func (*FrontendHandler) NotFound ¶
func (h *FrontendHandler) NotFound(w http.ResponseWriter, r *http.Request)
NotFound renders the 404 page.
func (*FrontendHandler) Page ¶
func (h *FrontendHandler) Page(w http.ResponseWriter, r *http.Request)
Page handles single page display.
func (*FrontendHandler) PageByID ¶
func (h *FrontendHandler) PageByID(w http.ResponseWriter, r *http.Request)
PageByID handles /page/{id} - redirects to the canonical slug URL. This provides a permanent, stable URL that won't break if the page slug changes.
func (*FrontendHandler) Robots ¶
func (h *FrontendHandler) Robots(w http.ResponseWriter, r *http.Request)
Robots generates and serves the robots.txt file.
func (*FrontendHandler) Search ¶
func (h *FrontendHandler) Search(w http.ResponseWriter, r *http.Request)
Search handles search results display using FTS5 full-text search.
func (*FrontendHandler) Security ¶
func (h *FrontendHandler) Security(w http.ResponseWriter, r *http.Request)
Security generates and serves the security.txt file (RFC 9116).
func (*FrontendHandler) Sitemap ¶
func (h *FrontendHandler) Sitemap(w http.ResponseWriter, r *http.Request)
Sitemap generates and serves the sitemap.xml file.
func (*FrontendHandler) Tag ¶
func (h *FrontendHandler) Tag(w http.ResponseWriter, r *http.Request)
Tag handles tag archive display.
type HealthHandler ¶
type HealthHandler struct {
// contains filtered or unexported fields
}
HealthHandler handles health check requests.
func NewHealthHandler ¶
func NewHealthHandler(db *sql.DB, sm *scs.SessionManager, uploadsDir string) *HealthHandler
NewHealthHandler creates a new health handler.
func (*HealthHandler) Health ¶
func (h *HealthHandler) Health(w http.ResponseWriter, r *http.Request)
Health handles GET /health requests. Returns minimal status for unauthenticated callers, full details for authenticated ones.
func (*HealthHandler) Liveness ¶
func (h *HealthHandler) Liveness(w http.ResponseWriter, _ *http.Request)
Liveness handles GET /health/live - simple liveness check.
func (*HealthHandler) Readiness ¶
func (h *HealthHandler) Readiness(w http.ResponseWriter, r *http.Request)
Readiness handles GET /health/ready - checks if the service is ready to accept traffic.
func (*HealthHandler) StartTime ¶
func (h *HealthHandler) StartTime() time.Time
StartTime returns when the handler (and application) was started.
type HealthStatus ¶
type HealthStatus struct {
Status string `json:"status"`
Timestamp time.Time `json:"timestamp"`
Uptime string `json:"uptime"`
Version string `json:"version"`
Checks map[string]Check `json:"checks"`
System *SystemInfo `json:"system,omitempty"`
}
HealthStatus represents the overall health status (authenticated callers only).
type HealthStatusPublic ¶
type HealthStatusPublic struct {
Status string `json:"status"`
}
HealthStatusPublic is the minimal health response for unauthenticated callers.
type HomeData ¶
type HomeData struct {
BaseTemplateData
Page *PageView
FeaturedPages []PageView
RecentPages []PageView
Categories []CategoryView
Tags []TagView
RecentPosts []RecentPost // For sidebar widget
HeroEnabled bool
HeroTitle string
HeroSubtitle string
HeroCTA string
HeroCTAURL string
HeroImage string
ShowAllPostsLink bool
}
HomeData holds data for the homepage template.
type HrefLangLink ¶
type HrefLangLink struct {
Lang string // Language code (e.g., "en", "ru", "x-default")
Href string // Full URL
}
HrefLangLink represents an hreflang link for SEO.
type ImportExportHandler ¶
type ImportExportHandler struct {
// contains filtered or unexported fields
}
ImportExportHandler handles import/export routes.
func NewImportExportHandler ¶
func NewImportExportHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *ImportExportHandler
NewImportExportHandler creates a new ImportExportHandler.
func (*ImportExportHandler) Export ¶
func (h *ImportExportHandler) Export(w http.ResponseWriter, r *http.Request)
Export handles POST /admin/export - generates and downloads the export.
func (*ImportExportHandler) ExportForm ¶
func (h *ImportExportHandler) ExportForm(w http.ResponseWriter, r *http.Request)
ExportForm handles GET /admin/export - displays the export form.
func (*ImportExportHandler) Import ¶
func (h *ImportExportHandler) Import(w http.ResponseWriter, r *http.Request)
Import handles POST /admin/import - performs the actual import.
func (*ImportExportHandler) ImportForm ¶
func (h *ImportExportHandler) ImportForm(w http.ResponseWriter, r *http.Request)
ImportForm handles GET /admin/import - displays the import form.
func (*ImportExportHandler) ImportValidate ¶
func (h *ImportExportHandler) ImportValidate(w http.ResponseWriter, r *http.Request)
ImportValidate handles POST /admin/import/validate - validates the uploaded file.
type ImportFormData ¶
type ImportFormData struct {
ConflictStrategies []ConflictStrategyOption
ValidationResult *transfer.ValidationResult
ImportResult *transfer.ImportResult
UploadedData *transfer.ExportData
IsZipFile bool // Whether the uploaded file is a zip archive
HasMediaFiles bool // Whether the zip contains media files
}
ImportFormData holds data for the import form template.
type LanguageFormData ¶
type LanguageFormData struct {
Language *store.Language
CommonLanguages []struct {
Code string
Name string
NativeName string
Direction string
}
Errors map[string]string
FormValues map[string]string
IsEdit bool
}
LanguageFormData holds data for the language form template.
type LanguageView ¶
type LanguageView struct {
ID int64
Code string
Name string
NativeName string
Direction string
IsDefault bool
IsCurrent bool
}
LanguageView represents a language for template rendering.
type LanguagesHandler ¶
type LanguagesHandler struct {
// contains filtered or unexported fields
}
LanguagesHandler handles language management in admin.
func NewLanguagesHandler ¶
func NewLanguagesHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *LanguagesHandler
NewLanguagesHandler creates a new LanguagesHandler.
func (*LanguagesHandler) Create ¶
func (h *LanguagesHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles creating a new language.
func (*LanguagesHandler) Delete ¶
func (h *LanguagesHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles deleting a language.
func (*LanguagesHandler) EditForm ¶
func (h *LanguagesHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm displays the form to edit an existing language.
func (*LanguagesHandler) List ¶
func (h *LanguagesHandler) List(w http.ResponseWriter, r *http.Request)
List displays all languages.
func (*LanguagesHandler) NewForm ¶
func (h *LanguagesHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm displays the form to create a new language.
func (*LanguagesHandler) SetDefault ¶
func (h *LanguagesHandler) SetDefault(w http.ResponseWriter, r *http.Request)
SetDefault handles setting a language as the default.
func (*LanguagesHandler) Update ¶
func (h *LanguagesHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles updating an existing language.
type LanguagesListData ¶
LanguagesListData holds data for the languages list template.
type ListData ¶
type ListData struct {
BaseTemplateData
Pages []PageView
Pagination Pagination
Description string // Optional description for list pages (blog, archives, etc.)
// Sidebar data for themes that show sidebar on list pages
Categories []CategoryView
Tags []TagView
RecentPages []PageView
}
ListData holds data for list templates (blog, archives).
type MediaEditData ¶
type MediaEditData struct {
Media MediaItem
Variants []store.MediaVariant
Folders []store.MediaFolder
Languages []store.Language // All active languages (except default)
Translations map[string]MediaTranslationData // Keyed by language code
Errors map[string]string
FormValues map[string]string
}
MediaEditData holds data for the media edit template.
type MediaHandler ¶
type MediaHandler struct {
// contains filtered or unexported fields
}
MediaHandler handles media library routes.
func NewMediaHandler ¶
func NewMediaHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, uploadDir string) *MediaHandler
NewMediaHandler creates a new MediaHandler.
func (*MediaHandler) API ¶
func (h *MediaHandler) API(w http.ResponseWriter, r *http.Request)
API handles GET /admin/media/api - returns media items as JSON for the media picker.
func (*MediaHandler) CreateFolder ¶
func (h *MediaHandler) CreateFolder(w http.ResponseWriter, r *http.Request)
CreateFolder handles POST /admin/media/folders - creates a new folder.
func (*MediaHandler) Delete ¶
func (h *MediaHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/media/{id} - deletes media and files.
func (*MediaHandler) DeleteFolder ¶
func (h *MediaHandler) DeleteFolder(w http.ResponseWriter, r *http.Request)
DeleteFolder handles DELETE /admin/media/folders/{id} - deletes a folder.
func (*MediaHandler) EditForm ¶
func (h *MediaHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/media/{id} - displays the edit form.
func (*MediaHandler) Library ¶
func (h *MediaHandler) Library(w http.ResponseWriter, r *http.Request)
Library handles GET /admin/media - displays the media library.
func (*MediaHandler) MoveMedia ¶
func (h *MediaHandler) MoveMedia(w http.ResponseWriter, r *http.Request)
MoveMedia handles POST /admin/media/{id}/move - moves media to a different folder.
func (*MediaHandler) SetDispatcher ¶
func (h *MediaHandler) SetDispatcher(d *webhook.Dispatcher)
SetDispatcher sets the webhook dispatcher for event dispatching.
func (*MediaHandler) Update ¶
func (h *MediaHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/media/{id} - updates media metadata.
func (*MediaHandler) UpdateFolder ¶
func (h *MediaHandler) UpdateFolder(w http.ResponseWriter, r *http.Request)
UpdateFolder handles PUT /admin/media/folders/{id} - renames or moves a folder.
func (*MediaHandler) Upload ¶
func (h *MediaHandler) Upload(w http.ResponseWriter, r *http.Request)
Upload handles POST /admin/media/upload - processes file upload.
func (*MediaHandler) UploadForm ¶
func (h *MediaHandler) UploadForm(w http.ResponseWriter, r *http.Request)
UploadForm handles GET /admin/media/upload - displays the upload form.
type MediaItem ¶
type MediaItem struct {
store.Medium
ThumbnailURL string
OriginalURL string
IsImage bool
TypeIcon string
}
MediaItem represents a media item with additional computed fields.
type MediaLibraryData ¶
type MediaLibraryData struct {
Media []MediaItem
Folders []store.MediaFolder
TotalCount int64
Filter string // images, documents, videos, all
FolderID *int64
Search string
Pagination AdminPagination
}
MediaLibraryData holds data for the media library template.
type MediaTranslationData ¶
type MediaTranslationData struct {
LanguageID int64
LanguageCode string
LanguageName string
NativeName string
Alt string
Caption string
}
MediaTranslationData holds translation data for a language.
type MenuFormData ¶
type MenuFormData struct {
Menu *store.Menu
Items []MenuItemNode
Pages []store.Page // Available pages to add
Targets []string
Languages []store.Language
Errors map[string]string
FormValues map[string]string
IsEdit bool
}
MenuFormData holds data for the menu builder template.
type MenuItemNode ¶
type MenuItemNode struct {
Item store.MenuItem
Children []MenuItemNode
PageSlug string // If linked to a page
}
MenuItemNode represents a menu item with children for tree display.
func (MenuItemNode) MarshalJSON ¶
func (n MenuItemNode) MarshalJSON() ([]byte, error)
MarshalJSON implements custom JSON marshaling for MenuItemNode.
type MenusHandler ¶
type MenusHandler struct {
// contains filtered or unexported fields
}
MenusHandler handles menu management routes.
func NewMenusHandler ¶
func NewMenusHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *MenusHandler
NewMenusHandler creates a new MenusHandler.
func (*MenusHandler) AddItem ¶
func (h *MenusHandler) AddItem(w http.ResponseWriter, r *http.Request)
AddItem handles POST /admin/menus/{id}/items - adds a menu item.
func (*MenusHandler) Create ¶
func (h *MenusHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/menus - creates a new menu.
func (*MenusHandler) Delete ¶
func (h *MenusHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/menus/{id} - deletes a menu.
func (*MenusHandler) DeleteItem ¶
func (h *MenusHandler) DeleteItem(w http.ResponseWriter, r *http.Request)
DeleteItem handles DELETE /admin/menus/{id}/items/{itemId} - deletes a menu item.
func (*MenusHandler) EditForm ¶
func (h *MenusHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/menus/{id} - displays the menu builder.
func (*MenusHandler) List ¶
func (h *MenusHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/menus - displays a list of menus.
func (*MenusHandler) NewForm ¶
func (h *MenusHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/menus/new - displays the new menu form.
func (*MenusHandler) Reorder ¶
func (h *MenusHandler) Reorder(w http.ResponseWriter, r *http.Request)
Reorder handles POST /admin/menus/{id}/reorder - reorders menu items.
func (*MenusHandler) Update ¶
func (h *MenusHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/menus/{id} - updates a menu.
func (*MenusHandler) UpdateItem ¶
func (h *MenusHandler) UpdateItem(w http.ResponseWriter, r *http.Request)
UpdateItem handles PUT /admin/menus/{id}/items/{itemId} - updates a menu item.
type MenusListData ¶
MenusListData holds data for the menus list template.
type ModulesHandler ¶
type ModulesHandler struct {
// contains filtered or unexported fields
}
ModulesHandler handles module management routes.
func NewModulesHandler ¶
func NewModulesHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, registry *module.Registry, hooks *module.HookRegistry) *ModulesHandler
NewModulesHandler creates a new ModulesHandler.
func (*ModulesHandler) List ¶
func (h *ModulesHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/modules - displays registered modules.
func (*ModulesHandler) ToggleActive ¶
func (h *ModulesHandler) ToggleActive(w http.ResponseWriter, r *http.Request)
ToggleActive handles POST /admin/modules/{name}/toggle - toggles module active status.
func (*ModulesHandler) ToggleSidebar ¶
func (h *ModulesHandler) ToggleSidebar(w http.ResponseWriter, r *http.Request)
ToggleSidebar handles POST /admin/modules/{name}/toggle-sidebar - toggles module sidebar visibility.
type ModulesListData ¶
ModulesListData holds data for the modules list template.
type MoveWidgetRequest ¶
type MoveWidgetRequest struct {
Area string `json:"area"`
}
MoveWidgetRequest represents the JSON request for moving a widget to a different area.
type NotFoundData ¶
type NotFoundData struct {
BaseTemplateData
SuggestedPages []PageView
}
NotFoundData holds data for 404 templates.
type PageCategoryNode ¶
PageCategoryNode represents a category with depth for tree display.
type PageData ¶
type PageData struct {
BaseTemplateData
Page *PageView
RelatedPages []PageView
ShowAuthorBox bool
// Sidebar data for themes that show sidebar on single pages
Categories []CategoryView
Tags []TagView
RecentPages []PageView
}
PageData holds data for single page templates.
type PageFormData ¶
type PageFormData struct {
Page *store.Page
Tags []store.Tag
Categories []store.Category // Selected categories for the page
AllCategories []PageCategoryNode // All categories for selection (with tree structure)
FeaturedImage *FeaturedImageData
Aliases []store.PageAlias // URL aliases for the page
Statuses []string
Errors map[string]string
FormValues map[string]string
IsEdit bool
// Language and translation support
Language *store.Language // Current page language
AllLanguages []store.Language // All active languages for selection
Translations []PageTranslationInfo // Existing translations
MissingLanguages []store.Language // Languages without translations
}
PageFormData holds data for the page form template.
type PageTranslationInfo ¶
PageTranslationInfo holds information about a page translation.
type PageVersionsData ¶
type PageVersionsData struct {
Page store.Page
Versions []store.ListPageVersionsWithUserRow
TotalCount int64
Pagination AdminPagination
}
PageVersionsData holds data for the page versions template.
type PageView ¶
type PageView struct {
ID int64
Title string
Slug string
Body template.HTML
Excerpt string
URL string
Status string
Type string // "page", "post", etc.
PublishedAt *time.Time
PublishedAtFormatted string
CreatedAt time.Time
UpdatedAt time.Time
FeaturedImage string
FeaturedImageMedium string // Medium variant for mobile grid views
FeaturedImageLarge string // Large variant for single page views
FeaturedImageID int64 // Media ID for translation lookup
FeaturedImageAlt string // Alt text (default language)
HideFeaturedImage bool // Show image below title instead of hero banner
ReadingTime int // Estimated reading time in minutes
Highlight string // Search result highlight
Author *AuthorView
Category *CategoryView
Categories []CategoryView
Tags []TagView
// SEO fields
MetaTitle string
MetaDescription string
MetaKeywords string
OGImage string
NoIndex bool
NoFollow bool
CanonicalURL string
}
PageView represents a page with computed fields for template rendering.
type PagesHandler ¶
type PagesHandler struct {
// contains filtered or unexported fields
}
PagesHandler handles page management routes.
func NewPagesHandler ¶
func NewPagesHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *PagesHandler
NewPagesHandler creates a new PagesHandler.
func (*PagesHandler) Create ¶
func (h *PagesHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/pages - creates a new page.
func (*PagesHandler) Delete ¶
func (h *PagesHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/pages/{id} - deletes a page.
func (*PagesHandler) EditForm ¶
func (h *PagesHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/pages/{id} - displays the edit page form.
func (*PagesHandler) List ¶
func (h *PagesHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/pages - displays a paginated list of pages.
func (*PagesHandler) NewForm ¶
func (h *PagesHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/pages/new - displays the new page form.
func (*PagesHandler) RestoreVersion ¶
func (h *PagesHandler) RestoreVersion(w http.ResponseWriter, r *http.Request)
RestoreVersion handles POST /admin/pages/{id}/versions/{versionId}/restore - restores a version.
func (*PagesHandler) SetDispatcher ¶
func (h *PagesHandler) SetDispatcher(d *webhook.Dispatcher)
SetDispatcher sets the webhook dispatcher for event dispatching.
func (*PagesHandler) TogglePublish ¶
func (h *PagesHandler) TogglePublish(w http.ResponseWriter, r *http.Request)
TogglePublish handles POST /admin/pages/{id}/publish - toggles publish status.
func (*PagesHandler) Translate ¶
func (h *PagesHandler) Translate(w http.ResponseWriter, r *http.Request)
Translate handles POST /admin/pages/{id}/translate/{langCode} - creates a translation.
func (*PagesHandler) Update ¶
func (h *PagesHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/pages/{id} - updates an existing page.
func (*PagesHandler) Versions ¶
func (h *PagesHandler) Versions(w http.ResponseWriter, r *http.Request)
Versions handles GET /admin/pages/{id}/versions - displays version history.
type PagesListData ¶
type PagesListData struct {
Pages []store.Page
PageTags map[int64][]store.Tag // Map of page ID to tags
PageCategories map[int64][]store.Category // Map of page ID to categories
PageFeaturedImages map[int64]*FeaturedImageData // Map of page ID to featured image
PageLanguages map[int64]*store.Language // Map of page ID to language
TotalCount int64
StatusFilter string
CategoryFilter int64
LanguageFilter string // Language code filter
SearchFilter string // Search query filter
AllCategories []PageCategoryNode // For category filter dropdown
AllLanguages []store.Language // All active languages for filter dropdown
Statuses []string
Pagination AdminPagination
}
PagesListData holds data for the pages list template.
type Pagination ¶
type Pagination struct {
CurrentPage int
TotalPages int
TotalItems int64
PerPage int
HasPrev bool
HasNext bool
HasFirst bool
HasLast bool
PrevURL string
NextURL string
FirstURL string
LastURL string
Pages []PaginationPage
}
Pagination holds pagination data for templates.
type PaginationPage ¶
PaginationPage represents a single page link in pagination.
type PublicFormData ¶
type PublicFormData struct {
Form store.Form
Fields []store.FormField
Errors map[string]string
Values map[string]string
Success bool
CSRFToken string
SiteName string
}
PublicFormData holds data for the public form template.
type RecentFailedDelivery ¶
type RecentFailedDelivery struct {
ID int64
WebhookID int64
WebhookName string
Event string
Status string
CreatedAt string
}
RecentFailedDelivery represents a recent failed webhook delivery.
type RecentPost ¶
RecentPost holds minimal data for sidebar recent posts widget.
type RecentSubmission ¶
type RecentSubmission struct {
ID int64
FormID int64
FormName string
FormSlug string
IsRead bool
CreatedAt string
}
RecentSubmission represents a recent form submission for dashboard display.
type ReorderFieldsRequest ¶
type ReorderFieldsRequest struct {
FieldIDs []int64 `json:"field_ids"`
}
ReorderFieldsRequest represents the JSON request for reordering form fields.
type ReorderItem ¶
type ReorderItem struct {
ID int64 `json:"id"`
ParentID *int64 `json:"parent_id"`
Children []ReorderItem `json:"children"`
}
ReorderItem represents an item in the reorder request.
type ReorderRequest ¶
type ReorderRequest struct {
Items []ReorderItem `json:"items"`
}
ReorderRequest represents the JSON request for reordering menu items.
type ReorderWidgetsRequest ¶
type ReorderWidgetsRequest struct {
Widgets []struct {
ID int64 `json:"id"`
Position int64 `json:"position"`
} `json:"widgets"`
}
ReorderWidgetsRequest represents the JSON request for reordering widgets.
type SearchData ¶
type SearchData struct {
BaseTemplateData
Query string
Pages []PageView
Pagination Pagination
ResultCount int
PopularSearches []string
// Sidebar data for themes that show sidebar on search page
Categories []CategoryView
Tags []TagView
RecentPages []PageView
}
SearchData holds data for search results templates.
type SiteData ¶
type SiteData struct {
SiteName string
Description string
URL string
DefaultOGImage string
Theme *theme.Config
Settings map[string]string
CurrentYear int
}
SiteData holds site-wide data for templates.
type SlugExistsChecker ¶
SlugExistsChecker is a function that checks if a slug exists (returns count).
type SlugExistsFunc ¶
SlugExistsFunc is a function type for checking if a slug exists. Returns count of matching slugs and any error.
type SocialLink ¶
SocialLink represents a social media link.
type SubcategoryView ¶
type SubcategoryView struct {
ID int64
Name string
Slug string
Description string
URL string
Count int64
}
SubcategoryView represents a subcategory with page count for template rendering.
type SubmissionListItem ¶
type SubmissionListItem struct {
Submission store.FormSubmission
Data map[string]interface{}
Preview string
}
SubmissionListItem represents a submission with parsed data for display.
type SubmissionViewData ¶
type SubmissionViewData struct {
Form store.Form
Fields []store.FormField
Submission store.FormSubmission
Data map[string]interface{}
}
SubmissionViewData holds data for viewing a single submission.
type SubmissionsListData ¶
type SubmissionsListData struct {
Form store.Form
Fields []store.FormField
Submissions []SubmissionListItem
TotalCount int64
UnreadCount int64
Pagination AdminPagination
}
SubmissionsListData holds data for the submissions list template.
type SystemInfo ¶
type SystemInfo struct {
GoVersion string `json:"go_version"`
NumGoroutine int `json:"num_goroutines"`
NumCPU int `json:"num_cpus"`
MemAlloc string `json:"mem_alloc"`
MemSys string `json:"mem_sys"`
}
SystemInfo contains system-level information.
type TagFormData ¶
type TagFormData struct {
Tag *store.Tag
Errors map[string]string
FormValues map[string]string
IsEdit bool
Language *store.Language // Current tag language
AllLanguages []store.Language // All active languages for selection
Translations []TagTranslationInfo // Existing translations
MissingLanguages []store.Language // Languages without translations
}
TagFormData holds data for the tag form template.
type TagPageData ¶
type TagPageData struct {
BaseTemplateData
Tag TagView
Pages []PageView
Pagination Pagination
PageCount int
RelatedTags []TagView
// Sidebar data for themes that show sidebar on tag pages
Categories []CategoryView
Tags []TagView
RecentPages []PageView
}
TagPageData holds data for tag archive templates.
type TagTranslationInfo ¶
TagTranslationInfo holds information about a tag translation.
type TagView ¶
type TagView struct {
ID int64
Name string
Slug string
Description string
URL string
PageCount int64
}
TagView represents a tag for template rendering.
type TagsListData ¶
type TagsListData struct {
Tags []store.GetTagUsageCountsRow
TotalCount int64
Pagination AdminPagination
}
TagsListData holds data for the tags list template.
type TaxonomyHandler ¶
type TaxonomyHandler struct {
// contains filtered or unexported fields
}
TaxonomyHandler handles tag and category management routes.
func NewTaxonomyHandler ¶
func NewTaxonomyHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *TaxonomyHandler
NewTaxonomyHandler creates a new TaxonomyHandler.
func (*TaxonomyHandler) CreateCategory ¶
func (h *TaxonomyHandler) CreateCategory(w http.ResponseWriter, r *http.Request)
CreateCategory handles POST /admin/categories - creates a new category.
func (*TaxonomyHandler) CreateTag ¶
func (h *TaxonomyHandler) CreateTag(w http.ResponseWriter, r *http.Request)
CreateTag handles POST /admin/tags - creates a new tag.
func (*TaxonomyHandler) DeleteCategory ¶
func (h *TaxonomyHandler) DeleteCategory(w http.ResponseWriter, r *http.Request)
DeleteCategory handles DELETE /admin/categories/{id} - deletes a category.
func (*TaxonomyHandler) DeleteTag ¶
func (h *TaxonomyHandler) DeleteTag(w http.ResponseWriter, r *http.Request)
DeleteTag handles DELETE /admin/tags/{id} - deletes a tag.
func (*TaxonomyHandler) EditCategoryForm ¶
func (h *TaxonomyHandler) EditCategoryForm(w http.ResponseWriter, r *http.Request)
EditCategoryForm handles GET /admin/categories/{id} - displays the edit category form.
func (*TaxonomyHandler) EditTagForm ¶
func (h *TaxonomyHandler) EditTagForm(w http.ResponseWriter, r *http.Request)
EditTagForm handles GET /admin/tags/{id} - displays the edit tag form.
func (*TaxonomyHandler) ListCategories ¶
func (h *TaxonomyHandler) ListCategories(w http.ResponseWriter, r *http.Request)
ListCategories handles GET /admin/categories - displays category tree.
func (*TaxonomyHandler) ListTags ¶
func (h *TaxonomyHandler) ListTags(w http.ResponseWriter, r *http.Request)
ListTags handles GET /admin/tags - displays a paginated list of tags.
func (*TaxonomyHandler) NewCategoryForm ¶
func (h *TaxonomyHandler) NewCategoryForm(w http.ResponseWriter, r *http.Request)
NewCategoryForm handles GET /admin/categories/new - displays the new category form.
func (*TaxonomyHandler) NewTagForm ¶
func (h *TaxonomyHandler) NewTagForm(w http.ResponseWriter, r *http.Request)
NewTagForm handles GET /admin/tags/new - displays the new tag form.
func (*TaxonomyHandler) SearchCategories ¶
func (h *TaxonomyHandler) SearchCategories(w http.ResponseWriter, r *http.Request)
SearchCategories handles GET /admin/categories/search - AJAX search.
func (*TaxonomyHandler) SearchTags ¶
func (h *TaxonomyHandler) SearchTags(w http.ResponseWriter, r *http.Request)
SearchTags handles GET /admin/tags/search - AJAX search for autocomplete.
func (*TaxonomyHandler) TranslateCategory ¶
func (h *TaxonomyHandler) TranslateCategory(w http.ResponseWriter, r *http.Request)
TranslateCategory handles POST /admin/categories/{id}/translate/{langCode} - creates a translation.
func (*TaxonomyHandler) TranslateTag ¶
func (h *TaxonomyHandler) TranslateTag(w http.ResponseWriter, r *http.Request)
TranslateTag handles POST /admin/tags/{id}/translate/{langCode} - creates a translation.
func (*TaxonomyHandler) UpdateCategory ¶
func (h *TaxonomyHandler) UpdateCategory(w http.ResponseWriter, r *http.Request)
UpdateCategory handles PUT /admin/categories/{id} - updates an existing category.
func (*TaxonomyHandler) UpdateTag ¶
func (h *TaxonomyHandler) UpdateTag(w http.ResponseWriter, r *http.Request)
UpdateTag handles PUT /admin/tags/{id} - updates an existing tag.
type ThemeListData ¶
ThemeListData holds data for the theme list template.
type ThemeSettingsData ¶
type ThemeSettingsData struct {
Theme theme.Info
Settings map[string]string
Errors map[string]string
}
ThemeSettingsData holds data for the theme settings template.
type ThemesHandler ¶
type ThemesHandler struct {
// contains filtered or unexported fields
}
ThemesHandler handles theme management routes.
func NewThemesHandler ¶
func NewThemesHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, tm *theme.Manager, cm *cache.Manager) *ThemesHandler
NewThemesHandler creates a new ThemesHandler.
func (*ThemesHandler) Activate ¶
func (h *ThemesHandler) Activate(w http.ResponseWriter, r *http.Request)
Activate handles POST /admin/themes/activate - activates a theme.
func (*ThemesHandler) List ¶
func (h *ThemesHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/themes - displays available themes.
func (*ThemesHandler) SaveSettings ¶
func (h *ThemesHandler) SaveSettings(w http.ResponseWriter, r *http.Request)
SaveSettings handles PUT /admin/themes/{name}/settings - saves theme settings.
func (*ThemesHandler) Settings ¶
func (h *ThemesHandler) Settings(w http.ResponseWriter, r *http.Request)
Settings handles GET /admin/themes/{name}/settings - displays theme settings form.
type ToggleActiveRequest ¶
type ToggleActiveRequest struct {
Active bool `json:"active"`
}
ToggleActiveRequest represents the request body for toggling module active status.
type ToggleActiveResponse ¶
type ToggleActiveResponse struct {
Success bool `json:"success"`
Active bool `json:"active"`
Message string `json:"message,omitempty"`
}
ToggleActiveResponse represents the response for toggling module active status.
type ToggleSidebarRequest ¶
type ToggleSidebarRequest struct {
Show bool `json:"show"`
}
ToggleSidebarRequest represents the request body for toggling module sidebar visibility.
type ToggleSidebarResponse ¶
type ToggleSidebarResponse struct {
Success bool `json:"success"`
Show bool `json:"show"`
Message string `json:"message,omitempty"`
}
ToggleSidebarResponse represents the response for toggling module sidebar visibility.
type TranslatableConfigItem ¶
type TranslatableConfigItem struct {
Key string
Label string
Description string
Type string
Translations []ConfigTranslationValue // Values per language (includes default lang)
}
TranslatableConfigItem holds a translatable config item with its translations per language.
type TranslationCoverage ¶
type TranslationCoverage struct {
LanguageID int64
LanguageCode string
LanguageName string
TotalPages int64
IsDefault bool
}
TranslationCoverage represents translation coverage for a specific language.
type TranslationLink ¶
type TranslationLink struct {
Language LanguageView
URL string // Full URL to the translated page
PageTitle string // Title of the translated page
HasPage bool // Whether a translation exists for this language
}
TranslationLink represents a translation for the language switcher.
type UpdateFieldRequest ¶
type UpdateFieldRequest struct {
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"`
}
UpdateFieldRequest represents the JSON request for updating a form field.
type UpdateItemRequest ¶
type UpdateItemRequest struct {
Title string `json:"title"`
URL string `json:"url"`
Target string `json:"target"`
PageID *int64 `json:"page_id"`
ParentID *int64 `json:"parent_id"`
CSSClass string `json:"css_class"`
IsActive bool `json:"is_active"`
}
UpdateItemRequest represents the JSON request for updating a menu item.
type UpdateWidgetRequest ¶
type UpdateWidgetRequest struct {
WidgetType string `json:"widget_type"`
Title string `json:"title"`
Content string `json:"content"`
Settings string `json:"settings"`
IsActive bool `json:"is_active"`
}
UpdateWidgetRequest represents the JSON request for updating a widget.
type UploadFormData ¶
type UploadFormData struct {
Folders []store.MediaFolder
MaxSize int64
AllowedExt string
}
UploadFormData holds data for the upload form template.
type UserFormData ¶
type UserFormData struct {
User *store.User
Roles []string
Errors map[string]string
FormValues map[string]string
IsEdit bool
}
UserFormData holds data for the user form template.
type UsersHandler ¶
type UsersHandler struct {
// contains filtered or unexported fields
}
UsersHandler handles user management routes.
func NewUsersHandler ¶
func NewUsersHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *UsersHandler
NewUsersHandler creates a new UsersHandler.
func (*UsersHandler) Create ¶
func (h *UsersHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/users - creates a new user.
func (*UsersHandler) Delete ¶
func (h *UsersHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/users/{id} - deletes a user.
func (*UsersHandler) EditForm ¶
func (h *UsersHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/users/{id} - displays the edit user form.
func (*UsersHandler) List ¶
func (h *UsersHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/users - displays a paginated list of users.
func (*UsersHandler) NewForm ¶
func (h *UsersHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/users/new - displays the new user form.
func (*UsersHandler) SetDispatcher ¶
func (h *UsersHandler) SetDispatcher(d *webhook.Dispatcher)
SetDispatcher sets the webhook dispatcher for event dispatching.
func (*UsersHandler) Update ¶
func (h *UsersHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/users/{id} - updates an existing user.
type UsersListData ¶
type UsersListData struct {
Users []store.User
CurrentUserID int64
TotalUsers int64
Pagination AdminPagination
}
UsersListData holds data for the users list template.
type WebhookDeliveriesData ¶
type WebhookDeliveriesData struct {
Webhook store.Webhook
Deliveries []store.WebhookDelivery
TotalCount int64
Pagination AdminPagination
}
WebhookDeliveriesData holds data for the deliveries template.
type WebhookFormData ¶
type WebhookFormData struct {
Webhook *store.Webhook
Events []model.WebhookEventInfo
Errors map[string]string
FormValues map[string]string
FormEvents []string
FormHeaders map[string]string
IsEdit bool
}
WebhookFormData holds data for the webhook form template.
type WebhookHealthItem ¶
type WebhookHealthItem struct {
ID int64
Name string
IsActive bool
HealthStatus string // "green", "yellow", "red", "unknown"
SuccessRate float64
}
WebhookHealthItem represents a webhook's health for dashboard display.
type WebhookWithStats ¶
type WebhookWithStats struct {
store.Webhook
Events []string
TotalDelivered int64
TotalPending int64
TotalDead int64
SuccessRate float64
HealthStatus string // "green", "yellow", "red", "unknown"
Last24hDelivered int64
Last24hTotal int64
LastSuccessfulAt *time.Time // nil if never delivered
LastSuccessfulEvent string // event type of last successful delivery
}
WebhookWithStats includes webhook data and delivery stats.
type WebhooksHandler ¶
type WebhooksHandler struct {
// contains filtered or unexported fields
}
WebhooksHandler handles webhook management routes.
func NewWebhooksHandler ¶
func NewWebhooksHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *WebhooksHandler
NewWebhooksHandler creates a new WebhooksHandler.
func (*WebhooksHandler) Create ¶
func (h *WebhooksHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/webhooks - creates a new webhook.
func (*WebhooksHandler) Delete ¶
func (h *WebhooksHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/webhooks/{id} - deletes a webhook.
func (*WebhooksHandler) Deliveries ¶
func (h *WebhooksHandler) Deliveries(w http.ResponseWriter, r *http.Request)
Deliveries handles GET /admin/webhooks/{id}/deliveries - displays delivery history.
func (*WebhooksHandler) EditForm ¶
func (h *WebhooksHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/webhooks/{id} - displays the edit webhook form.
func (*WebhooksHandler) List ¶
func (h *WebhooksHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/webhooks - displays all webhooks.
func (*WebhooksHandler) NewForm ¶
func (h *WebhooksHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/webhooks/new - displays the new webhook form.
func (*WebhooksHandler) RetryDelivery ¶
func (h *WebhooksHandler) RetryDelivery(w http.ResponseWriter, r *http.Request)
RetryDelivery handles POST /admin/webhooks/{id}/deliveries/{did}/retry - retries a delivery.
func (*WebhooksHandler) Test ¶
func (h *WebhooksHandler) Test(w http.ResponseWriter, r *http.Request)
Test handles POST /admin/webhooks/{id}/test - sends a test event.
func (*WebhooksHandler) Update ¶
func (h *WebhooksHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/webhooks/{id} - updates an existing webhook.
type WebhooksListData ¶
type WebhooksListData struct {
Webhooks []WebhookWithStats
TotalWebhooks int64
}
WebhooksListData holds data for the webhooks list template.
type WidgetAreaWithWidgets ¶
type WidgetAreaWithWidgets struct {
Area theme.WidgetArea
Widgets []store.Widget
}
WidgetAreaWithWidgets represents a widget area with its widgets.
type WidgetsHandler ¶
type WidgetsHandler struct {
// contains filtered or unexported fields
}
WidgetsHandler handles widget management routes.
func NewWidgetsHandler ¶
func NewWidgetsHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, tm *theme.Manager) *WidgetsHandler
NewWidgetsHandler creates a new WidgetsHandler.
func (*WidgetsHandler) Create ¶
func (h *WidgetsHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/widgets - creates a new widget.
func (*WidgetsHandler) Delete ¶
func (h *WidgetsHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/widgets/{id} - deletes a widget.
func (*WidgetsHandler) GetWidget ¶
func (h *WidgetsHandler) GetWidget(w http.ResponseWriter, r *http.Request)
GetWidget handles GET /admin/widgets/{id} - gets a widget by ID.
func (*WidgetsHandler) List ¶
func (h *WidgetsHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/widgets - displays widget management page.
func (*WidgetsHandler) MoveWidget ¶
func (h *WidgetsHandler) MoveWidget(w http.ResponseWriter, r *http.Request)
MoveWidget handles POST /admin/widgets/{id}/move - moves a widget to a different area.
func (*WidgetsHandler) Reorder ¶
func (h *WidgetsHandler) Reorder(w http.ResponseWriter, r *http.Request)
Reorder handles POST /admin/widgets/reorder - reorders widgets.
func (*WidgetsHandler) Update ¶
func (h *WidgetsHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/widgets/{id} - updates a widget.
type WidgetsListData ¶
type WidgetsListData struct {
Theme *theme.Theme
WidgetAreas []WidgetAreaWithWidgets
WidgetTypes []struct {
ID string
Name string
Description string
}
AllThemes []theme.Info
}
WidgetsListData holds data for the widgets list template.