diff options
Diffstat (limited to 'web/command/html')
| -rw-r--r-- | web/command/html/authenticate.go | 43 | ||||
| -rw-r--r-- | web/command/html/create.go | 2 | ||||
| -rw-r--r-- | web/command/html/home.go | 3 | ||||
| -rw-r--r-- | web/command/html/host.go | 52 | ||||
| -rw-r--r-- | web/command/html/site.go | 1 |
5 files changed, 99 insertions, 2 deletions
diff --git a/web/command/html/authenticate.go b/web/command/html/authenticate.go new file mode 100644 index 0000000..27a2321 --- /dev/null +++ b/web/command/html/authenticate.go @@ -0,0 +1,43 @@ +package html + +import ( + . "maragu.dev/gomponents" + . "maragu.dev/gomponents/html" +) + +func AuthenticatePage(err string) Node { + return page("Authenticate", + H1(Text("Welcome to scrapbook")), + + If(err != "", alertError(err)), + + Form( + Action("/authenticate"), + Method("post"), + + FieldSet( + Legend(Text("Authentication")), + Label( + For("token"), + Text("Secret key"), + ), + Input( + ID("token"), + Name("token"), + ), + Span( + Class("form-help"), + Text("Enter the secret key to continue."), + ), + ), + + Div( + Class("control-group group-right"), + Input( + Type("submit"), + Value("Submit"), + ), + ), + ), + ) +} diff --git a/web/command/html/create.go b/web/command/html/create.go index a0b77d1..8b76776 100644 --- a/web/command/html/create.go +++ b/web/command/html/create.go @@ -56,7 +56,7 @@ func CreatePage(success, err string, formValues CreatePageForm) Node { ), Span( Class("form-help"), - Text("The fully qualified domain name for which this site is to be served on."), + Text("The fully qualified domain name for which this site is to be served on. If this site is not to be served by scrapbook, leave blank."), ), ), diff --git a/web/command/html/home.go b/web/command/html/home.go index 490b2b8..b9d585c 100644 --- a/web/command/html/home.go +++ b/web/command/html/home.go @@ -38,7 +38,8 @@ func HomePage(siteIndex *index.SiteIndex) Node { Span( Class("name"), Span(Text(site.Name)), - Span(Text(fmt.Sprintf("on %s", site.SiteConfig.Host))), + If(site.SiteConfig.Host == "", Span(Text("no host"))), + If(site.SiteConfig.Host != "", Span(Text(fmt.Sprintf("on %s", site.SiteConfig.Host)))), ), Span( Class("status"), diff --git a/web/command/html/host.go b/web/command/html/host.go new file mode 100644 index 0000000..36f0e6b --- /dev/null +++ b/web/command/html/host.go @@ -0,0 +1,52 @@ +package html + +import ( + "fmt" + + . "maragu.dev/gomponents" + . "maragu.dev/gomponents/html" +) + +func HostPage(success, err, siteName, hostValue string) Node { + return page("Change host for "+siteName, + H1(Text("Change host for "+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"), + + FieldSet( + Legend(Text("Host")), + Input( + ID("host"), + Name("host"), + Value(hostValue), + ), + Span( + Class("form-help"), + Text("The fully qualified domain name for which this site is to be served on. If this site is not to be served by scrapbook, leave blank."), + ), + ), + + Div( + Class("control-group group-right"), + navButton("Go back", fmt.Sprintf("/site/%s/", siteName)), + Input( + Type("submit"), + Value("Submit"), + ), + ), + ), + }), + ) +} diff --git a/web/command/html/site.go b/web/command/html/site.go index 7616e6b..7da9dc0 100644 --- a/web/command/html/site.go +++ b/web/command/html/site.go @@ -26,6 +26,7 @@ func SitePage(mainConfig *config.MainConfig, site *site.Site) Node { navButton("Upload new version", "upload"), navButton("Set flags", "flags"), + navButton("Change host", "host"), navButton("Delete site", "delete"), ), ), |
