all repos — well-binge @ 534e397c0e1c59345f80638baeb559dca6c2de86

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 class="habits-title">
 9        <h3>Positive habits</h3>
10        <a href="/new-positive" class="button">+ Add</a>
11    </div>
12    <table>
13        <thead>
14            <tr>
15                <td>Name</td>
16                <td>Last time</td>
17                <td>Actions</td>
18            </tr>
19        </thead>
20        <tbody>
21            {{ range .Positive }}
22            <a href="/habits/{{ .ID }}">
23                <tr class="{{.Class}}">
24                    <td>{{ .Name }}</td>
25                    <td><i>{{ .LastAck }}</i></td>
26                    <td class="actions">
27                        <form action="/ack/{{ .ID }}" method="post">
28                            <input type="submit" value="Ack" />
29                        </form>
30
31                        <form action="/habits/{{ .ID }}" method="get">
32                            <input type="submit" value="Edit" />
33                        </form>
34                    </td>
35                </tr>
36            </a>
37            {{ end }}
38        </tbody>
39        <tfoot></tfoot>
40    </table>
41
42    <div class="habits-title">
43        <h3>Negative habits</h3>
44        <a href="/new-negative" class="button">+ Add</a>
45    </div>
46    <table>
47        <thead>
48            <tr>
49                <td>Name</td>
50                <td>Last time</td>
51                <td>Actions</td>
52            </tr>
53        </thead>
54        <tbody>
55            {{ range .Negative }}
56            <tr class="{{.Class}}">
57                <td>{{ .Name }}</td>
58                <td><i>{{ .LastAck }}</i></td>
59                <td class="actions">
60                    <form action="/ack/{{ .ID }}" method="post">
61                        <input type="submit" value="Ack" />
62                    </form>
63
64                    <form action="/habits/{{ .ID }}" method="get">
65                        <input type="submit" value="Edit" />
66                    </form>
67                </td>
68            </tr>
69            {{ end }}
70        </tbody>
71        <tfoot></tfoot>
72    </table>
73{{end}}