content

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddElement

func AddElement(w http.ResponseWriter, r *http.Request)

AddElement adds a new element to the page or to a parent element.

func AddReference

func AddReference(w http.ResponseWriter, r *http.Request)

AddReference adds an existing reference to the parent element.

func CreateReference

func CreateReference(w http.ResponseWriter, r *http.Request)

CreateReference creates a new reference for the given element.

func DeleteElement

func DeleteElement(w http.ResponseWriter, r *http.Request)

DeleteElement deletes an element from a page.

func DeleteReference

func DeleteReference(w http.ResponseWriter, r *http.Request)

DeleteReference deletes a reference.

func EditElement

func EditElement(w http.ResponseWriter, r *http.Request)

EditElement updates the copy and data for an element.

func Init

func Init(ctx context.Context, cms *cms.CMS) error

Init initializes the template cache and watches for configuration changes.

func MoveElement

func MoveElement(w http.ResponseWriter, r *http.Request)

MoveElement moves an element to a new position.

func Page

func Page(w http.ResponseWriter, r *http.Request)

Page renders the page editing dialog.

func Reference

func Reference(w http.ResponseWriter, r *http.Request)

Reference renders the reference JSON editor.

func References

func References(w http.ResponseWriter, r *http.Request)

References renders the references management dialog.

Types

type AddElementData added in v1.1.0

type AddElementData struct {
	Language  string
	Lang      string
	Path      string
	Element   string
	Templates []TemplateConfig
	Positions map[string]TemplateContent
	Template  string
	Position  string
	Errors    map[string]string
}

AddElementData is the data required to render the element dialog.

type AddReferenceData added in v1.1.0

type AddReferenceData struct {
	Language   string
	Lang       string
	Path       string
	Element    string
	References []Ref
	Positions  map[string]TemplateContent
	Reference  string
	Position   string
	Errors     map[string]string
}

AddReferenceData is the data required to render the reference dialog.

type Entry

type Entry struct {
	Name string
	Path string
}

Entry is a reference.

type PageTree

type PageTree struct {
	Language  string
	Lang      string
	Path      string
	Page      *cms.Content
	Positions map[string]string

	ParentElement    string
	ElementPosition  string
	ElementDirection string
	AddElement       template.HTML
	UpdateElement    template.HTML
	MoveElement      string
	DeleteElement    string
}

PageTree is the data required to render the page tree.

type Ref

type Ref struct {
	Name  string
	Label string
}

Ref is a referenced element to be displayed in the selection.

type TemplateCfgCache

type TemplateCfgCache struct {
	// contains filtered or unexported fields
}

TemplateCfgCache is a cache for template configurations.

func NewTemplateCfgCache added in v1.1.2

func NewTemplateCfgCache() *TemplateCfgCache

NewTemplateCfgCache creates a new TemplateCfgCache.

func (*TemplateCfgCache) GetPositions

func (c *TemplateCfgCache) GetPositions() map[string]string

GetPositions returns the template position mapping.

func (*TemplateCfgCache) GetTemplate

func (c *TemplateCfgCache) GetTemplate(name string) (TemplateConfig, bool)

GetTemplate returns a template configuration by name.

func (*TemplateCfgCache) List

func (c *TemplateCfgCache) List(filter []string) []TemplateConfig

List returns a list of all template configurations. The filter is optional.

func (*TemplateCfgCache) Load

func (c *TemplateCfgCache) Load()

Load loads the template cache from disk.

type TemplateConfig

type TemplateConfig struct {
	Name    string                     `json:"-"`
	Label   string                     `json:"label"`
	Layout  bool                       `json:"layout"`
	Content map[string]TemplateContent `json:"content"`
	Copy    map[string]TemplateCopy    `json:"copy"`
	Data    map[string]TemplateData    `json:"data"`
}

TemplateConfig is the configuration for a template.

func (*TemplateConfig) Positions

func (c *TemplateConfig) Positions() []string

Positions returns the available positions for the template.

type TemplateContent added in v1.1.0

type TemplateContent struct {
	Label     string   `json:"label"`
	TplFilter []string `json:"tpl_filter"`
}

TemplateContent is the configuration for a template content area.

type TemplateCopy

type TemplateCopy struct {
	Label   string            `json:"label"`
	Type    string            `json:"type"`
	Options map[string]string `json:"options"`
}

TemplateCopy is the configuration for a template copy entry.

type TemplateData

type TemplateData struct {
	Label   string            `json:"label"`
	Type    string            `json:"type"`
	Options map[string]string `json:"options"`
}

TemplateData is the configuration for a template data entry.

Jump to

Keyboard shortcuts

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