2017-05-10 08:07:28 +02:00
{{define "title"}}{{.Torrent.Name}}{{end}}
2017-05-16 23:17:52 +02:00
{{define "contclass"}}cont-view {{if eq .Torrent.Status 2}}remake{{end}} {{if eq .Torrent.Status 3}}trusted{{end}} {{if eq .Torrent.Status 4}}aplus{{end}}{{end}}
2017-05-10 08:07:28 +02:00
{{define "content"}}
2017-05-10 21:46:34 +02:00
< div class = "blockBody" >
{{with .Torrent}}
< hr >
< div class = "content" style = "margin-bottom: 2em;" >
2017-05-17 16:18:29 +02:00
< div class = "row" >
2017-05-12 05:05:14 +02:00
< div class = "col-md-12" >
2017-05-16 23:17:52 +02:00
< h3 class = "break" > {{.Name}}< / h3 >
2017-05-12 05:05:14 +02:00
< / div >
< / div >
2017-05-11 22:54:42 +02:00
< div class = "row" >
< div class = "col-md-8" >
< div class = "row" id = "description" >
< div class = "col-md-12" >
< div style = "float: left;" >
2017-05-15 11:08:17 +02:00
{{ if Sukebei }}
2017-05-20 01:08:54 +02:00
< img style = "float:left; margin-right: 1em;" src = "{{$.URL.Parse (printf " / img / torrents / sukebei / % s % s . png " . Category . SubCategory ) } } " title = "{{ T (Category_Sukebei .Category .SubCategory) }}" >
2017-05-15 11:08:17 +02:00
{{ else }}
2017-05-20 01:08:54 +02:00
< img style = "float:left; margin-right: 1em;" src = "{{$.URL.Parse (printf " / img / torrents / % s . png " . SubCategory ) } } " title = "{{ T (Category_Nyaa .Category .SubCategory) }}" >
2017-05-15 13:55:16 +02:00
{{ end }}
< br / >
< h4 style = "display:inline-block" >
{{ T "uploaded_by" }} < a href = "{{$.URL.Parse (printf " / user / % d / - " . UploaderID ) } } " > {{.UploaderName}}< / a >
< / h4 >
{{if ne .OldUploader ""}}
< span > ({{.OldUploader}})< / span >
{{end}}
2017-05-14 17:13:45 +02:00
< / div >
2017-05-14 16:49:20 +02:00
2017-05-11 22:54:42 +02:00
< div style = "float:right;" >
< a style = "margin: 5px;" aria-label = "Magnet Button" href = "{{.Magnet}}" type = "button" class = "btn btn-lg btn-success" >
2017-05-14 15:09:44 +02:00
< span class = "glyphicon glyphicon-magnet" aria-hidden = "true" > < / span > {{ T "download_btn" }}
2017-05-10 21:46:34 +02:00
< / a >
{{if ne .TorrentLink ""}}
2017-05-11 22:54:42 +02:00
< a style = "margin: 5px;" aria-label = "Torrent file" href = "{{.TorrentLink}}" type = "button" class = "btn btn-lg btn-success" >
2017-05-14 15:09:44 +02:00
< span class = "glyphicon glyphicon-floppy-save" aria-hidden = "true" > < / span > {{ T "torrent_file" }}
2017-05-10 21:46:34 +02:00
< / a >
2017-05-10 21:44:15 +02:00
{{end}}
2017-05-11 22:54:42 +02:00
< a style = "margin: 5px;" aria-label = "Report button" data-toggle = "modal" data-target = "#reportModal" class = "btn btn-danger btn-sm" >
2017-05-14 17:33:19 +02:00
< span class = "glyphicon glyphicon-remove" aria-hidden = "true" > < / span > {{ T "report_btn" }}
2017-05-10 21:44:15 +02:00
< / a >
2017-05-11 00:08:10 +02:00
2017-05-10 21:46:02 +02:00
{{ if HasAdmin $.User}}
2017-05-14 15:09:44 +02:00
< a href = "{{ genRoute " mod_tdelete " } } ? id = {{ . ID } } " class = "btn btn-danger btn-lg" onclick = "if (!confirm('{{ T " are_you_sure " } } ' ) ) return false ; " > < i class = "glyphicon glyphicon-trash" > < / i > < / a >
2017-05-13 00:31:27 +02:00
< a href = "{{ genRoute " mod_tedit " } } ? id = {{ . ID } } " class = "btn btn-warning btn-lg" > < i class = "glyphicon glyphicon-pencil" > < / i > < / a >
2017-05-10 21:46:02 +02:00
{{end}}
2017-05-11 22:54:42 +02:00
< / div >
< div style = "clear: both;" > < / div >
< / div >
< div class = "col-md-12" >
< h4 > {{T "description"}}< / h4 >
2017-05-12 05:05:14 +02:00
< div class = "break" > {{.Description}}< / div >
2017-05-10 21:46:34 +02:00
< / div >
< / div >
< / div >
< div class = "col-md-4" >
< h4 > {{T "hash"}}< / h4 >
2017-05-13 00:40:38 +02:00
< p class = "torrent-hash break" > {{.Hash}}< / p >
2017-05-10 21:46:34 +02:00
< hr >
< h4 > {{T "date"}}< / h4 >
2017-05-10 22:36:07 +02:00
< p class = "date-full" > {{.Date}}< / p >
2017-05-10 21:46:34 +02:00
< hr >
< h4 > {{T "size"}}< / h4 >
< p > {{.Filesize}}< / p >
< hr >
{{if ne .WebsiteLink ""}}
2017-05-15 16:54:10 +02:00
< h4 > {{T "link"}}< / h4 >
2017-05-10 21:46:34 +02:00
< p > < a href = "{{.WebsiteLink}}" > {{.WebsiteLink}}< / a > < / p >
< hr >
{{end}}
2017-05-18 02:49:48 +02:00
< div class = "row" >
< div class = "col-md-12 col-xs-6" >
2017-05-11 03:00:57 +02:00
< div class = "row" >
2017-05-12 05:05:14 +02:00
< div class = "col-md-4" > {{T "seeders"}}< / div >
< div class = "col-md-4" > {{T "leechers"}}< / div >
< div class = "col-md-4" > {{T "completed"}}< / div >
2017-05-11 03:00:57 +02:00
< / div >
2017-05-18 02:49:48 +02:00
< / div >
< div class = "col-md-12 col-xs-6" >
2017-05-11 03:00:57 +02:00
< div class = "row" >
2017-05-17 17:24:53 +02:00
{{if .LastScrape.IsZero}}
< div class = "col-md-12" align = "center" > {{T "unknown"}}< / div >
{{else}}
2017-05-12 05:05:14 +02:00
< div class = "col-md-4" > {{.Seeders}}< / div >
< div class = "col-md-4" > {{.Leechers}}< / div >
< div class = "col-md-4" > < span class = "completed" style = "" > {{.Completed}}< / span > < / div >
2017-05-17 17:24:53 +02:00
{{end}}
2017-05-18 02:49:48 +02:00
< / div >
< / div >
< div class = "col-md-12 col-xs-12" >
< div class = "row" >
{{if not .LastScrape.IsZero}}
< div class = "col-md-4 col-xs-8" > {{T "last_scraped"}}< / div >
< div class = "col-md-8 col-xs-4 date-short" > {{ formatDateRFC .LastScrape }}< / div >
{{end}}
< / div >
< / div >
< / div >
< div class = "row" >
2017-05-12 05:05:14 +02:00
< div class = "col-md-8" >
< div class = "proSeedBar" >
< div class = "seeds" style = "width: {{ calcWidthSeed .Seeders .Leechers }}%;" > < / div >
< div class = "leechs" style = "width: {{ calcWidthLeech .Seeders .Leechers }}%;" > < / div >
< / div >
< / div >
2017-05-11 03:00:57 +02:00
< / div >
2017-05-11 01:31:10 +02:00
< hr >
2017-05-10 21:46:34 +02:00
< / div >
< / div >
2017-05-14 15:19:19 +02:00
{{ if gt (len .FileList) 0 }}
2017-05-16 03:49:34 +02:00
< div class = "row" >
2017-05-14 15:19:19 +02:00
< div class = "col-md-12" >
2017-05-16 03:49:34 +02:00
< h4 data-toggle = "collapse" data-target = "#files" class = "filelist-control" aria-expanded = "false" > {{T "files"}}< / h4 >
< div class = "table-responsive collapse" id = "files" >
2017-05-14 15:19:19 +02:00
< table class = "table custom-table-hover" >
< tr >
< th class = "col-xs-8" > {{T "filename"}}< / th >
< th class = "col-xs-1" > {{T "size"}}< / th >
< / tr >
{{ range .FileList }}
< tr >
< td > {{.Path}}< / td >
< td > {{.Filesize}}< / td >
< / tr >
{{ end }}
< / table >
< / div >
< / div >
< / div >
{{ end }}
2017-05-10 21:46:34 +02:00
< div class = "row" id = "comments" >
< div class = "col-md-12" >
2017-05-12 05:05:14 +02:00
< div class = "commentList" >
< h4 > {{T "comments"}}< / h4 >
< hr / >
< ul class = "comments" >
{{ range $index, $element := .Comments }}
2017-05-17 13:16:40 +02:00
< li class = "clearfix comment jumptarget" id = "comment_{{inc $index}}" >
2017-05-12 05:05:14 +02:00
{{/* The following line is wrong. Should be using the MD5 User hash but i don't knwo how to access it. */}}
2017-05-13 00:37:37 +02:00
{{/* Changing Gravatar for something else, so it can stay like this. */}}
2017-05-12 05:05:14 +02:00
< img src = "https://www.gravatar.com/avatar/{{ .UserID }}?s=50" class = "avatar" alt = "" >
< div class = "commentBody" >
< div class = "commentData" >
< div class = "row" >
< div class = "col-md-12" >
2017-05-18 01:21:57 +02:00
< i class = "pull-right date-comments comment-date" >
< small >
{{ formatDateRFC .Date }}
{{/* JS will format the date as always */}}
< / small >
< / i >
< div >
{{if eq .UserID -1}}
< a href = "#comment_{{inc $index}}" > #{{inc $index}}< / a > by {{.Username}}
{{else}}
< a href = "#comment_{{inc $index}}" > #{{inc $index}}< / a >
by < span class = "break" > < a href = "{{$.URL.Parse (printf " / user / % d / - " . UserID ) } } " > {{.Username}}< / a > < / span >
{{end}}
2017-05-12 05:05:14 +02:00
< / div >
< / div >
< / div >
< / div >
< div class = "row" >
< div class = "col-sm-12" >
{{.Content}}
< / div >
< / div >
< / div >
< / li >
2017-05-10 23:53:30 +02:00
{{end}}
2017-05-12 05:05:14 +02:00
< / ul >
2017-05-10 21:46:34 +02:00
< / div >
< / div >
< / div >
< / div >
2017-05-10 02:51:05 +02:00
{{end}}
2017-05-10 21:46:34 +02:00
< div class = "row" style = "margin-bottom: 2em;" >
< div class = "col-md-12" >
< form method = "post" >
< div class = "form-group" >
{{/* There should be a better way to use translation on this... */}}
< label for = "comment" > {{ if gt .User.ID 0}} {{T "submit_a_comment_as_username" .User.Username}} {{else}} {{T "submit_a_comment_as_anonymous"}} {{end}}< / label >
< textarea name = "comment" class = "form-control" rows = "5" > < / textarea >
< / div >
2017-05-12 11:58:22 +02:00
{{block "captcha" .}}{{end}}
2017-05-14 17:18:31 +02:00
< button type = "submit" class = "btn btn-success" > {{T "submit" }}< / button >
2017-05-10 21:46:34 +02:00
< / form >
2017-05-10 02:51:05 +02:00
< / div >
2017-05-10 21:46:34 +02:00
< / div >
2017-05-10 02:51:05 +02:00
< / div >
2017-05-13 13:57:57 +02:00
2017-05-10 02:51:05 +02:00
< div id = "reportModal" class = "modal fade" role = "dialog" >
< div class = "modal-dialog" >
<!-- Modal content -->
< div class = "modal-content" >
< div class = "modal-header" >
< button type = "button" class = "close" data-dismiss = "modal" > × < / button >
2017-05-14 15:09:44 +02:00
< h4 class = "modal-title" > {{ T "report_torrent_number" (print .Torrent.ID) }}< / h4 >
2017-05-10 02:51:05 +02:00
< / div >
< div class = "modal-body" >
2017-05-14 15:09:44 +02:00
< b > {{ T "report_type" }}:< / b >
2017-05-13 13:57:57 +02:00
< form method = "post" action = "/report/{{.Torrent.ID}}" >
2017-05-19 09:31:07 +02:00
< input type = "radio" name = "report_type" value = "illegal" id = "illegal" required > < label for = "illegal" > {{ T "illegal_content" }}< / label > < br / >
< input type = "radio" name = "report_type" value = "spam" id = "spam" required > < label for = "spam" > {{ T "spam_garbage" }}< / label > < br / >
< input type = "radio" name = "report_type" value = "wrongcat" id = "wrongcat" required > < label for = "wrongcat" > {{ T "wrong_category" }}< / label > < br / >
< input type = "radio" name = "report_type" value = "dup" id = "dup" required > < label for = "dup" > {{ T "duplicate_deprecated" }}< / label > < br / >
2017-05-12 11:58:22 +02:00
{{block "captcha" .}}{{end}}
2017-05-14 15:09:44 +02:00
< button type = "submit" class = "btn btn-default" > {{ T "report_btn" }}< / button >
2017-05-10 10:17:21 +02:00
< / form > < br / >
2017-05-10 02:51:05 +02:00
< / div >
< div class = "modal-footer" >
< / div >
< / div >
< / div >
< / div >
Consistency, formatting, error checking, cleanup, and a couple bug fixes (#245)
* Checkpoint: it builds
The config, db, model, network, os, and public packages have had some
fixes to glaringly obvious flaws, dead code removed, and stylistic
changes.
* Style changes and old code removal in router
Router needs a lot of work done to its (lack of) error handling.
* Dead code removal and style changes
Now up to util/email/email.go. After I'm finished with the initial sweep
I'll go back and fix error handling and security issues. Then I'll fix
the broken API. Then I'll go through to add documentation and fix code
visibility.
* Finish dead code removal and style changes
Vendored libraries not touched. Everything still needs security fixes
and documentation. There's also one case of broken functionality.
* Fix accidental find-and-replace
* Style, error checking, saftey, bug fix changes
* Redo error checking erased during merge
* Re-add merge-erased fix. Make Safe safe.
2017-05-10 04:34:40 +02:00
{{end}}