diff options
author | Alexander NeonXP Kiryukhin <i@neonxp.ru> | 2024-07-29 02:47:35 +0300 |
---|---|---|
committer | Alexander NeonXP Kiryukhin <i@neonxp.ru> | 2024-07-29 02:47:35 +0300 |
commit | 96e2ce2e9d363a6296f9411ecb00168520258874 (patch) | |
tree | 09aa7fffe10eab84ae0edd39e570355984ba0148 /views/topics.templ | |
parent | 12ed72e4e1da181a6c87319a50d3b4142788b4c0 (diff) |
Отказ от echo
Diffstat (limited to 'views/topics.templ')
-rw-r--r-- | views/topics.templ | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/views/topics.templ b/views/topics.templ new file mode 100644 index 0000000..52011e5 --- /dev/null +++ b/views/topics.templ @@ -0,0 +1,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> +}
\ No newline at end of file |