12345678910111213141516171819202122232425262728293031323334353637383940 |
- package element
- import (
- "git.nspix.com/golang/pgenr/internal/pool"
- "golang.org/x/net/html/atom"
- "html"
- )
- type Action struct {
- Instructions Element
- Button *Button
- InviteCode string
- }
- func (element *Action) Html() string {
- return element.String()
- }
- func (element *Action) String() string {
- br := pool.Get()
- defer pool.Put(br)
- if element.Instructions != nil {
- br.WriteString(element.Instructions.Html())
- }
- br.WriteString(beginTag(atom.Div.String(), Attrs{"class": "action-block"}))
- if element.InviteCode != "" {
- br.WriteString(beginTag(atom.Span.String(), Attrs{"class": "invite-code"}))
- br.WriteString(html.EscapeString(element.InviteCode))
- br.WriteString(endTag(atom.Span.String()))
- }
- if element.Button != nil {
- br.WriteString(element.Button.String())
- }
- br.WriteString(endTag(atom.Div.String()))
- return br.String()
- }
- func NewAction() *Action {
- return &Action{}
- }
|