Documentation ¶
Index ¶
- Constants
- Variables
- func Add(name string, temp Template)
- func AddComp(comp Component)
- func AddFromPlugin(name string, mod string)
- func AddLoginComp(comp Component)
- func CSS(s string) template.CSS
- func CheckRequirements() (bool, bool)
- func CheckThemeRequirements() bool
- func Execute(param ExecuteParam) *bytes.Buffer
- func GetAsset(path string) ([]byte, error)
- func GetComponentAsset() []string
- func GetComponentAssetImportHTML() (res template.HTML)
- func GetComponentAssetWithinPage() []string
- func HTML(s string) template.HTML
- func JS(s string) template.JS
- func SetComp(name string, comp Component)
- func Themes() []string
- func VersionCompare(toCompare string, versions []string) bool
- func WarningPanel(msg string) types.Panel
- type BaseComponent
- type Component
- type ExecuteParam
- type Template
Constants ¶
View Source
const ( CompCol = "col" CompRow = "row" CompForm = "form" CompTable = "table" CompDataTable = "datatable" CompTree = "tree" CompTabs = "tabs" CompAlert = "alert" CompLink = "link" CompPaginator = "paginator" CompPopup = "popup" CompBox = "box" CompLabel = "label" CompImage = "image" CompButton = "button" )
Variables ¶
View Source
var DefaultFuncMap = template.FuncMap{ "lang": language.Get, "langHtml": language.GetFromHtml, "link": func(cdnUrl, prefixUrl, assetsUrl string) string { if cdnUrl == "" { return prefixUrl + assetsUrl } return cdnUrl + assetsUrl }, "isLinkUrl": func(s string) bool { return (len(s) > 7 && s[:7] == "http://") || (len(s) > 8 && s[:8] == "https://") }, "render": func(s, old, repl template.HTML) template.HTML { return template.HTML(strings.Replace(string(s), string(old), string(repl), -1)) }, "renderJS": func(s template.JS, old, repl template.HTML) template.JS { return template.JS(strings.Replace(string(s), string(old), string(repl), -1)) }, "divide": func(a, b int) int { return a / b }, "renderRowDataHTML": func(id, content template.HTML) template.HTML { return template.HTML(types.ParseTableDataTmplWithID(id, string(content))) }, "renderRowDataJS": func(id template.HTML, content template.JS) template.JS { return template.JS(types.ParseTableDataTmplWithID(id, string(content))) }, "js": func(s interface{}) template.JS { if ss, ok := s.(string); ok { return template.JS(ss) } if ss, ok := s.(template.HTML); ok { return template.JS(ss) } return "" }, }
View Source
var DefaultThemeNames = []string{"adminlte", "sword"}
Functions ¶
func Add ¶ added in v0.0.2
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(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 ¶ added in v1.0.3
func AddLoginComp ¶ added in v1.0.0
func AddLoginComp(comp Component)
AddLoginComp add the specified login component.
func CheckRequirements ¶ added in v1.2.8
func CheckThemeRequirements ¶ added in v1.2.9
func CheckThemeRequirements() bool
func Execute ¶ added in v1.0.0
func Execute(param ExecuteParam) *bytes.Buffer
func GetComponentAsset ¶ added in v1.2.10
func GetComponentAsset() []string
func GetComponentAssetImportHTML ¶ added in v1.2.10
func GetComponentAssetWithinPage ¶ added in v1.2.10
func GetComponentAssetWithinPage() []string
func SetComp ¶ added in v1.0.0
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.
func VersionCompare ¶ added in v1.2.9
func WarningPanel ¶ added in v1.2.7
Types ¶
type BaseComponent ¶ added in v1.0.3
type BaseComponent struct{}
func (BaseComponent) GetAsset ¶ added in v1.0.3
func (b BaseComponent) GetAsset(name string) ([]byte, error)
func (BaseComponent) GetAssetList ¶ added in v1.0.3
func (b BaseComponent) GetAssetList() []string
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/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.
type ExecuteParam ¶ added in v1.2.7
type Template ¶ added in v0.0.2
type Template interface { Name() string // 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 GetAssetImportHTML(exceptComponents ...string) template.HTML GetAsset(string) ([]byte, error) GetTemplate(bool) (*template.Template, string) GetVersion() string GetRequirements() []string }
Template is the interface which contains methods of ui components. It will be used in the plugins for custom the ui.
Directories ¶
Path | Synopsis |
---|---|
Code generated by go-bindata.
|
Code generated by go-bindata. |
Code generated by go-bindata.
|
Code generated by go-bindata. |
Click to show internal directories.
Click to hide internal directories.