go-admin: github.com/GoAdminGroup/go-admin/template Index | Files | Directories

package template

import "github.com/GoAdminGroup/go-admin/template"

Index

Package Files

template.go

func Add Uses

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 Uses

func AddComp(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 AddFromPlugin Uses

func AddFromPlugin(name string, mod string)

func AddLoginComp Uses

func AddLoginComp(comp Component)

AddLoginComp add the specified login component.

func CSS Uses

func CSS(s string) template.CSS

func DefaultFuncMap Uses

func DefaultFuncMap() template.FuncMap

func Execute Uses

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

func GetAsset Uses

func GetAsset(path string) ([]byte, error)

func GetComponentAssetLists Uses

func GetComponentAssetLists() []string

func GetComponentAssetListsHTML Uses

func GetComponentAssetListsHTML() (res template.HTML)

func GetComponentAssetListsWithinPage Uses

func GetComponentAssetListsWithinPage() []string

func HTML Uses

func HTML(s string) template.HTML

func JS Uses

func JS(s string) template.JS

func SetComp Uses

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.

type BaseComponent Uses

type BaseComponent struct{}

func (BaseComponent) GetAsset Uses

func (b BaseComponent) GetAsset(name string) ([]byte, error)

func (BaseComponent) GetAssetList Uses

func (b BaseComponent) GetAssetList() []string

type Component Uses

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/GoAdminGroup/go-admin/blob/master/template/login/theme1.tmpl#L32
    // https://github.com/GoAdminGroup/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)

    GetContent() template.HTML

    IsAPage() bool

    GetName() string
}

Component is the interface which stand for a ui component.

func GetComp Uses

func GetComp(name string) Component

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

type Template Uses

type Template interface {

    // layout
    Col() types.ColAttribute
    Row() types.RowAttribute

    // form and table
    Form() types.FormAttribute
    Table() types.TableAttribute
    DataTable() types.DataTableAttribute

    Tree() types.TreeAttribute
    Tabs() types.TabsAttribute
    Alert() types.AlertAttribute
    Link() types.LinkAttribute

    Paginator() types.PaginatorAttribute
    Popup() types.PopupAttribute
    Box() types.BoxAttribute

    Label() types.LabelAttribute
    Image() types.ImgAttribute

    Button() types.ButtonAttribute

    // 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 Default Uses

func Default() Template

Get the default template with the theme name set with the global config. If the name is not found, it panics.

func Get Uses

func Get(theme string) Template

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

Directories

PathSynopsis
chartjs
color
components
icon
loginCode generated by go-bindata.
types
types/action
types/form
types/table

Package template imports 16 packages (graph) and is imported by 50 packages. Updated 2020-01-23. Refresh now. Tools for package owners.