Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Merge pull request #261 from azhao12345/fix-chit

Fix shit
Cette révision appartient à :
PantsuDev 2017-05-10 16:02:37 +10:00 révisé par GitHub
révision 3dea7da0a8
9 fichiers modifiés avec 42 ajouts et 15 suppressions

Voir le fichier

@ -23,7 +23,7 @@ type User struct {
Liked []User // Don't work `gorm:"foreignkey:follower_id;associationforeignkey:user_id;many2many:user_follows"`
MD5 string `json:"md5"` // Hash of email address, used for Gravatar
Torrents []Torrent `gorm:"ForeignKey:UploaderId"`
Torrents []Torrent `gorm:"ForeignKey:UploaderID"`
}
type PublicUser struct {

Voir le fichier

@ -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) {
@ -60,10 +62,11 @@ func UsersListPanel(w http.ResponseWriter, r *http.Request) {
page, _ := strconv.Atoi(r.URL.Query().Get("p"))
offset := 100
users := userService.RetrieveUsersForAdmin(page*offset, offset)
users := userService.RetrieveUsersForAdmin(offset, page*offset)
languages.SetTranslationFromRequest(panelUserList, r, "en-us")
htv := PanelUserListVbs{users}
_ = panelUserList.ExecuteTemplate(w, "admin_index.html", htv)
err := panelUserList.ExecuteTemplate(w, "admin_index.html", htv)
fmt.Println(err)
}
}
func CommentsListPanel(w http.ResponseWriter, r *http.Request) {
@ -72,10 +75,11 @@ func CommentsListPanel(w http.ResponseWriter, r *http.Request) {
page, _ := strconv.Atoi(r.URL.Query().Get("p"))
offset := 100
comments := commentService.GetAllComments(page*offset, offset)
comments := commentService.GetAllComments(offset, page * offset)
languages.SetTranslationFromRequest(panelCommentList, r, "en-us")
htv := PanelCommentListVbs{comments}
_ = panelCommentList.ExecuteTemplate(w, "admin_index.html", htv)
err := panelCommentList.ExecuteTemplate(w, "admin_index.html", htv)
fmt.Println(err)
}
}
@ -86,7 +90,8 @@ func TorrentEditModPanel(w http.ResponseWriter, r *http.Request) {
torrent, _ := torrentService.GetTorrentById(id)
languages.SetTranslationFromRequest(panelTorrentEd, r, "en-us")
htv := PanelTorrentEdVbs{torrent}
_ = panelTorrentEd.ExecuteTemplate(w, "admin_index.html", htv)
err := panelTorrentEd.ExecuteTemplate(w, "admin_index.html", htv)
fmt.Println(err)
}
}

Voir le fichier

@ -85,6 +85,8 @@ func init() {
Router.Handle("/mod/torrents", gzipTorrentsListPanel).Name("mod_tlist")
Router.Handle("/mod/users", gzipUsersListPanel).Name("mod_ulist")
Router.Handle("/mod/comments", gzipCommentsListPanel).Name("mod_clist")
Router.Handle("/mod/comments", gzipCommentsListPanel).Name("mod_cedit")
Router.Handle("/mod/comments", gzipCommentsListPanel).Name("mod_cdelete")
Router.Handle("/mod/torrent/", gzipTorrentEditModPanel).Name("mod_tedit")
Router.Handle("/mod/torrent/", gzipTorrentPostEditModPanel).Name("mod_ptedit")
Router.Handle("/mod/torrent/delete", gzipCommentDeleteModPanel).Name("mod_tdelete")

Voir le fichier

@ -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
}

Voir le fichier

@ -1,8 +1,8 @@
{{block "content"}}
{{define "content"}}
<table>
{{ range .Comments}}
<tr><td><a href="{{ genRoute "mod_cedit" }}?id={{.Id}}">{{ .Content }}</a></td><td><a href="{{ genRoute "mod_cdelete" }}?id{{ .Id }}">Delete</a></td></tr>
<tr><td><a href="{{ genRoute "mod_cedit" }}?id={{.ID}}">{{ .Content }}</a></td><td><a href="{{ genRoute "mod_cdelete" }}?id{{ .ID }}">Delete</a></td></tr>
{{end}}
</table>
{{end}}
{{end}}

Voir le fichier

@ -0,0 +1,7 @@
{{define "content"}}
nigga this just be some links
<a href="/mod/torrents">torrent list</a>
<a href="/mod/users">user list </a>
<a href="/mod/comments">comments list</a>
{{end}}

Voir le fichier

@ -0,0 +1,5 @@
{{define "content"}}
<h2>temporary not available</h2>
{{end}}

Voir le fichier

@ -1,8 +1,8 @@
{{block "content"}}
{{define "content"}}
<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}}

Voir le fichier

@ -0,0 +1,8 @@
{{define "content"}}
<table>
{{ range .Users}}
<tr><td><a href="{{ genRoute "mod_tedit" }}?id={{.ID}}">{{ .Username }}</a></td><td><a href="{{ genRoute "mod_tdelete" }}?id{{ .ID }}">Delete</a></td></tr>
{{end}}
</table>
{{end}}