mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-23 00:20: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):
|
def gravatar_url(self):
|
||||||
# from http://en.gravatar.com/site/implement/images/python/
|
# from http://en.gravatar.com/site/implement/images/python/
|
||||||
size = 40
|
size = 120
|
||||||
# construct the url
|
# construct the url
|
||||||
gravatar_url = 'https://www.gravatar.com/avatar/' + \
|
gravatar_url = 'https://www.gravatar.com/avatar/' + \
|
||||||
hashlib.md5(self.email.encode('utf-8').lower()).hexdigest() + '?'
|
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 {
|
ul.nav-tabs#profileTabs {
|
||||||
margin-bottom: 15px;
|
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>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
{% for comment in comments %}
|
{% for comment in comments %}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default comments-panel">
|
||||||
<div class="panel-body" >
|
<div class="panel-body">
|
||||||
<div class="row">
|
<div class="col-md-2">
|
||||||
<div class="col-md-2">
|
<p>
|
||||||
<p>
|
{% set user_url = torrent.user and url_for('view_user', user_name=comment.user.username) %}
|
||||||
{% set user_url = torrent.user and url_for('view_user', user_name=comment.user.username) %}
|
<a href="{{ user_url }}">{{ comment.user.username }}</a>
|
||||||
<a href="{{ user_url }}">{{ comment.user.username }}</a>
|
{% if comment.user.id == torrent.uploader_id and not torrent.anonymous %}
|
||||||
{% if comment.user.id == torrent.uploader_id and not torrent.anonymous %}
|
(uploader)
|
||||||
(uploader)
|
{% endif %}
|
||||||
{% endif %}
|
</p>
|
||||||
</p>
|
<p>{{ comment.user.userlevel_str }}</p>
|
||||||
<p>{{ comment.user.userlevel_str }}</p>
|
<p>
|
||||||
<p>
|
<img class="avatar" src="{{ comment.user.gravatar_url() }}">
|
||||||
<img style="max-width: 120px;" src="{{ comment.user.gravatar_url() }}">
|
</p>
|
||||||
</p>
|
</div>
|
||||||
{% if g.user.is_moderator or g.user.id == comment.user_id %}
|
<div class="col-md-10">
|
||||||
<div class="row form-group">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<small>{{comment.created_time | timesince}}</small>
|
||||||
<label class="btn btn-default" title="Delete">
|
{% if g.user.is_moderator or g.user.id == comment.user_id %}
|
||||||
<a href="{{ url_for('delete_comment', comment_id=comment.id, torrent_id=torrent.id)}}">Delete</a>
|
<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>
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-10">
|
<div class="row">
|
||||||
<small>{{comment.created_time | timesince}}</small><br><br>
|
|
||||||
{# Escape newlines into html entities because CF strips blank newlines #}
|
{# Escape newlines into html entities because CF strips blank newlines #}
|
||||||
<div id="torrent-comment{{ comment.id }}">{{ comment.text }}</div>
|
<div id="torrent-comment{{ comment.id }}">{{ comment.text }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -180,16 +175,15 @@
|
||||||
target.innerHTML = writer.render(parsed);
|
target.innerHTML = writer.render(parsed);
|
||||||
</script>
|
</script>
|
||||||
{% endfor %}
|
{% 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>
|
</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>
|
<script>
|
||||||
var target = document.getElementById('torrent-description');
|
var target = document.getElementById('torrent-description');
|
||||||
var text = target.innerHTML;
|
var text = target.innerHTML;
|
||||||
|
|
Loading…
Reference in a new issue