diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000..c937561 --- /dev/null +++ b/templates/404.html @@ -0,0 +1,10 @@ +{{template "base.html" .}} +{{define "content"}} +
+
+ +
+
+{{end}} diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..32d6f6b --- /dev/null +++ b/templates/base.html @@ -0,0 +1,24 @@ + + + + + + {{.Title}} + + + + + + + +
+
+
+ {{block "content" .}} + Whoops, you should not see this... + {{end}} +
+
+
+ + \ No newline at end of file diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..35776a4 --- /dev/null +++ b/templates/login.html @@ -0,0 +1,48 @@ +{{template "base.html" .}} +{{define "content"}} +
+
+

+ ClusterCockpit Login +

+
+
+
+
+ {{if .Login.Error}} + + {{end}} + + {{if .Login.Info}} + + {{end}} +
+
+
+
+
+
+ + +
+
+ + +
+ +
+
+
+
+
+
+
+ +
+
+
+{{end}} diff --git a/templates/templates.go b/templates/templates.go new file mode 100644 index 0000000..c1c7c07 --- /dev/null +++ b/templates/templates.go @@ -0,0 +1,29 @@ +package templates + +import ( + "html/template" + "log" + "net/http" +) + +var templates *template.Template + +type Page struct { + Title string + Login *LoginPage +} + +type LoginPage struct { + Error string + Info string +} + +func init() { + templates = template.Must(template.ParseGlob("./templates/*.html")) +} + +func Render(rw http.ResponseWriter, r *http.Request, name string, page *Page) { + if err := templates.ExecuteTemplate(rw, name, page); err != nil { + log.Printf("template error: %s\n", err.Error()) + } +}