all repos — well-binge @ main

Create positive, recurring habits.

templates/habits.tmpl (view raw)

 1{{ extends "base.tmpl" }}
 2
 3{{define "title" -}}Habits - {{end}}
 4
 5{{define "content" -}}
 6	<h1>Welcome, <i>{{.User.Username}}</i>!</h1> 
 7    <a href="/logout">← Logout</a><br />
 8    <div style="margin-top:20px;"></div>
 9    <div class="habits-title">
10        <h3>Positive habits</h3>
11        <a href="/new-positive" class="button">+ Add</a>
12    </div>
13    <table>
14        <thead>
15            <tr>
16                <td>Name</td>
17                <td>Last time</td>
18                <td>Actions</td>
19            </tr>
20        </thead>
21        <tbody>
22            {{ range .Positive }}
23            <a href="/habits/{{ .ID }}">
24                <tr class="{{.Class}}">
25                    <td>{{ .Name }}</td>
26                    <td><i>{{ .LastAck }}</i></td>
27                    <td class="actions">
28                        {{ if not .Disabled }}
29                        <form action="/ack/{{ .ID }}" method="post">
30                            <input type="submit" value="Ack" />
31                        </form>
32                        {{ end }}
33                        <form action="/habits/{{ .ID }}" method="get">
34                            <input type="submit" value="Edit" />
35                        </form>
36                    </td>
37                </tr>
38            </a>
39            {{ end }}
40        </tbody>
41        <tfoot></tfoot>
42    </table>
43
44    <div class="habits-title">
45        <h3>Negative habits</h3>
46        <a href="/new-negative" class="button">+ Add</a>
47    </div>
48    <table>
49        <thead>
50            <tr>
51                <td>Name</td>
52                <td>Last time</td>
53                <td>Actions</td>
54            </tr>
55        </thead>
56        <tbody>
57            {{ range .Negative }}
58            <tr class="{{.Class}}">
59                <td>{{ .Name }}</td>
60                <td><i>{{ .LastAck }}</i></td>
61                <td class="actions">
62                    <form action="/ack/{{ .ID }}" method="post">
63                        <input type="submit" value="Ack" />
64                    </form>
65
66                    <form action="/habits/{{ .ID }}" method="get">
67                        <input type="submit" value="Edit" />
68                    </form>
69                </td>
70            </tr>
71            {{ end }}
72        </tbody>
73        <tfoot></tfoot>
74    </table>
75{{end}}