Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/templates/view.html
Ramon Dantas 1968d2ae54 Move translation func to template variables (#652)
* Add T field to template variables

* Remove languages.SetTranslationFromRequest

* Add Tfunc on handlers

* Remove T and Ts from template_functions

* Update templates

Change the templates to use the local Tfunc, instead of the global one.
Also changed the signature of the fields on template_variables.go, so that
they return a template.HTML to avoid escaping problems.

* Remove unnecessary variable
2017-05-21 08:38:28 +10:00

223 lignes
12 Kio
HTML
Brut Annotations Historique

Ce fichier contient des caractères Unicode ambigus.

Ce fichier contient des caractères Unicode qui peuvent être confondus avec d'autres caractères. Si vous pensez que c'est intentionnel, vous pouvez ignorer cet avertissement. Utilisez le bouton Échappe pour les dévoiler.

{{define "title"}}{{.Torrent.Name}}{{end}}
{{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}}
{{define "content"}}
<div class="blockBody">
{{with .Torrent}}
<hr>
{{ range (index $.FormErrors "errors")}}
<div class="alert alert-danger"><a class="panel-close close" data-dismiss="alert">×</a><i class="glyphicon glyphicon-exclamation-sign"></i> {{ . }}</div>
{{end}}
{{ range (index $.Infos "infos")}}
<div class="alert alert-info"><a class="panel-close close" data-dismiss="alert">×</a><i class="glyphicon glyphicon-info-sign"></i> {{ . }}</div>
{{end}}
<div class="content" style="margin-bottom: 2em;">
<div class="row">
<div class="col-md-12">
<h3 class="break">{{.Name}}</h3>
</div>
</div>
<div class="row">
<div class="col-md-8">
<div class="row" id="description">
<div class="col-md-12">
<div style="float: left;">
{{ if Sukebei }}
<img style="float:left; margin-right: 1em;" src="{{$.URL.Parse (printf "/img/torrents/sukebei/%s%s.png" .Category .SubCategory) }}" title="{{ call $.T (Category_Sukebei .Category .SubCategory) }}">
<span style="vertical-align:middle;font-size:large;">{{ call $.T (Category_Sukebei .Category .SubCategory) }}</span>
{{ else }}
<img style="float:left; margin-right: 1em;" src="{{$.URL.Parse (printf "/img/torrents/%s.png" .SubCategory) }}" title="{{ call $.T (Category_Nyaa .Category .SubCategory) }}">
<span style="vertical-align:middle;font-size:large;">{{ call $.T (Category_Nyaa .Category .SubCategory) }}</span>
{{ end }}
<br />
<h4 style="display:inline-block">
{{ call $.T "uploaded_by" }} <a href="{{$.URL.Parse (printf "/user/%d/-" .UploaderID) }}">{{.UploaderName}}</a>
</h4>
{{if ne .OldUploader ""}}
<span>({{.OldUploader}})</span>
{{end}}
</div>
<div style="float:right;">
<a style="margin: 5px;" aria-label="Magnet Button" href="{{.Magnet}}" type="button" class="btn btn-lg btn-success">
<span class="glyphicon glyphicon-magnet" aria-hidden="true"></span> {{ call $.T "download_btn" }}
</a>
{{if ne .TorrentLink ""}}
<a style="margin: 5px;" aria-label="Torrent file" href="{{.TorrentLink}}" type="button" class="btn btn-lg btn-success">
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span> {{ call $.T "torrent_file" }}
</a>
{{end}}
<a style="margin: 5px;" aria-label="Report button" data-toggle="modal" data-target="#reportModal" class="btn btn-danger btn-sm">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> {{ call $.T "report_btn" }}
</a>
{{ if HasAdmin $.User}}
<a href="{{ genRoute "mod_tdelete" }}?id={{ .ID }}" class="btn btn-danger btn-lg" onclick="if (!confirm('{{ call $.T "are_you_sure" }}')) return false;"><i class="glyphicon glyphicon-trash"></i></a>
<a href="{{ genRoute "mod_tedit" }}?id={{ .ID }}" class="btn btn-warning btn-lg"><i class="glyphicon glyphicon-pencil"></i></a>
{{end}}
</div>
<div style="clear: both;"></div>
</div>
<div class="col-md-12">
<h4>{{call $.T "description"}}</h4>
<div class="break">{{.Description}}</div>
</div>
</div>
</div>
<div class="col-md-4">
<h4>{{call $.T "hash"}}</h4>
<p class="torrent-hash break">{{.Hash}}</p>
<hr>
<h4>{{call $.T "date"}}</h4>
<p class="date-full">{{.Date}}</p>
<hr>
<h4>{{call $.T "size"}}</h4>
<p>{{.Filesize}}</p>
<hr>
{{if ne .WebsiteLink ""}}
<h4>{{call $.T "link"}}</h4>
<p><a href="{{.WebsiteLink}}">{{.WebsiteLink}}</a></p>
<hr>
{{end}}
<div class="row">
<div class="col-md-12 col-xs-6">
<div class="row">
<div class="col-md-4">{{call $.T "seeders"}}</div>
<div class="col-md-4">{{call $.T "leechers"}}</div>
<div class="col-md-4">{{call $.T "completed"}}</div>
</div>
</div>
<div class="col-md-12 col-xs-6">
<div class="row">
{{if .LastScrape.IsZero}}
<div class="col-md-12" align="center">{{call $.T "unknown"}}</div>
{{else}}
<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>
{{end}}
</div>
</div>
</div>
<div class="row">
<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 class="col-md-12 col-xs-12">
{{if not .LastScrape.IsZero}}
{{call $.T "last_scraped"}}<span class="date-short">{{ formatDateRFC .LastScrape }}</span>
{{end}}
</div>
</div>
<hr>
</div>
</div>
{{ if gt (len .FileList) 0 }}
<div class="row">
<div class="col-md-12">
<h4 data-toggle="collapse" data-target="#files" class="filelist-control" aria-expanded="false">{{call $.T "files"}}</h4>
<div class="table-responsive collapse" id="files">
<table class="table custom-table-hover">
<tr>
<th class="col-xs-8">{{call $.T "filename"}}</th>
<th class="col-xs-1">{{call $.T "size"}}</th>
</tr>
{{ range .FileList }}
<tr>
<td>{{.Path}}</td>
<td>{{.Filesize}}</td>
</tr>
{{ end }}
</table>
</div>
</div>
</div>
{{ end }}
<div class="row" id="comments">
<div class="col-md-12">
<div class="commentList">
<h4>{{call $.T "comments"}}</h4>
<hr/>
<ul class="comments">
{{ range $index, $element := .Comments }}
<li class="clearfix comment jumptarget" id="comment_{{inc $index}}">
{{/* The following line is wrong. Should be using the MD5 User hash but i don't knwo how to access it. */}}
{{/* Changing Gravatar for something else, so it can stay like this. */}}
<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">
<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}}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
{{.Content}}
</div>
</div>
</div>
</li>
{{end}}
</ul>
</div>
</div>
</div>
</div>
{{end}}
<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}} {{call $.T "submit_a_comment_as_username" .User.Username}} {{else}} {{call $.T "submit_a_comment_as_anonymous"}} {{end}}</label>
<textarea name="comment" class="form-control" rows="5"></textarea>
</div>
{{block "captcha" .}}{{end}}
<button type="submit" class="btn btn-success">{{call $.T "submit" }}</button>
</form>
</div>
</div>
</div>
<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">&times;</button>
<h4 class="modal-title">{{ call $.T "report_torrent_number" (print .Torrent.ID) }}</h4>
</div>
<div class="modal-body">
<b>{{ call $.T "report_type" }}:</b>
<form method="post" action="/report/{{.Torrent.ID}}">
<input type="radio" name="report_type" value="illegal" id="illegal" required> <label for="illegal">{{ call $.T "illegal_content" }}</label><br />
<input type="radio" name="report_type" value="spam" id="spam" required> <label for="spam">{{ call $.T "spam_garbage" }}</label><br />
<input type="radio" name="report_type" value="wrongcat" id="wrongcat" required> <label for="wrongcat">{{ call $.T "wrong_category" }}</label><br />
<input type="radio" name="report_type" value="dup" id="dup" required> <label for="dup">{{ call $.T "duplicate_deprecated" }}</label><br />
{{block "captcha" .}}{{end}}
<button type="submit" class="btn btn-default">{{ call $.T "report_btn" }}</button>
</form> <br />
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
{{end}}