-
Notifications
You must be signed in to change notification settings - Fork 6
/
modal.tpl.go
executable file
·79 lines (54 loc) · 1.35 KB
/
modal.tpl.go
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//** This file was code generated by got. DO NOT EDIT. ***
package control
import (
"bytes"
"context"
"html"
)
func (d *Modal) DrawTemplate(ctx context.Context, buf *bytes.Buffer) (err error) {
buf.WriteString(` <div class="modal-dialog" role="document">
<div class="modal-content">
`)
d.titleBar.AddClass("modal-header")
d.titleBar.Draw(ctx, buf)
buf.WriteString(` <div class="modal-body">
`)
l := len(d.Children())
if l > 2 {
for _, child := range d.Children() {
if child.ID() != d.titleBar.ID() && child.ID() != d.buttonBar.ID() {
child.Draw(ctx, buf)
}
}
} else {
buf.WriteString(`<p>`)
buf.WriteString(html.EscapeString(d.Text()))
buf.WriteString(` </p>`)
}
buf.WriteString(`
</div>
`)
d.buttonBar.AddClass("modal-footer")
d.buttonBar.Draw(ctx, buf)
buf.WriteString(` </div>
</div>
`)
return
}
func (d *TitleBar) DrawTemplate(ctx context.Context, buf *bytes.Buffer) (err error) {
if d.Title != "" {
buf.WriteString(` <h5 id="`)
buf.WriteString(d.Parent().ID())
buf.WriteString(`_title" class="modal-title">`)
buf.WriteString(d.Title)
buf.WriteString(`</h5>
`)
}
if d.HasCloseBox {
buf.WriteString(` <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
`)
}
return
}