mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 19:30:00 +00:00
Spruce up comments.
This commit is contained in:
parent
fee55c1792
commit
aab3eaccaa
|
@ -394,7 +394,7 @@ class User(db.Model):
|
|||
|
||||
def gravatar_url(self):
|
||||
# from http://en.gravatar.com/site/implement/images/python/
|
||||
size = 40
|
||||
size = 120
|
||||
# construct the url
|
||||
gravatar_url = 'https://www.gravatar.com/avatar/' + \
|
||||
hashlib.md5(self.email.encode('utf-8').lower()).hexdigest() + '?'
|
||||
|
|
|
@ -218,3 +218,26 @@ table.torrent-list tbody tr td a:visited {
|
|||
ul.nav-tabs#profileTabs {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.comments-panel {
|
||||
width: 99%;
|
||||
margin: 0 auto;
|
||||
margin-top:10px;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
.comment-box {
|
||||
width: 95%;
|
||||
margin: 0 auto;
|
||||
margin-top:30px;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
position: relative;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
max-width: 120px;
|
||||
}
|
||||
|
|
|
@ -137,34 +137,29 @@
|
|||
</h3>
|
||||
</div>
|
||||
{% for comment in comments %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body" >
|
||||
<div class="row">
|
||||
<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>
|
||||
{% if comment.user.id == torrent.uploader_id and not torrent.anonymous %}
|
||||
(uploader)
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>{{ comment.user.userlevel_str }}</p>
|
||||
<p>
|
||||
<img style="max-width: 120px;" src="{{ comment.user.gravatar_url() }}">
|
||||
</p>
|
||||
{% if g.user.is_moderator or g.user.id == comment.user_id %}
|
||||
<div class="row form-group">
|
||||
<div class="col-md-6">
|
||||
<label class="btn btn-default" title="Delete">
|
||||
<a href="{{ url_for('delete_comment', comment_id=comment.id, torrent_id=torrent.id)}}">Delete</a>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default comments-panel">
|
||||
<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>
|
||||
{% 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>
|
||||
{% if g.user.is_moderator or g.user.id == comment.user_id %}
|
||||
<div class="btn btn-danger btn-sm delete-btn" title="Delete" onclick='location.href = "{{ url_for('delete_comment', comment_id=comment.id, torrent_id=torrent.id)}}";'>Delete</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<small>{{comment.created_time | timesince}}</small><br><br>
|
||||
<div class="row">
|
||||
{# Escape newlines into html entities because CF strips blank newlines #}
|
||||
<div id="torrent-comment{{ comment.id }}">{{ comment.text }}</div>
|
||||
</div>
|
||||
|
@ -180,16 +175,15 @@
|
|||
target.innerHTML = writer.render(parsed);
|
||||
</script>
|
||||
{% endfor %}
|
||||
{% if g.user %}
|
||||
<form method="POST" class="comment-box">
|
||||
{{ form.csrf_token }}
|
||||
{{ render_field(form.comment, class_='form-control') }}
|
||||
<input type="submit" value="Submit" class="btn btn-success btn-sm">
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if g.user %}
|
||||
<form method="POST">
|
||||
{{ form.csrf_token }}
|
||||
{{ render_field(form.comment, class_='form-control') }}
|
||||
<input type="submit" value="Submit" class="btn btn-primary">
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
var target = document.getElementById('torrent-description');
|
||||
var text = target.innerHTML;
|
||||
|
|
Loading…
Reference in a new issue