github.com/keysonZZZ/kmg@v0.0.0-20151121023212-05317bfd7d39/kmgView/kmgBootstrap/dropDown.go (about) 1 package kmgBootstrap 2 3 import ( 4 "github.com/bronze1man/kmg/kmgRand" 5 "github.com/bronze1man/kmg/kmgView" 6 ) 7 8 type DropDown struct { 9 id string 10 Title kmgView.HtmlRenderer 11 OptionList []NavBarNode 12 } 13 14 func (d DropDown) HtmlRender() string { 15 if d.id == "" { 16 d.id = kmgRand.MustCryptoRandToReadableAlphaNum(20) 17 } 18 return tplDropDown(d) 19 } 20 21 func NewMoreButton(optionList []NavBarNode) DropDown { 22 d := DropDown{ 23 Title: Button{ 24 Size: ButtonSizeExtraSmall, 25 Content: Icon{ 26 IconName: "cog", 27 }, 28 }, 29 OptionList: optionList, 30 } 31 return d 32 } 33 34 func NewCaret() kmgView.HtmlRenderer { 35 return kmgView.Html(`<span class="caret"></span>`) 36 }