aboutsummaryrefslogtreecommitdiff
path: root/templates/base.qtpl
diff options
context:
space:
mode:
Diffstat (limited to 'templates/base.qtpl')
-rw-r--r--templates/base.qtpl44
1 files changed, 44 insertions, 0 deletions
diff --git a/templates/base.qtpl b/templates/base.qtpl
new file mode 100644
index 0000000..1683981
--- /dev/null
+++ b/templates/base.qtpl
@@ -0,0 +1,44 @@
+This is a base page template. All the other template pages implement this interface.
+
+{% import "strconv" %}
+
+{% interface
+Page {
+ Title()
+ Content()
+ Script()
+}
+
+%}
+
+{% code func FromUInttoString(u *uint) string {
+ if u != nil {
+ return strconv.FormatUint(uint64(*u), 10)
+ }
+ return ""
+ }
+%}
+
+
+Page prints a page implementing Page interface.
+{% func PageTemplate(p Page) %}
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>img | {%= p.Title() %}</title>
+ <link rel="stylesheet" href="/static/main.css">
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ </head>
+ <body>
+ <div>
+ {%= p.Content() %}
+ </div>
+ </body>
+ {%= p.Script() %}
+</html>
+{% endfunc %}
+
+{% code type BasePage struct {} %}
+{% func (p *BasePage) Title() %}Empty{% endfunc %}
+{% func (p *BasePage) Body() %}HelloWorld{% endfunc %}
+{% func (p *BasePage) Script() %}{% endfunc %}