aboutsummaryrefslogtreecommitdiff
path: root/views/topics.templ
blob: 52011e573df0622174619ddf3a4aca10ba76621f (plain) (blame)
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
package views

import (
	"fmt"
	"gitrepo.ru/neonxp/gorum/models"
)

templ Topics(topics []*models.Topic) {
	@Layout() {
		<table>
			<thead>
				<tr>
					<th>Тема</th>
					<th>Тем/Ответов</th>
					<th>Дата</th>
					<th>Автор</th>
				</tr>
			</thead>
			<tbody>
				for _, n := range topics {
					@Topic(n)
				}
			</tbody>
		</table>
	}
}

templ Topic(n *models.Topic) {
	<tr>
		<td>
			<a href={ templ.URL(fmt.Sprintf("/t/%d", n.ID)) }>{ n.Topic }</a>
		</td>
		<td>
			// { strconv.Itoa(len(n.Children)) }
		</td>
		<td>
			{ n.CreatedAt.Format("15:04 02.01.2006") }
		</td>
		<td>
			if n.Author != nil {
				{ n.Author.Username }
			}
		</td>
	</tr>
}