mirror of
https://github.com/sb745/NyaaV3.git
synced 2025-03-12 22:06:55 +02:00

Rename variables and reformats user/admin logic Add an is_trusted field to upload and edit forms Restructure fields on upload and edit pages Add simple styling for checkboxes Add titles (mouseover) for checkboxes with crude explanations Show Anonymous checkbox during upload and check & disable it for guests Show Trusted checkbox for users at or above Trusted level Adjust description field rendering to show field label above it Add title (mouseover) for edit icon on torrent page Show uploader for admins on anonymous torrents Show uploader for admins when editing others' torrents
138 lines
5.2 KiB
HTML
138 lines
5.2 KiB
HTML
{% extends "layout.html" %}
|
|
{% block title %}{{ torrent.display_name }} :: {{ config.SITE_NAME }}{% endblock %}
|
|
{% block body %}
|
|
<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 %}
|
|
<a href="{{ request.url }}/edit" title="Edit torrent"><i class="fa fa-fw fa-pencil"></i></a>
|
|
{% 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">
|
|
<a href="{{ url_for("home", c=torrent.main_category.id_as_string) }}">{{ torrent.main_category.name }}</a> - <a href="{{ url_for("home", c=torrent.sub_category.id_as_string) }}">{{ torrent.sub_category.name }}</a>
|
|
</div>
|
|
|
|
<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>
|
|
|
|
<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 -%}
|
|
</div>
|
|
|
|
<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>
|
|
|
|
</div>
|
|
|
|
<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%}
|
|
</div>
|
|
|
|
<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>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<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-5">{% if config.ENABLE_SHOW_STATS %}{{ torrent.stats.download_count }}{% else %}Coming soon{% endif %}</div>
|
|
</div>
|
|
</div>
|
|
<div class="panel-footer">
|
|
{% 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>
|
|
</div>
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-body" id="torrent-description">
|
|
{% if torrent.description %}
|
|
{# Escape newlines into html entities because CF strips blank newlines #}
|
|
{{ torrent.description | escape | replace('\r\n', '\n') | replace('\n', ' '|safe) }}
|
|
{% else %}
|
|
#### No description.
|
|
{% endif%}
|
|
</div>
|
|
</div>
|
|
|
|
{% 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>
|
|
|
|
<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>
|
|
</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>
|
|
</h3>
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<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>
|
|
</h3>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<script>
|
|
var target = document.getElementById('torrent-description');
|
|
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>
|
|
|
|
{% endblock %}
|