2017-05-12 20:51:49 +02:00
{% extends "layout.html" %}
{% block title %}{{ torrent.display_name }} :: {{ config.SITE_NAME }}{% endblock %}
2017-05-26 01:03:59 +03:00
{% 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 %}
2017-05-12 20:51:49 +02:00
{% block body %}
2017-05-19 20:03:47 +03:00
{% from "_formhelpers.html" import render_field %}
2017-05-20 23:00:42 +03:00
< div class = "panel panel-{% if torrent.deleted %}deleted{% elif torrent.remake %}danger{% elif torrent.trusted %}success{% else %}default{% endif %}" >
< div class = "panel-heading" { % if torrent . hidden % } style = "background-color: darkgray;" { % endif % } >
< h3 class = "panel-title" >
{% if can_edit %}
2017-07-24 23:10:36 +03:00
< a href = "{{ url_for('torrents.edit', torrent_id=torrent.id) }}" title = "Edit torrent" > < i class = "fa fa-fw fa-pencil" > < / i > < / a >
2017-05-20 23:00:42 +03:00
{% endif %}
{{ torrent.display_name }}
< / h3 >
< / div >
< div class = "panel-body" >
< div class = "row" >
< div class = "col-md-1" > Category:< / div >
< div class = "col-md-5" >
2017-07-11 00:44:10 +03:00
< a href = "{{ url_for('main.home', c=torrent.main_category.id_as_string) }}" > {{ torrent.main_category.name }}< / a > - < a href = "{{ url_for('main.home', c=torrent.sub_category.id_as_string) }}" > {{ torrent.sub_category.name }}< / a >
2017-05-20 13:33:58 +03:00
< / div >
2017-05-12 20:51:49 +02:00
2017-05-20 23:00:42 +03:00
< div class = "col-md-1" > Date:< / div >
< div class = "col-md-5" data-timestamp = "{{ torrent.created_utc_timestamp|int }}" > {{ torrent.created_time.strftime('%Y-%m-%d %H:%M UTC') }}< / div >
< / div >
2017-05-12 20:51:49 +02:00
2017-05-20 23:00:42 +03:00
< div class = "row" >
< div class = "col-md-1" > Submitter:< / div >
2017-05-20 22:00:45 +03:00
< div class = "col-md-5" >
2017-07-08 00:50:55 +03:00
{% set user_url = torrent.user and url_for('users.view_user', user_name=torrent.user.username) %}
2017-05-24 00:28:17 +02:00
{%- if not torrent.anonymous and torrent.user -%}
2017-08-15 01:41:31 +02:00
< a class = "text-{{ torrent.user.userlevel_color }}" href = "{{ user_url }}" data-toggle = "tooltip" title = "{{ torrent.user.userlevel_str }}" > {{ torrent.user.username }}< / a >
2017-05-24 00:28:17 +02:00
{%- else -%}
2017-08-15 01:41:31 +02:00
Anonymous {% if torrent.user and (g.user == torrent.user or g.user.is_moderator) %}(< a class = "text-{{ torrent.user.userlevel_color }}" href = "{{ user_url }}" data-toggle = "tooltip" title = "{{ torrent.user.userlevel_str }}" > {{ torrent.user.username }}< / a > ){% endif %}
2017-05-24 00:28:17 +02:00
{%- endif -%}
{% if g.user and g.user.is_superadmin and torrent.uploader_ip %}
({{ torrent.uploader_ip_string }})
{% endif %}
2017-05-20 22:00:45 +03:00
< / div >
2017-05-12 20:51:49 +02:00
2017-05-20 23:00:42 +03:00
< div class = "col-md-1" > Seeders:< / div >
< div class = "col-md-5" > < span style = "color: green;" > {% if config.ENABLE_SHOW_STATS %}{{ torrent.stats.seed_count }}{% else %}Coming soon{% endif %}< / span > < / div >
2017-05-12 20:51:49 +02:00
2017-05-20 23:00:42 +03:00
< / div >
2017-05-20 13:33:58 +03:00
2017-05-20 23:00:42 +03:00
< div class = "row" >
< div class = "col-md-1" > Information:< / div >
< div class = "col-md-5" >
{% if torrent.information %}
{{ torrent.information_as_link | safe }}
{% else %}
No information.
{% endif%}
2017-05-20 13:33:58 +03:00
< / div >
2017-05-12 20:51:49 +02:00
2017-05-20 23:00:42 +03:00
< div class = "col-md-1" > Leechers:< / div >
< div class = "col-md-5" > < span style = "color: red;" > {% if config.ENABLE_SHOW_STATS %}{{ torrent.stats.leech_count }}{% else %}Coming soon{% endif %}< / span > < / div >
2017-05-20 13:33:58 +03:00
< / div >
2017-05-20 23:00:42 +03:00
< div class = "row" >
< div class = "col-md-1" > File size:< / div >
< div class = "col-md-5" > {{ torrent.filesize | filesizeformat(True) }}< / div >
2017-05-22 15:00:06 +00:00
< div class = "col-md-1" > Completed:< / div >
2017-05-20 23:00:42 +03:00
< div class = "col-md-5" > {% if config.ENABLE_SHOW_STATS %}{{ torrent.stats.download_count }}{% else %}Coming soon{% endif %}< / div >
2017-05-12 20:51:49 +02:00
< / div >
2017-05-24 17:17:15 +03:00
< div class = "row" >
2017-05-24 23:25:21 -07:00
< div class = "col-md-offset-6 col-md-1" > Info hash:< / div >
2017-05-24 17:17:15 +03:00
< div class = "col-md-5" > < kbd > {{ torrent.info_hash_as_hex }}< / kbd > < / div >
< / div >
2017-06-06 03:23:30 +03:00
< / div > <!-- /.panel - body -->
2017-05-26 15:25:02 +03:00
< div class = "panel-footer clearfix" >
2017-07-24 23:10:59 +03:00
{% if torrent.has_torrent %}< a href = "{{ url_for('torrents.download', 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 >
2018-02-22 23:23:53 -08:00
{% if g.user and g.user.age > config['RATELIMIT_ACCOUNT_AGE'] %}
2017-06-05 00:45:50 -05:00
< button type = "button" class = "btn btn-xs btn-danger pull-right" data-toggle = "modal" data-target = "#reportModal" >
2017-05-20 23:00:42 +03:00
Report
< / button >
2017-06-14 20:07:53 +03:00
{% endif %}
2017-05-20 23:00:42 +03:00
< / div >
2017-06-06 03:23:30 +03:00
< / div > <!-- /.panel -->
2017-05-12 20:51:49 +02:00
2017-05-20 23:00:42 +03:00
< div class = "panel panel-default" >
2017-05-30 18:56:09 +03:00
< div markdown-text class = "panel-body" id = "torrent-description" >
{%- if torrent.description -%}
2017-05-20 23:00:42 +03:00
{# Escape newlines into html entities because CF strips blank newlines #}
2017-05-30 18:56:09 +03:00
{{- torrent.description | escape | replace('\r\n', '\n') | replace('\n', ' '|safe) -}}
{%- else -%}
2017-05-20 23:00:42 +03:00
#### No description.
2017-05-30 18:56:09 +03:00
{%- endif -%}
2017-05-12 20:51:49 +02:00
< / div >
2017-05-20 23:00:42 +03:00
< / div >
2017-05-12 20:51:49 +02:00
2019-03-08 15:29:51 +01:00
{% cache 86400, "filelist", torrent.info_hash_as_hex %}
2017-05-20 23:00:42 +03:00
{% if files and files.__len__() < = config.MAX_FILES_VIEW %}
< div class = "panel panel-default" >
2017-05-25 16:06:15 +03:00
< div class = "panel-heading" >
< h3 class = "panel-title" > File list< / h3 >
2017-05-20 23:00:42 +03:00
< / div >
2017-05-12 20:51:49 +02:00
2017-05-25 16:06:15 +03:00
< div class = "torrent-file-list panel-body" >
2017-05-25 12:40:46 +03:00
< ul >
{% for key, value in files.items() recursive -%}
{% if value is iterable %}
2017-05-25 22:15:32 +03:00
{% set pre_expanded = not loop.depth0 and value.items()|length < = 20 %}
2017-05-25 12:40:46 +03:00
< li >
2017-05-25 22:15:32 +03:00
< 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()) }}
2017-05-25 12:40:46 +03:00
< / ul >
< / li >
{% else %}
2017-06-06 03:23:30 +03:00
< li > < i class = "fa fa-file" > < / i > {{ key }} < span class = "file-size" > ({{ value | filesizeformat(True) }})< / span > < / li >
2017-05-25 12:40:46 +03:00
{% endif %}
{% endfor %}
< / ul >
2017-05-20 23:00:42 +03:00
< / div >
2017-06-06 03:23:30 +03:00
< / div > <!-- /.panel -->
2017-05-20 23:00:42 +03:00
{% elif files %}
< div class = "panel panel-default" >
< div class = "panel-heading panel-heading-collapse" >
< h3 class = "panel-title" >
2017-05-24 06:19:15 +00:00
Too many files to display.
2017-05-20 23:00:42 +03:00
< / h3 >
< / div >
< / div >
{% else %}
< div class = "panel panel-default" >
< div class = "panel-heading panel-heading-collapse" >
< h3 class = "panel-title" >
2017-05-24 06:19:15 +00:00
File list is not available for this torrent.
2017-05-20 23:00:42 +03:00
< / h3 >
< / div >
< / div >
{% endif %}
2019-03-08 15:29:51 +01:00
{% endcache %}
2017-05-20 23:00:42 +03:00
2017-05-28 02:46:04 +03:00
< div id = "comments" class = "panel panel-default" >
2017-05-13 22:24:42 +10:00
< div class = "panel-heading" >
2018-07-31 12:29:39 -05:00
< a data-toggle = "collapse" href = "#collapse-comments" role = "button" aria-expanded = "{% if g.user and g.user.preferences.hide_comments %}false{% else %}true{% endif %}" aria-controls = "collapse-comments" >
2017-05-13 22:24:42 +10:00
< h3 class = "panel-title" >
2017-05-23 02:47:20 +02:00
Comments - {{ comments | length }}
2017-05-13 22:24:42 +10:00
< / h3 >
2018-07-31 12:29:39 -05:00
< / a >
2017-05-13 22:24:42 +10:00
< / div >
2018-07-31 12:29:39 -05:00
< div class = "collapse {% if g.user and g.user.preferences.hide_comments %}{% else %}in{% endif %}" id = "collapse-comments" >
2017-05-22 10:18:22 -04:00
{% for comment in comments %}
2017-05-23 02:59:31 +02:00
< div class = "panel panel-default comment-panel" id = "com-{{ loop.index }}" >
2017-05-22 12:58:09 -04:00
< div class = "panel-body" >
< div class = "col-md-2" >
< p >
2017-08-15 01:41:31 +02:00
< a class = "text-{{ comment.user.userlevel_color }}" href = "{{ url_for('users.view_user', user_name=comment.user.username) }}" data-toggle = "tooltip" title = "{{ comment.user.userlevel_str }}" > {{ comment.user.username }}< / a >
2017-05-22 12:58:09 -04:00
{% if comment.user.id == torrent.uploader_id and not torrent.anonymous %}
(uploader)
{% endif %}
< / p >
2017-08-15 01:41:31 +02:00
< img class = "avatar" src = "{{ comment.user.gravatar_url() }}" alt = "{{ comment.user.userlevel_str }}" >
2017-05-22 12:58:09 -04:00
< / div >
2017-11-05 09:26:30 -05:00
< div class = "col-md-10 comment" >
< div class = "row comment-details" >
2017-05-25 21:13:35 +03:00
< 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 >
2017-11-05 09:26:30 -05:00
{% if comment.edited_time %}
2017-11-10 05:50:50 +02:00
< small data-timestamp-swap data-timestamp-title data-timestamp = "{{ comment.edited_utc_timestamp }}" title = "{{ comment.edited_time }}" > (edited)< / small >
2017-05-22 10:18:22 -04:00
{% endif %}
2017-11-05 09:26:30 -05:00
< div class = "comment-actions" >
2018-03-26 02:03:49 +02:00
{% if g.user.id == comment.user_id and not comment.editing_limit_exceeded and (not torrent.comment_locked or comment_form) %}
2017-11-05 09:26:30 -05:00
< button class = "btn btn-xs edit-comment" title = "Edit" { % if config . EDITING_TIME_LIMIT % } data-until = "{{ comment.editable_until|int }}" { % endif % } > Edit< / button >
{% endif %}
2018-04-02 13:18:39 -07:00
{% if g.user.is_superadmin or (g.user.id == comment.user_id and not torrent.comment_locked and not comment.editing_limit_exceeded) %}
2017-11-05 09:26:30 -05:00
< form class = "delete-comment-form" action = "{{ url_for('torrents.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 >
2017-05-22 10:18:22 -04:00
< / div >
2017-05-22 12:58:09 -04:00
< div class = "row" >
2017-05-22 10:18:22 -04:00
{# Escape newlines into html entities because CF strips blank newlines #}
2017-11-10 05:50:57 +02:00
< div markdown-text class = "comment-content" id = "torrent-comment{{ comment.id }}" > {{- comment.text | escape | replace('\r\n', '\n') | replace('\n', ' '|safe) -}}< / div >
2019-02-24 15:03:38 +01:00
{% if g.user.id == comment.user_id and comment_form %}
2017-11-05 09:26:30 -05:00
< form class = "edit-comment-box" action = "{{ url_for('torrents.edit_comment', torrent_id=torrent.id, comment_id=comment.id) }}" method = "POST" >
{{ comment_form.csrf_token }}
< div class = "form-group" >
2017-11-10 05:50:57 +02:00
< textarea class = "form-control" name = "comment" autofocus > {{- comment.text | escape | replace('\r\n', '\n') | replace('\n', ' '|safe) -}}< / textarea >
2017-11-05 09:26:30 -05:00
< / div >
2018-06-17 01:57:14 +02:00
{% if config.USE_RECAPTCHA and g.user.age < config [ ' ACCOUNT_RECAPTCHA_AGE ' ] % }
< div class = "row" >
< div class = "col-md-4" >
{% if comment_form.recaptcha.errors %}
< div class = "alert alert-danger" >
< p > < strong > CAPTCHA error:< / strong > < / p >
< ul >
{% for error in comment_form.recaptcha.errors %}
< li > {{ error }}< / li >
{% endfor %}
< / ul >
< / div >
{% endif %}
{{ comment_form.recaptcha }}
< / div >
< / div >
{% endif %}
2017-11-05 09:26:30 -05:00
< input type = "submit" value = "Submit" class = "btn btn-success btn-sm" >
< button class = "btn btn-sm edit-comment" title = "Cancel" > Cancel< / button >
< span class = "edit-error text-danger" > < / span >
< div class = "edit-waiting" style = "display:none" > < / div >
< / form >
{% endif %}
2017-05-22 10:18:22 -04:00
< / div >
< / div >
< / div >
2017-05-13 22:24:42 +10:00
< / div >
2017-05-30 18:56:09 +03:00
2017-05-22 10:18:22 -04:00
{% endfor %}
2018-03-26 02:03:49 +02:00
{% if torrent.comment_locked %}
< div class = "alert alert-warning" >
< p >
< i class = "fa fa-lock" aria-hidden = "true" > < / i >
Comments have been locked.
< / p >
< / div >
{% endif %}
2017-05-22 23:01:23 +02:00
{% if comment_form %}
2017-05-23 00:04:27 +02:00
< form class = "comment-box" method = "POST" >
2017-05-22 23:01:23 +02:00
{{ comment_form.csrf_token }}
2018-02-01 19:50:00 +01:00
< div class = "row" >
< div class = "col-md-12" >
{{ render_field(comment_form.comment, class_='form-control') }}
< / div >
< / div >
{% if config.USE_RECAPTCHA and g.user.age < config [ ' ACCOUNT_RECAPTCHA_AGE ' ] % }
< div class = "row" >
< div class = "col-md-4" >
{% if comment_form.recaptcha.errors %}
< div class = "alert alert-danger" >
< p > < strong > CAPTCHA error:< / strong > < / p >
< ul >
{% for error in comment_form.recaptcha.errors %}
< li > {{ error }}< / li >
{% endfor %}
< / ul >
< / div >
{% endif %}
{{ comment_form.recaptcha }}
< / div >
< / div >
{% endif %}
< div class = "row" >
< div class = "col-md-12" >
< input type = "submit" value = "Submit" class = "btn btn-success btn-sm" >
< / div >
< / div >
2017-05-22 12:58:09 -04:00
< / form >
{% endif %}
2018-07-31 12:29:39 -05:00
< / div >
2017-05-13 22:24:42 +10:00
< / div >
2018-02-22 23:23:53 -08:00
{% if g.user and g.user.age > config['RATELIMIT_ACCOUNT_AGE'] %}
2017-06-06 03:23:30 +03:00
< div class = "modal fade" id = "reportModal" tabindex = "-1" role = "dialog" aria-labelledby = "reportModalLabel" >
2017-05-20 23:00:42 +03:00
< div class = "modal-dialog" role = "document" >
< div class = "modal-content" >
< div class = "modal-header" >
< button type = "button" class = "close" data-dismiss = "modal" aria-label = "Close" > < span
aria-hidden="true">× < / span > < / button >
< h4 class = "modal-title" > Report torrent #{{ torrent.id }}< / h4 >
2017-05-20 13:33:58 +03:00
< / div >
2017-05-20 23:00:42 +03:00
< div class = "modal-body" >
2017-06-27 14:40:58 +02:00
< div class = "alert alert-warning" role = "alert" >
Before submitting a report, please check that the torrent
2017-07-11 00:13:19 +03:00
actually breaks < a href = "{{ url_for('site.rules') }}" > the
2017-06-27 14:40:58 +02:00
rules< / a > . Useless reports like "download is slow" or
"thanks" can get you banned from the site.
< / div >
2017-07-24 23:15:45 +03:00
< form method = "POST" action = "{{ url_for('torrents.report', torrent_id=torrent.id) }}" >
2017-05-20 23:00:42 +03:00
{{ report_form.csrf_token }}
{{ render_field(report_form.reason, class_='form-control', maxlength=255) }}
< div style = "float: right;" >
< button type = "button" class = "btn btn-default" data-dismiss = "modal" > Close< / button >
2017-10-04 02:03:22 +02:00
< button type = "submit" id = "reportSubmit" class = "btn btn-danger" > Report< / button >
2017-05-20 13:33:58 +03:00
< / div >
2017-05-20 23:00:42 +03:00
< / form >
2017-05-20 13:33:58 +03:00
< / div >
2017-05-20 23:00:42 +03:00
< div class = "modal-footer" style = "border-top: none;" >
2017-05-20 13:33:58 +03:00
< / div >
< / div >
< / div >
2017-06-06 03:23:30 +03:00
< / div >
2017-05-19 20:03:47 +03:00
2017-06-01 06:30:34 -05:00
< script type = "text/javascript" >
2017-05-30 19:31:28 +02:00
// Focus the report text field once the modal is opened.
$('#reportModal').on('shown.bs.modal', function () {
$('#reason').focus();
2017-10-04 02:03:22 +02:00
$('#reportSubmit').attr('disabled', true);
});
$('#reason').on('input', function(e) {
if($('#reason').val().length > 0) {
$('#reportSubmit').removeAttr('disabled');
} else {
$('#reportSubmit').attr('disabled', true);
}
2017-06-06 03:23:30 +03:00
});
2017-05-30 19:31:28 +02:00
< / script >
2017-06-14 20:07:53 +03:00
{% endif %}
2017-05-30 19:31:28 +02:00
{% endblock %}