template

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add added in v0.0.2

func Add(name string, temp Template)

Add makes a template available by the provided theme name. If Add is called twice with the same name or if template is nil, it panics.

func AddComp added in v0.0.2

func AddComp(name string, comp Component)

AddComp makes a component available by the provided name. If Add is called twice with the same name or if component is nil, it panics.

func AddLoginComp added in v0.1.2

func AddLoginComp(comp Component)

AddLoginComp add the specified login component.

func Execute added in v0.0.5

func Execute(tmpl *template.Template,
	tmplName string,
	user models.UserModel,
	panel types.Panel,
	config c.Config,
	globalMenu *menu.Menu) *bytes.Buffer

func SetComp added in v0.0.5

func SetComp(name string, comp Component)

SetComp makes a component available by the provided name. If the value corresponding to the key is empty or if component is nil, it panics.

Types

type Component added in v0.0.2

type Component interface {
	// GetTemplate return a *template.Template and a given key.
	GetTemplate() (*template.Template, string)

	// GetAssetList return the assets url suffix used in the component.
	// example:
	//
	// {{.UrlPrefix}}/assets/login/css/bootstrap.min.css => login/css/bootstrap.min.css
	//
	// See:
	// https://github.com/chenhg5/go-admin/blob/master/template/login/theme1.tmpl#L32
	// https://github.com/chenhg5/go-admin/blob/master/template/login/list.go
	GetAssetList() []string

	// GetAsset return the asset content according to the corresponding url suffix.
	// Asset content is recommended to use the tool go-bindata to generate.
	//
	// See: http://github.com/jteeuwen/go-bindata
	GetAsset(string) ([]byte, error)
}

Component is the interface which stand for a ui component.

func GetComp added in v0.0.2

func GetComp(name string) Component

GetComp gets the component by registered name. If the name is not found, it panics.

type Template added in v0.0.2

type Template interface {
	// Components
	Form() types.FormAttribute
	Box() types.BoxAttribute
	Col() types.ColAttribute
	Image() types.ImgAttribute
	SmallBox() types.SmallBoxAttribute
	Label() types.LabelAttribute
	Row() types.RowAttribute
	Table() types.TableAttribute
	DataTable() types.DataTableAttribute
	Tree() types.TreeAttribute
	InfoBox() types.InfoBoxAttribute
	Paginator() types.PaginatorAttribute
	AreaChart() types.AreaChartAttribute
	ProgressGroup() types.ProgressGroupAttribute
	LineChart() types.LineChartAttribute
	BarChart() types.BarChartAttribute
	ProductList() types.ProductListAttribute
	Description() types.DescriptionAttribute
	Alert() types.AlertAttribute
	PieChart() types.PieChartAttribute
	ChartLegend() types.ChartLegendAttribute
	Tabs() types.TabsAttribute
	Popup() types.PopupAttribute

	// Builder methods
	GetTmplList() map[string]string
	GetAssetList() []string
	GetAsset(string) ([]byte, error)
	GetTemplate(bool) (*template.Template, string)
}

Template is the interface which contains methods of ui components. It will be used in the plugins for custom the ui.

func Get added in v0.0.2

func Get(theme string) Template

Get the template interface by theme name. If the name is not found, it panics.

Directories

Path Synopsis
resource
Code generated by go-bindata.
Code generated by go-bindata.
Code generated by go-bindata.
Code generated by go-bindata.

Jump to

Keyboard shortcuts

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