aboutsummaryrefslogtreecommitdiffstats
path: root/web/command/html/upload.go
blob: 5810b198ebc1ca196aadbcec1cc6183c1c0ca34b (plain)
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
package html

import (
	"fmt"

	. "github.com/LMBishop/scrapbook/web/skeleton"
	. "maragu.dev/gomponents"
	. "maragu.dev/gomponents/html"
)

func UploadPage(success, err string, siteName string) Node {
	return Page("Upload new version to "+siteName,
		H1(Text("Upload new version to "+siteName)),

		If(success != "", Group{
			AlertSuccess(success),
			Div(
				Class("control-group group-right"),
				NavButton("OK", fmt.Sprintf("/site/%s/", siteName)),
			),
		}),

		If(success == "", Group{
			If(err != "", AlertError(err)),

			Form(
				Method("post"),
				EncType("multipart/form-data"),

				FieldSet(
					Legend(Text("Upload")),
					Input(
						ID("upload"),
						Name("upload"),
						Type("file"),
					),
					Span(
						Class("form-help"),
						Text("A zip file with the contents of the site."),
					),
				),

				Div(
					Class("control-group group-right"),
					NavButton("Go back", fmt.Sprintf("/site/%s/", siteName)),
					Input(
						Type("submit"),
						Value("Submit"),
					),
				),
			),
		}),
	)
}