1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 13:49:59 +00:00

some html + css changes around comments

This commit is contained in:
nyaadev 2017-05-23 02:47:20 +02:00
parent f76593a3fb
commit af61e5b1e9
5 changed files with 39 additions and 16 deletions

View file

@ -414,6 +414,15 @@ class User(db.Model):
elif self.level >= UserLevelType.MODERATOR:
return 'Moderator'
@property
def userlevel_color(self):
if self.level == UserLevelType.REGULAR:
return 'default'
elif self.level == UserLevelType.TRUSTED:
return 'success'
elif self.level >= UserLevelType.MODERATOR:
return 'purple'
@property
def ip_string(self):
if self.last_login_ip:

View file

@ -824,7 +824,7 @@ def timesince(dt, default='just now'):
for period, singular, plural in periods:
if period >= 1:
return '%d %s ago' % (period, singular if period == 1 else plural)
return '%d %s ago' % (period, singular if int(period) == 1 else plural)
return default

View file

@ -219,18 +219,33 @@ ul.nav-tabs#profileTabs {
margin-bottom: 15px;
}
.comments-panel {
.comment-panel {
width: 99%;
margin: 0 auto;
margin-top:10px;
margin-bottom:10px;
margin-top: 10px;
margin-bottom: 10px;
}
.comment-panel:target {
border-color: black;
border-width: 2px;
}
.text-purple, a.text-purple:visited { color: #a760bc; }
a.text-purple:hover, a.text-purple:active, a.text-purple:focus { color: #a760e0; }
.comment-content {
word-break: break-all;
}
.comment-content img {
max-width: 100%;
max-height: 600px;
}
.comment-box {
width: 95%;
margin: 0 auto;
margin-top:30px;
margin-bottom:10px;
margin-top: 30px;
margin-bottom: 10px;
}
.delete-comment-form {

View file

@ -27,7 +27,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<!-- Custom styles for this template -->
<link href="/static/css/main.css" rel="stylesheet">
<link href="/static/css/main.css?v=2" rel="stylesheet">
<!-- Core JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>

View file

@ -100,7 +100,8 @@
<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>&nbsp;&nbsp;<b>{{ key }}</b></td>
<i class="glyphicon glyphicon-folder-open"></i>&nbsp;&nbsp;<b>{{ key }}</b>
</td>
{{ loop(value.items()) }}
{%- else %}
<td{% if loop.depth0 is greaterthan 0 %} style="padding-left: {{ loop.depth0 * 20 }}px"{% endif %}>
@ -133,35 +134,33 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Comments - {{ comments|length }}
Comments - {{ comments | length }}
</h3>
</div>
{% for comment in comments %}
<div class="panel panel-default comments-panel">
<div class="panel panel-default comment-panel" id="com-{{ comment.id }}">
<div class="panel-body">
<div class="col-md-2">
<p>
{% set user_url = torrent.user and url_for('view_user', user_name=comment.user.username) %}
<a href="{{ user_url }}">{{ comment.user.username }}</a>
<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>{{ comment.user.userlevel_str }}</p>
<p><img class="avatar" src="{{ comment.user.gravatar_url() }}"></p>
</div>
<div class="col-md-10">
<div class="row">
<small>{{ comment.created_time | timesince }}</small>
<a href="#com-{{ comment.id }}"><small>{{ comment.created_time | timesince }}</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-sm" title="Delete">Delete</button>
<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 id="torrent-comment{{ comment.id }}">{{ comment.text }}</div>
<div class="comment-content" id="torrent-comment{{ comment.id }}">{{ comment.text }}</div>
</div>
</div>
</div>