github.com/kotovmak/go-admin@v1.1.1/template/components/tree.go (about) 1 package components 2 3 import ( 4 "html/template" 5 6 "github.com/kotovmak/go-admin/modules/menu" 7 "github.com/kotovmak/go-admin/template/types" 8 ) 9 10 type TreeAttribute struct { 11 Name string 12 Tree []menu.Item 13 EditUrl string 14 DeleteUrl string 15 UrlPrefix string 16 OrderUrl string 17 types.Attribute 18 } 19 20 func (compo *TreeAttribute) SetTree(value []menu.Item) types.TreeAttribute { 21 compo.Tree = value 22 return compo 23 } 24 25 func (compo *TreeAttribute) SetEditUrl(value string) types.TreeAttribute { 26 compo.EditUrl = value 27 return compo 28 } 29 30 func (compo *TreeAttribute) SetUrlPrefix(value string) types.TreeAttribute { 31 compo.UrlPrefix = value 32 return compo 33 } 34 35 func (compo *TreeAttribute) SetDeleteUrl(value string) types.TreeAttribute { 36 compo.DeleteUrl = value 37 return compo 38 } 39 40 func (compo *TreeAttribute) SetOrderUrl(value string) types.TreeAttribute { 41 compo.OrderUrl = value 42 return compo 43 } 44 45 func (compo *TreeAttribute) GetContent() template.HTML { 46 return ComposeHtml(compo.TemplateList, compo.Separation, *compo, "tree") 47 } 48 49 func (compo *TreeAttribute) GetTreeHeader() template.HTML { 50 return ComposeHtml(compo.TemplateList, compo.Separation, *compo, "tree-header") 51 }