From adbfef80ca6168cf91c3ffa3524e5eddd81ab85f Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 6 May 2017 22:32:50 +0200 Subject: [PATCH] Show category image on torrent view page --- service/torrent/torrent.go | 4 ++-- templates/view.html | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/service/torrent/torrent.go b/service/torrent/torrent.go index c057d9c6..2e35123b 100644 --- a/service/torrent/torrent.go +++ b/service/torrent/torrent.go @@ -43,7 +43,7 @@ func GetFeeds() []model.Feed { func GetTorrentById(id string) (model.Torrents, error) { var torrent model.Torrents - if db.ORM.Where("torrent_id = ?", id).Find(&torrent).RecordNotFound() { + if db.ORM.Where("torrent_id = ?", id).Preload("Sub_Categories").Find(&torrent).RecordNotFound() { return torrent, errors.New("Article is not found.") } @@ -124,4 +124,4 @@ func CreateWhereParams(conditions string, params ...string) WhereParams { } return whereParams -} \ No newline at end of file +} diff --git a/templates/view.html b/templates/view.html index 4fd9eac7..0a6bdd6b 100644 --- a/templates/view.html +++ b/templates/view.html @@ -9,7 +9,10 @@ {{if eq .Status 3}}class="trusted"{{end}} {{if eq .Status 4}}class="aplus"{{end}}> Name - {{.Name}} + + {{.Name}} + + Hash