page

package
v0.0.0-...-7b0100a Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderComponent

func RenderComponent(c Component) string

RenderComponent takes the provided component and finds the relevant template and renders this into a string

Types

type Component

type Component interface {
	GetSection() string
	// render returns a html template string with the content of the field
	Render() string
	GetTemplateName() string
	GetTheme() string
	GetTemplate() *template.Template
}

Component is anything that can be rendered on a page. A text field is a component but so is the form the text field is a part of.

type Menu interface {
	GetIdentifier() string
	GetItems() []MenuItem
	Render() string
}

Menu is a component but requires a slice of menu items

type MenuItem struct {
	Text     string
	URI      string
	Template string
	Theme    string
	Items    []MenuItem // A menu item can contain submenus
	T        *template.Template
}

MenuItem is part of a Menu and usually represents a clickable link

func (m MenuItem) SubMenu() template.HTML

SubMenu renders submenu items recursively in templates

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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