-
Notifications
You must be signed in to change notification settings - Fork 0
/
expand.go
74 lines (59 loc) · 1.62 KB
/
expand.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
package handlers
import (
"net/http"
mgc "github.com/mh-cbon/mdl-go-components"
"github.com/mh-cbon/mdl-go-components/components"
)
func Expand(w http.ResponseWriter, r *http.Request) {
data := &viewData{
Title: "Expand",
Components: make([]mgc.ViewComponentRenderer, 0),
}
var t1 *components.Expand
var line *components.Slice
// -
child := components.NewInputConfirmText()
child.SetError("This is an error!")
child.InputLeft.SetName("left-name")
child.InputLeft.SetId("left-id")
child.InputLeft.SetLabel("Left label")
child.InputLeft.SetValue("Left value")
child.InputRight.SetName("right-name")
child.InputRight.SetId("right-id")
child.InputRight.SetLabel("Right label")
child.InputRight.SetValue("Right value")
// -
line = components.NewSlice()
t1 = components.NewExpand()
bt := components.NewCheckbox()
bt.GetOption().SetLabel("labelopt")
bt.GetOption().SetValue("valueopt")
bt.SetName("name")
t1.SetBt(bt)
t1.AddComponent(child)
line.AddComponent(t1)
data.Components = append(data.Components, line)
// -
line = components.NewSlice()
t1 = components.NewExpand()
bt2 := components.NewCheckbox()
bt2.GetOption().SetLabel("labelopt")
bt2.GetOption().SetValue("valueopt")
bt2.SetName("name")
bt2.SetChecked(true)
t1.SetBt(bt2)
t1.AddComponent(child)
line.AddComponent(t1)
data.Components = append(data.Components, line)
// -
line = components.NewSlice()
t1 = components.NewExpand()
bt3 := components.NewText()
bt3.SetContent("Click me !")
t1.SetBt(bt3)
t1.AddComponent(child)
line.AddComponent(t1)
data.Components = append(data.Components, line)
// -
renderComponents(w, data)
}