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 html
import (
. "maragu.dev/gomponents"
. "maragu.dev/gomponents/html"
)
type CreatePageForm struct {
Name string
Host string
}
func CreatePage(success, err string, formValues CreatePageForm) Node {
return page("Create site",
H1(Text("Create site")),
If(success != "", Group{
alertSuccess(success),
Div(
Class("control-group group-right"),
navButton("OK", "/"),
),
}),
If(success == "", Group{
If(err != "", alertError(err)),
Form(
Action("/create"),
Method("post"),
FieldSet(
Legend(Text("Site details")),
Label(
For("name"),
Text("Name"),
),
Input(
ID("name"),
Name("name"),
Value(formValues.Name),
),
Span(
Class("form-help"),
Text("The unique identifier for this site. This must be a valid directory name, and should be lower case with no spaces."),
),
Label(
For("host"),
Text("Host"),
),
Input(
ID("host"),
Name("host"),
Value(formValues.Host),
),
Span(
Class("form-help"),
Text("The fully qualified domain name for which this site is to be served on."),
),
),
Div(
Class("control-group group-right"),
navButton("Go back", "/"),
Input(
Type("submit"),
Value("Submit"),
),
),
),
}),
)
}
|