-
Notifications
You must be signed in to change notification settings - Fork 0
/
dup.go
45 lines (36 loc) · 931 Bytes
/
dup.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
package handlers
import (
"net/http"
mgc "github.com/mh-cbon/mdl-go-components"
"github.com/mh-cbon/mdl-go-components/components"
)
func Dup(w http.ResponseWriter, r *http.Request) {
data := &viewData{
Title: "Dup",
Components: make([]mgc.ViewComponentRenderer, 0),
}
dup := components.NewDup()
dup.SetId("id")
dup.SetBtAddText("more")
dup.SetBtRemoveText("less")
bt := components.NewButton()
bt.SetLabel("hello bt!")
dup.AddComponent(bt)
bt = components.NewButton()
bt.SetLabel("hello bt2!")
dup.AddComponent(bt)
bt = components.NewButton()
bt.SetLabel("hello bt3!")
dup.AddComponent(bt)
sl := components.NewSlice()
txt := components.NewInputText()
txt.SetLabel("hello duped bt!")
sl.AddComponent(txt)
txt = components.NewInputText()
txt.SetLabel("hello duped bt!2")
sl.AddComponent(txt)
dup.SetDup(sl)
data.Components = append(data.Components, dup)
// -
renderComponents(w, data)
}