summaryrefslogtreecommitdiff
path: root/templates/index.html
blob: 08d89be911803fb1704c87879a4ed71c5a45747a (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
<!doctype html>
<html lang="de">
<head>
    <title>Lehrerspruch-Wahlplattform</title>
    <link rel="stylesheet" type="text/css" href="/static/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
</head>
<body>
    <script type="text/javascript" src="/static/materialize.min.js"></script>
    <div class="container">
        <h1>Lehrersprüche</h1>
        <div class="divider"></div>
        {% for joke in jokes %}
        <div class="row section valign-wrapper">
            <form class="col s2 row" action="vote" method="post">
                <input type="hidden" name="id" value="{{ joke.id }}">
                <button class="btn{% if joke.reports>0 %}-flat{% endif %} col s12" type="submit" name="vote" value="upvote"><i class="material-icons">thumb_up</i> {{ joke.upvotes }}</button>
                <button class="btn{% if joke.reports>0 %}-flat{% endif %} col s12" type="submit" name="vote" value="downvote"><i class="material-icons">thumb_down</i> {{ joke.downvotes }}</button>
            </form>
            <div class="valign col s8 {% if joke.reports>0 %}grey-text{% endif %}">
                {{ joke.text|safe }}
            </div>
            <form class="col s2" action="report" method="post">
                <input type="hidden" name="id" value="{{ joke.id }}">
                <button class="btn-flat row" type="submit">
                    <i class="material-icons col s6">report_problem</i>
                    <span class="red-text col s6">{% if joke.reports>0 %}{{ joke.reports }}{% endif %}</span>
                </button>
            </form>
        </div>
        <div class="divider"></div>
        {% endfor %}
        <div class="section center">
            <ul class="pagination">
                <li{% if currentpage==0 %} class="disabled"{% endif %}><a href="/page/{{ currentpage-1 }}"><i class="material-icons">chevron_left</i></a></li>
                {% for page in pages %}
                <li{% if currentpage==loop.index0 %} class="active"{% endif %}><a href="/page/{{ loop.index0 }}">{{ loop.index }}</a></li>
                {% endfor %}
                <li{% if currentpage==loop.length-1 %} class="disabled"{% endif %}><a href="/page/{{ currentpage+1 }}"><i class="material-icons">chevron_right</i></a></li>
            </ul>
        </div>
        <div class="divider"></div>
        <div class="section">
            <form action="submit" method="post">
                <div class="row valign-wrapper">
                    <div class="col s8 input-field">
                        <label for="text">Neuen Spruch hinzufügen</label>
                        <textarea class="materialize-textarea" name="text"></textarea>
                    </div>
                    <div class="col s4 valign">
                        <input type="submit" class="btn" value="hinzufügen">
                    </div>
                </div>
            </form>
        </div>
    </div>
</body>
</html>