Documentation
¶
Overview ¶
Package bookmarks provides a custom bookmarks module for oCMS. It demonstrates how to create a fully self-contained custom module in the custom/modules/ directory with database migrations, embedded admin template, public routes, template functions, hooks, and i18n translations.
The module self-registers via init() in register.go. To enable it, add a blank import to custom/modules/imports.go:
_ "github.com/olegiv/ocms-go/custom/modules/bookmarks"
Index ¶
- type Bookmark
- 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 ¶
This section is empty.
Types ¶
type Bookmark ¶
type Bookmark struct {
ID int64 `json:"id"`
Title string `json:"title"`
URL string `json:"url"`
Description string `json:"description"`
IsFavorite bool `json:"is_favorite"`
CreatedAt time.Time `json:"created_at"`
CreatedAtFormatted string `json:"-"`
}
Bookmark represents a saved bookmark.
type Module ¶
type Module struct {
module.BaseModule
// contains filtered or unexported fields
}
Module implements the module.Module interface for bookmarks.
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.