Documentation
¶
Overview ¶
Package example provides an example module demonstrating the oCMS module system. This module serves as a reference implementation for creating custom modules.
Index ¶
- func ExamplePage(pc *adminviews.PageContext, data ExampleViewData) templ.Component
- type ExampleItem
- type ExampleViewData
- type Item
- type Module
- func (m *Module) AdminURL() string
- func (m *Module) Init(ctx *module.Context) error
- func (m *Module) Migrations() []module.Migration
- func (m *Module) RegisterAdminRoutes(r chi.Router)
- func (m *Module) RegisterRoutes(r chi.Router)
- func (m *Module) Shutdown() error
- func (m *Module) SidebarLabel() string
- func (m *Module) TemplateFuncs() template.FuncMap
- func (m *Module) TranslationsFS() embed.FS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExamplePage ¶ added in v0.9.0
func ExamplePage(pc *adminviews.PageContext, data ExampleViewData) templ.Component
Types ¶
type ExampleItem ¶ added in v0.9.0
ExampleItem is a view-only struct with pre-formatted date.
type ExampleViewData ¶ added in v0.9.0
type ExampleViewData struct {
Version string
Items []ExampleItem
}
ExampleViewData holds data for the example admin page.
type Item ¶
type Item struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
}
Item represents an item in the example module.
type Module ¶
type Module struct {
module.BaseModule
// contains filtered or unexported fields
}
Module implements the module.Module interface.
func (*Module) Migrations ¶
Migrations returns database migrations for the module.
func (*Module) RegisterAdminRoutes ¶
RegisterAdminRoutes registers admin routes for the module.
func (*Module) RegisterRoutes ¶
RegisterRoutes registers public routes for the module.
func (*Module) SidebarLabel ¶
SidebarLabel returns the display label for the admin sidebar.
func (*Module) TemplateFuncs ¶
TemplateFuncs returns template functions provided by the module.
func (*Module) TranslationsFS ¶
TranslationsFS returns the embedded filesystem containing module translations.