now the torrent list works
Cette révision appartient à :
Parent
c5da59234f
révision
3764919308
3 fichiers modifiés avec 7 ajouts et 5 suppressions
|
@ -7,6 +7,7 @@ import (
|
|||
"net/http"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"fmt"
|
||||
|
||||
"github.com/ewhal/nyaa/service/comment"
|
||||
"github.com/ewhal/nyaa/service/torrent"
|
||||
|
@ -48,10 +49,11 @@ func TorrentsListPanel(w http.ResponseWriter, r *http.Request) {
|
|||
page, _ := strconv.Atoi(r.URL.Query().Get("p"))
|
||||
offset := 100
|
||||
|
||||
torrents, _, _ := torrentService.GetAllTorrents(page*offset, offset)
|
||||
torrents, _, _ := torrentService.GetAllTorrents(offset, page * offset)
|
||||
languages.SetTranslationFromRequest(panelTorrentList, r, "en-us")
|
||||
htv := PanelTorrentListVbs{torrents}
|
||||
_ = panelTorrentList.ExecuteTemplate(w, "admin_index.html", htv)
|
||||
err := panelTorrentList.ExecuteTemplate(w, "admin_index.html", htv)
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
func UsersListPanel(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
@ -8,6 +8,6 @@ import (
|
|||
|
||||
func GetAllComments(limit int, offset int) []model.Comment{
|
||||
var comments []model.Comment
|
||||
db.ORM.Limit(limit).Offset(offset).Preload("Uploader").Find(&comments)
|
||||
db.ORM.Limit(limit).Offset(offset).Preload("User").Find(&comments)
|
||||
return comments
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<table>
|
||||
{{ range .Torrents}}
|
||||
|
||||
<tr><td><a href="{{ genRoute "mod_tedit" }}?id={{.Id}}">{{ .Name }}</a></td><td><a href="{{ genRoute "mod_tdelete" }}?id{{ .Id }}">Delete</a></td></tr>
|
||||
<tr><td><a href="{{ genRoute "mod_tedit" }}?id={{.ID}}">{{ .Name }}</a></td><td><a href="{{ genRoute "mod_tdelete" }}?id{{ .ID }}">Delete</a></td></tr>
|
||||
{{end}}
|
||||
</table>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
|
Référencer dans un nouveau ticket