{{.Name}}
+Uploaded by {{.UploaderName}}
++
diff --git a/public/css/style-night.css b/public/css/style-night.css index 289d160e..f4ffb023 100644 --- a/public/css/style-night.css +++ b/public/css/style-night.css @@ -123,3 +123,10 @@ a:hover { #mainmenu a.nightswitch { background-image: url(/img/moon.png); } + +/* Force images on description to fit width */ +#description img { + display: block; + max-width: 100%; + height: auto; +} diff --git a/public/css/style.css b/public/css/style.css index 02cec37b..e6402444 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -104,7 +104,8 @@ td { .comment-row td:first-of-type { vertical-align: top; - text-align: right; + text-align: left; + color:#bbb; } /* Table style & fixes */ @@ -339,3 +340,10 @@ footer { color: #616161; text-shadow: -1px -1px #999999; } + +/* Force images on description to fit width */ +#description img { + display: block; + max-width: 100%; + height: auto; +} diff --git a/router/modpanel.go b/router/modpanel.go index d48c5b5c..681e72b8 100644 --- a/router/modpanel.go +++ b/router/modpanel.go @@ -3,6 +3,7 @@ package router import ( + "fmt" "html" "html/template" "net/http" @@ -10,6 +11,7 @@ import ( "strconv" "github.com/ewhal/nyaa/model" + "github.com/ewhal/nyaa/service" "github.com/ewhal/nyaa/service/comment" "github.com/ewhal/nyaa/service/report" "github.com/ewhal/nyaa/service/torrent" @@ -50,6 +52,7 @@ func IndexModPanel(w http.ResponseWriter, r *http.Request) { users, _ := userService.RetrieveUsersForAdmin(offset, 0) comments, _ := commentService.GetAllComments(offset, 0, "", "") torrentReports, _, _ := reportService.GetAllTorrentReports(offset, 0) + fmt.Println(torrentReports) languages.SetTranslationFromRequest(panelIndex, r, "en-us") htv := PanelIndexVbs{torrents, torrentReports, users, comments, NewSearchForm(), currentUser, r.URL} @@ -246,6 +249,13 @@ func TorrentDeleteModPanel(w http.ResponseWriter, r *http.Request) { if userPermission.HasAdmin(currentUser) { _ = form.NewErrors() _, _ = torrentService.DeleteTorrent(id) + + //delete reports of torrent + whereParams := serviceBase.CreateWhereParams("torrent_id = ?", id) + reports, _, _ := reportService.GetTorrentReportsOrderBy(&whereParams, "", 0, 0) + for _, report := range reports { + reportService.DeleteTorrentReport(report.ID) + } url, _ := Router.Get("mod_tlist").URL() http.Redirect(w, r, url.String()+"?deleted", http.StatusSeeOther) } else { diff --git a/router/templateVariables.go b/router/templateVariables.go index c1907ca6..20d852f5 100644 --- a/router/templateVariables.go +++ b/router/templateVariables.go @@ -59,6 +59,7 @@ type UserProfileEditVariables struct { UserForm userForms.UserForm FormErrors map[string][]string FormInfos map[string][]string + Languages map[string]string Search SearchForm Navigation Navigation User *model.User diff --git a/router/userHandler.go b/router/userHandler.go index 2e74b855..67a53d7b 100755 --- a/router/userHandler.go +++ b/router/userHandler.go @@ -115,7 +115,8 @@ func UserDetailsHandler(w http.ResponseWriter, r *http.Request) { languages.SetTranslationFromRequest(viewProfileEditTemplate, r, "en-us") searchForm := NewSearchForm() searchForm.HideAdvancedSearch = true - htv := UserProfileEditVariables{&userProfile, b, form.NewErrors(), form.NewInfos(), searchForm, Navigation{}, currentUser, r.URL, mux.CurrentRoute(r)} + availableLanguages := languages.GetAvailableLanguages() + htv := UserProfileEditVariables{&userProfile, b, form.NewErrors(), form.NewInfos(), availableLanguages, searchForm, Navigation{}, currentUser, r.URL, mux.CurrentRoute(r)} err := viewProfileEditTemplate.ExecuteTemplate(w, "index.html", htv) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -158,7 +159,8 @@ func UserProfileFormHandler(w http.ResponseWriter, r *http.Request) { } } } - htv := UserProfileEditVariables{&userProfile, b, err, infos, NewSearchForm(), Navigation{}, currentUser, r.URL, mux.CurrentRoute(r)} + availableLanguages := languages.GetAvailableLanguages() + htv := UserProfileEditVariables{&userProfile, b, err, infos, availableLanguages, NewSearchForm(), Navigation{}, currentUser, r.URL, mux.CurrentRoute(r)} errorTmpl := viewProfileEditTemplate.ExecuteTemplate(w, "index.html", htv) if errorTmpl != nil { http.Error(w, errorTmpl.Error(), http.StatusInternalServerError) diff --git a/service/report/report.go b/service/report/report.go index caf2e958..9b640625 100644 --- a/service/report/report.go +++ b/service/report/report.go @@ -19,7 +19,7 @@ func CreateTorrentReport(torrentReport model.TorrentReport) error { return nil } -func DeleteTorrentReport(id int) (error, int) { +func DeleteTorrentReport(id uint) (error, int) { var torrentReport model.TorrentReport if db.ORM.First(&torrentReport, id).RecordNotFound() { return errors.New("Trying to delete a torrent report that does not exists."), http.StatusNotFound diff --git a/templates/_profile_edit.html b/templates/_profile_edit.html index a3496f45..c5198f00 100644 --- a/templates/_profile_edit.html +++ b/templates/_profile_edit.html @@ -23,7 +23,10 @@
{{T "name"}} | -- {{.Name}} - - | -
{{T "hash"}} | -{{.Hash}} | -
{{T "date"}} | -{{.Date}} | -
{{T "size"}} | -{{.Filesize}} | -
Uploader | -- {{.UploaderName}} - {{if ne .OldUploader ""}} - ({{.OldUploader}}) - {{end}} - | - {{if ne .WebsiteLink ""}} -
{{T "Link"}} | -{{.WebsiteLink}} | -
{{T "links"}} | -
-
- Download!
-
-
-
- Torrent file
-
-
- Report!
-
+
+ {{with .Torrent}}
+ +
+
+
+
+
+
+
+ {{.Name}}+
+
+
+ Uploaded by {{.UploaderName}}++
+
+
+ Download!
+
+ {{if ne .TorrentLink ""}}
+
+ Torrent file
+
+
+ Report!
+ {{end}}
{{ if HasAdmin $.User}}
{{ T "delete" }}
{{end}}
- |
-
{{T "description"}} | -{{.Description}} | -
- | - |
{{T "comments"}} | -- |
- {{$index}} {{.Username}} - | -{{.Content}} | -
{{.Hash}}
+{{.Date}}
+{{.Filesize}}
+