aboutsummaryrefslogtreecommitdiff
path: root/templates/base.qtpl
blob: 30b084ebfd71f3a56ecf96c687d66260179ed7b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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, isAdmin bool) %}
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>img | {%= p.Title() %}</title> 
        <link rel="stylesheet" href="/static/main.css">
        <link rel="icon" href="/static/square.svg" sizes="any" type="image/svg+xml">
        <meta name="viewport" content="width=device-width, initial-scale=1" />
    </head>
    <body>
        <nav class="navbar">
            <div class="navbar-start">
                <a href="/fs" class="navbar-item text-size-1">
                    file
                </a>
                <a href="/media" class="navbar-item text-size-1">
                    media
                </a>
                <a href="/album" class="navbar-item text-size-1">
                    album
                </a>
                {% if isAdmin  %}
                <a href="/settings" class="navbar-item text-size-1">
                    settings
                </a>
                {% endif %}
            </div>
        </nav>
        <div class="container is-fullhd">
            {%= 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 %}