2017-05-10 08:07:28 +02:00
{{define "title"}}{{.Torrent.Name}}{{end}}
{{define "contclass"}}cont-view{{end}}
{{define "content"}}
2017-05-10 21:46:34 +02:00
< div class = "blockBody" >
{{with .Torrent}}
< hr >
< div class = "content" style = "margin-bottom: 2em;" >
< div class = "row" >
< div class = "col-md-12" >
< h3 style = "word-break:break-all" { { if eq . Status 2 } } class = "remake" { { end } } { { if eq . Status 3 } } class = "trusted" { { end } } { { if eq . Status 4 } } class = "aplus" { { end } } > {{.Name}}< / h3 >
2017-05-11 22:54:42 +02:00
< / div >
< / div >
< div class = "row" >
< div class = "col-md-8" >
< div class = "row" id = "description" >
< div class = "col-md-12" >
< div style = "float: left;" >
< div class = "uploaded_by" >
2017-05-10 21:46:34 +02:00
< img style = "float:left; margin-right: 1em;" src = "{{$.URL.Parse (printf " / img / torrents / % s . png " . SubCategory ) } } " >
< h4 > Uploaded by < a href = "{{$.URL.Parse (printf " / user / % d / - " . UploaderID ) } } " > {{.UploaderName}}< / a > < / h4 >
< / div >
< / div >
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-10 21:46:34 +02:00
< span class = "glyphicon glyphicon-magnet" aria-hidden = "true" > < / span > Download!
< / 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-10 21:46:34 +02:00
< span class = "glyphicon glyphicon-floppy-save" aria-hidden = "true" > < / span > Torrent file
< / 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-10 21:46:34 +02:00
< span class = "glyphicon glyphicon-remove" aria-hidden = "true" > < / span > Report!
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-11 00:40:02 +02:00
< a href = "{{ genRoute " mod_tdelete " } } ? id = {{ . ID } } " class = "btn btn-danger btn-lg" onclick = "if (!confirm('Are you sure?')) return false;" > < i class = "glyphicon glyphicon-trash" > < / 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 >
< div style = "word-break:break-all;" > {{.Description}}< / div >
2017-05-10 21:46:34 +02:00
< / div >
< / div >
< / div >
< div class = "col-md-4" >
< h4 > {{T "hash"}}< / h4 >
2017-05-11 01:46:50 +02:00
< p class = "torrent-hash" > {{.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 ""}}
< h4 > {{T "Link"}}< / h4 >
< p > < a href = "{{.WebsiteLink}}" > {{.WebsiteLink}}< / a > < / p >
< hr >
{{end}}
2017-05-11 03:00:57 +02:00
< div class = "row" >
< div class = "col-md-4" > {{T "seeders"}}< / div >
< div class = "col-md-4" > {{T "leechers"}}< / div >
< div class = "col-md-4" > {{T "completed"}}< / div >
< / div >
< div class = "row" >
< 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 >
< 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 >
< / div >
2017-05-11 01:31:10 +02:00
< hr >
2017-05-10 21:46:34 +02:00
< / div >
< / div >
< div class = "row" id = "comments" >
< div class = "col-md-12" >
< h4 > {{T "comments"}}< / h4 >
{{ range $index, $element := .Comments }}
< div class = "row comment-row" id = "comment_{{$index}}" >
2017-05-11 00:54:07 +02:00
< div class = "col-md-2" >
2017-05-10 23:53:30 +02:00
{{if eq .UserID -1}}
2017-05-11 00:54:07 +02:00
< a href = "#comment_{{$index}}" > {{$index}}< / a >
{{.Username}}
2017-05-10 23:53:30 +02:00
{{else}}
2017-05-11 00:54:07 +02:00
< a href = "#comment_{{$index}}" > {{$index}}< / a >
< a href = "{{$.URL.Parse (printf " / user / % d / - " . UserID ) } } " > {{.Username}}< / a >
2017-05-10 23:53:30 +02:00
{{end}}
2017-05-10 21:46:34 +02:00
< / div >
2017-05-11 11:45:13 +02:00
< div class = "col-md-1 date-short comment-date" >
2017-05-11 13:15:52 +02:00
{{ .Date.Format ( Ts "date_format" ) }}
2017-05-11 11:16:28 +02:00
{{/* output: "2017-05-01 15:30"
2017-05-11 11:00:16 +02:00
Went with "Year-Month-Day" because it's the most unambiguous.
2017-05-11 11:16:28 +02:00
If you want it to be determined by where you're from, be my guest. */}}
2017-05-11 00:54:07 +02:00
< / div >
2017-05-10 21:46:34 +02:00
< div class = "col-md-8" >
{{.Content}}
< / div >
< / div >
{{end}}
< / 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 >
{{with .Captcha}} {{block "captcha" .}}{{end}} {{end}}
2017-05-11 00:40:02 +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 >
{{with .Torrent}}
< 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-10 08:07:28 +02:00
< h4 class = "modal-title" > Report Torrent #{{.ID}}< / h4 >
2017-05-10 02:51:05 +02:00
< / div >
< div class = "modal-body" >
< b > Report type:< / b >
2017-05-10 10:17:21 +02:00
< form method = "post" action = "/report/{{.ID}}" >
< input type = "radio" name = "report_type" value = "illegal" > Illegal content < br / >
< input type = "radio" name = "report_type" value = "spam" > Spam / garbage
2017-05-10 21:46:34 +02:00
{{end}}
{{with .Captcha}} {{block "captcha" .}}{{end}} {{end}}
< button type = "submit" class = "btn btn-default" > Report!< / 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}}