aboutsummaryrefslogtreecommitdiffstats
path: root/web/command/html/delete.go
blob: 54764c329b767d379c59922d01abde65357eccc4 (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
55
56
57
58
59
package html

import (
	"fmt"

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

func DeletePage(success, err string, siteName string) Node {
	return Page("Delete "+siteName,
		H1(Text("Delete "+siteName)),

		If(success != "", Group{
			AlertSuccess(success),
			Div(
				Class("control-group group-right"),
				NavButton("OK", "/"),
			),
		}),

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

			Form(
				Method("post"),

				FieldSet(
					Legend(Text("Delete")),
					Span(
						Input(
							ID("delete"),
							Name("delete"),
							Type("checkbox"),
						),
						Label(
							For("delete"),
							Text(fmt.Sprintf("Really delete site %s?", siteName)),
						),
					),
					Span(
						Class("form-help"),
						Text("Check the box to confirm deletion. Data on disk (including all site versions) will be deleted. This action is irreversible."),
					),
				),

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