diff --git a/pkg/app/pagewriter/error.html b/pkg/app/pagewriter/error.html new file mode 100644 index 00000000..56306227 --- /dev/null +++ b/pkg/app/pagewriter/error.html @@ -0,0 +1,100 @@ +{{define "error.html"}} + + + + + + {{.StatusCode}} {{.Title}} + + + + + + + + +
+
+
{{.StatusCode}}
+
+

{{.Title}}

+
+ + {{ if .Message }} +
+
+

More Info

+ + + +
+ +
+ {{ end }} + + {{ if .Redirect }} +
+ +
+
+
+ +
+
+
+
+ + +
+
+
+ {{ end }} + +
+
+ + + + + +{{end}} diff --git a/pkg/app/pagewriter/sign_in.html b/pkg/app/pagewriter/sign_in.html new file mode 100644 index 00000000..e148c2b5 --- /dev/null +++ b/pkg/app/pagewriter/sign_in.html @@ -0,0 +1,89 @@ +{{define "sign_in.html"}} + + + + + + Sign In + + + + + + + +
+
+
+ + {{ if .SignInMessage }} +

{{.SignInMessage}}

+ {{ end}} + +
+ + {{ if .CustomLogin }} +
+ +
+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+ + {{ end }} +
+
+
+ + + + + +{{end}} diff --git a/pkg/app/pagewriter/templates.go b/pkg/app/pagewriter/templates.go index fbc107f7..66d24ecc 100644 --- a/pkg/app/pagewriter/templates.go +++ b/pkg/app/pagewriter/templates.go @@ -1,6 +1,9 @@ package pagewriter import ( + // Import embed to allow importing default page templates + _ "embed" + "fmt" "html/template" "os" @@ -13,199 +16,14 @@ import ( const ( errorTemplateName = "error.html" signInTemplateName = "sign_in.html" - - defaultErrorTemplate = `{{define "error.html"}} - - - - - - {{.StatusCode}} {{.Title}} - - - - - - - - -
-
-
{{.StatusCode}}
-
-

{{.Title}}

-
- - {{ if .Message }} -
-
-

More Info

- - - -
- -
- {{ end }} - - {{ if .Redirect }} -
- -
-
-
- -
-
-
-
- - -
-
-
- {{ end }} - -
-
- - - - - -{{end}}` - - defaultSignInTemplate = `{{define "sign_in.html"}} - - - - - - Sign In - - - - - - - -
-
-
- - {{ if .SignInMessage }} -

{{.SignInMessage}}

- {{ end}} - -
- - {{ if .CustomLogin }} -
- -
- - -
- -
- -
-
- -
- -
- -
-
- - {{ end }} -
-
-
- - - - - -{{end}}` ) +//go:embed error.html +var defaultErrorTemplate string + +//go:embed sign_in.html +var defaultSignInTemplate string + // loadTemplates adds the Sign In and Error templates from the custom template // directory, or uses the defaults if they do not exist or the custom directory // is not provided.