File size: 1,243 Bytes
530729e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
package components
import (
"html/template"
"github.com/GoAdminGroup/go-admin/template/types"
)
type LinkAttribute struct {
Name string
URL string
Class template.HTML
Title template.HTML
Attributes template.HTMLAttr
Content template.HTML
types.Attribute
}
func (compo *LinkAttribute) OpenInNewTab() types.LinkAttribute {
compo.Class += " new-tab-link"
return compo
}
func (compo *LinkAttribute) SetURL(value string) types.LinkAttribute {
compo.URL = value
return compo
}
func (compo *LinkAttribute) SetClass(class template.HTML) types.LinkAttribute {
compo.Class = class
return compo
}
func (compo *LinkAttribute) SetAttributes(attr template.HTMLAttr) types.LinkAttribute {
compo.Attributes = attr
return compo
}
func (compo *LinkAttribute) NoPjax() types.LinkAttribute {
compo.Class += " no-pjax"
return compo
}
func (compo *LinkAttribute) SetTabTitle(value template.HTML) types.LinkAttribute {
compo.Title = value
return compo
}
func (compo *LinkAttribute) SetContent(value template.HTML) types.LinkAttribute {
compo.Content = value
return compo
}
func (compo *LinkAttribute) GetContent() template.HTML {
return ComposeHtml(compo.TemplateList, compo.Separation, *compo, "link")
}
|