mirror of
https://github.com/simon987/nyaa.git
synced 2025-12-14 07:39:03 +00:00
Merge branch 'master' into reports
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block title %}{{ torrent.display_name }} :: {{ config.SITE_NAME }}{% endblock %}
|
||||
{% block metatags %}
|
||||
{% set uploader_name = torrent.user.username if (torrent.user and not torrent.anonymous) else 'Anonymous' %}
|
||||
<meta property="og:description" content="{{ category_name(torrent.sub_category.id_as_string) }} | {{ torrent.filesize | filesizeformat(True) }} | Uploaded by {{ uploader_name }} on {{ torrent.created_time.strftime('%Y-%m-%d') }}">
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
{% from "_formhelpers.html" import render_field %}
|
||||
<div class="panel panel-{% if torrent.deleted %}deleted{% elif torrent.remake %}danger{% elif torrent.trusted %}success{% else %}default{% endif %}">
|
||||
@@ -25,12 +29,15 @@
|
||||
<div class="row">
|
||||
<div class="col-md-1">Submitter:</div>
|
||||
<div class="col-md-5">
|
||||
{% set user_url = torrent.user and url_for('view_user', user_name=torrent.user.username) %}
|
||||
{%- if not torrent.anonymous and torrent.user -%}
|
||||
<a href="{{ user_url }}">{{ torrent.user.username }}</a>
|
||||
{%- else -%}
|
||||
Anonymous {% if torrent.user and (viewer == torrent.user or viewer.is_admin) %}(<a href="{{ user_url }}">{{ torrent.user.username }}</a>){% endif %}
|
||||
{%- endif -%}
|
||||
{% set user_url = torrent.user and url_for('view_user', user_name=torrent.user.username) %}
|
||||
{%- if not torrent.anonymous and torrent.user -%}
|
||||
<a class="text-{{ torrent.user.userlevel_color }}" href="{{ user_url }}">{{ torrent.user.username }}</a>
|
||||
{%- else -%}
|
||||
Anonymous {% if torrent.user and (g.user == torrent.user or g.user.is_moderator) %}(<a href="{{ user_url }}">{{ torrent.user.username }}</a>){% endif %}
|
||||
{%- endif -%}
|
||||
{% if g.user and g.user.is_superadmin and torrent.uploader_ip %}
|
||||
({{ torrent.uploader_ip_string }})
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">Seeders:</div>
|
||||
@@ -56,16 +63,20 @@
|
||||
<div class="col-md-1">File size:</div>
|
||||
<div class="col-md-5">{{ torrent.filesize | filesizeformat(True) }}</div>
|
||||
|
||||
<div class="col-md-1">Downloads:</div>
|
||||
<div class="col-md-1">Completed:</div>
|
||||
<div class="col-md-5">{% if config.ENABLE_SHOW_STATS %}{{ torrent.stats.download_count }}{% else %}Coming soon{% endif %}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-offset-6 col-md-1">Info hash:</div>
|
||||
<div class="col-md-5"><kbd>{{ torrent.info_hash_as_hex }}</kbd></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-footer clearfix" style="font-size: large">
|
||||
{% if torrent.has_torrent %}<a href="/view/{{ torrent.id }}/torrent"><i class="fa fa-download fa-fw"></i>Download Torrent</a> or {% endif %}<a href="{{ torrent.magnet_uri }}" class="card-footer-item"><i class="fa fa-magnet fa-fw"></i>Magnet</a>
|
||||
|
||||
<div class="panel-footer clearfix">
|
||||
{% if torrent.has_torrent %}<a href="{{ url_for('download_torrent', torrent_id=torrent.id )}}"><i class="fa fa-download fa-fw"></i>Download Torrent</a> or {% endif %}<a href="{{ torrent.magnet_uri }}" class="card-footer-item"><i class="fa fa-magnet fa-fw"></i>Magnet</a>
|
||||
<button type="button" class="btn btn-danger pull-right" data-toggle="modal" data-target="#reportModal">
|
||||
Report
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -82,42 +93,32 @@
|
||||
|
||||
{% if files and files.__len__() <= config.MAX_FILES_VIEW %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading panel-heading-collapse">
|
||||
<h3 class="panel-title">
|
||||
<div class="row">
|
||||
<a class="collapsed col-md-12" data-target="#collapseFileList" data-toggle="collapse" style="color:inherit;text-decoration:none;">File list</a>
|
||||
</div>
|
||||
</h3>
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">File list</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-collapse collapse" id="collapseFileList">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<th style="width:auto;">Path</th>
|
||||
<th style="width:auto;">Size</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{%- for key, value in files.items() recursive %}
|
||||
<tr>
|
||||
{%- if value is iterable %}
|
||||
<td colspan="2" {% if loop.depth0 is greaterthan 0 %}style="padding-left: {{ loop.depth0 * 20 }}px"{% endif %}>
|
||||
<i class="glyphicon glyphicon-folder-open"></i> <b>{{ key }}</b></td>
|
||||
{{ loop(value.items()) }}
|
||||
{%- else %}
|
||||
<td{% if loop.depth0 is greaterthan 0 %} style="padding-left: {{ loop.depth0 * 20 }}px"{% endif %}>
|
||||
<i class="glyphicon glyphicon-file"></i> {{ key }}</td>
|
||||
<td class="col-md-2">{{ value | filesizeformat(True) }}</td>
|
||||
{%- endif %}
|
||||
</tr>
|
||||
{%- endfor %}
|
||||
</table>
|
||||
<div class="torrent-file-list panel-body">
|
||||
<ul>
|
||||
{% for key, value in files.items() recursive -%}
|
||||
{% if value is iterable %}
|
||||
{% set pre_expanded = not loop.depth0 and value.items()|length <= 20 %}
|
||||
<li>
|
||||
<a href="" class="folder"><i class="fa fa-folder{% if pre_expanded %}-open{% endif %}"></i>{{ key }}</a>
|
||||
<ul{% if pre_expanded %} data-show="yes"{% endif %}>{{ '\n' + loop(value.items()) }}
|
||||
</ul>
|
||||
</li>
|
||||
{% else %}
|
||||
<li><i class="fa fa-file"></i>{{ key }} <span class="file-size">({{ value | filesizeformat(True) }})</span></a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% elif files %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading panel-heading-collapse">
|
||||
<h3 class="panel-title">
|
||||
<div class="row"><div class="col-md-12">Too many files to display.</div></div>
|
||||
Too many files to display.
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,13 +126,66 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading panel-heading-collapse">
|
||||
<h3 class="panel-title">
|
||||
<div class="row"><div class="col-md-12">File list is not available for this torrent.</div></div>
|
||||
File list is not available for this torrent.
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="modal fade" id="reportModal" tabindex="-1" role="dialog" aria-labelledby="reportModalLabel">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
Comments - {{ comments | length }}
|
||||
</h3>
|
||||
</div>
|
||||
{% for comment in comments %}
|
||||
<div class="panel panel-default comment-panel" id="com-{{ loop.index }}">
|
||||
<div class="panel-body">
|
||||
<div class="col-md-2">
|
||||
<p>
|
||||
<a class="text-{{ comment.user.userlevel_color }}" href="{{ url_for('view_user', user_name=comment.user.username) }}">{{ comment.user.username }}</a>
|
||||
{% if comment.user.id == torrent.uploader_id and not torrent.anonymous %}
|
||||
(uploader)
|
||||
{% endif %}
|
||||
</p>
|
||||
<p><img class="avatar" src="{{ comment.user.gravatar_url() }}" alt="{{ comment.user.userlevel_str }}"></p>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<a href="#com-{{ loop.index }}"><small data-timestamp-swap data-timestamp="{{ comment.created_utc_timestamp|int }}">{{ comment.created_time.strftime('%Y-%m-%d %H:%M UTC') }}</small></a>
|
||||
{% if g.user.is_moderator or g.user.id == comment.user_id %}
|
||||
<form class="delete-comment-form" action="{{ url_for('delete_comment', torrent_id=torrent.id, comment_id=comment.id) }}" method="POST">
|
||||
<button name="submit" type="submit" class="btn btn-danger btn-xs" title="Delete">Delete</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row">
|
||||
{# Escape newlines into html entities because CF strips blank newlines #}
|
||||
<div class="comment-content" id="torrent-comment{{ comment.id }}">{{ comment.text }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var target = document.getElementById('torrent-comment{{ comment.id }}');
|
||||
var text = target.innerHTML;
|
||||
var reader = new commonmark.Parser({safe: true});
|
||||
var writer = new commonmark.HtmlRenderer({safe: true, softbreak: '<br />'});
|
||||
var parsed = reader.parse(text.trim());
|
||||
target.innerHTML = writer.render(parsed);
|
||||
</script>
|
||||
{% endfor %}
|
||||
{% if comment_form %}
|
||||
<form class="comment-box" method="POST">
|
||||
{{ comment_form.csrf_token }}
|
||||
{{ render_field(comment_form.comment, class_='form-control') }}
|
||||
<input type="submit" value="Submit" class="btn btn-success btn-sm">
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="reportModal" tabindex="-1" role="dialog" aria-labelledby="reportModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -153,7 +207,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var target = document.getElementById('torrent-description');
|
||||
|
||||
Reference in New Issue
Block a user