lens @ 417041797674319485bea96cb38489670ff3b2ef

 1This is a base page template. All the other template pages implement this interface.
 2
 3{% import "strconv" %}
 4
 5{% interface
 6Page {
 7	Title()
 8	Content()
 9    Script()
10}
11
12%}
13
14{% code func FromUInttoString(u *uint) string {
15        if u != nil {
16            return strconv.FormatUint(uint64(*u), 10)
17        }
18        return ""
19    }
20%}
21
22
23Page prints a page implementing Page interface.
24{% func PageTemplate(p Page, isAdmin bool) %}
25<html lang="en">
26    <head>
27        <meta charset="utf-8">
28        <title>img | {%= p.Title() %}</title> 
29        <link rel="stylesheet" href="/static/main.css">
30        <link rel="icon" href="/static/square.svg" sizes="any" type="image/svg+xml">
31        <meta name="viewport" content="width=device-width, initial-scale=1" />
32    </head>
33    <body>
34        <nav class="navbar">
35            <div class="navbar-start">
36                <a href="/fs" class="navbar-item text-size-1">
37                    file
38                </a>
39                <a href="/media" class="navbar-item text-size-1">
40                    media
41                </a>
42                <a href="/album" class="navbar-item text-size-1">
43                    album
44                </a>
45                {% if isAdmin  %}
46                <a href="/settings" class="navbar-item text-size-1">
47                    settings
48                </a>
49                {% endif %}
50            </div>
51        </nav>
52        <div class="container is-fullhd">
53            {%= p.Content() %}
54        </div>
55    </body>
56    {%= p.Script() %}
57</html>
58{% endfunc %}
59
60{% code type BasePage struct {} %}
61{% func (p *BasePage) Title() %}Empty{% endfunc %}
62{% func (p *BasePage) Body() %}HelloWorld{% endfunc %}
63{% func (p *BasePage) Script() %}{% endfunc %}