From af61e5b1e9ec39bd9a0487dfe076c66480a0330b Mon Sep 17 00:00:00 2001 From: nyaadev Date: Tue, 23 May 2017 02:47:20 +0200 Subject: [PATCH] some html + css changes around comments --- nyaa/models.py | 9 +++++++++ nyaa/routes.py | 2 +- nyaa/static/css/main.css | 25 ++++++++++++++++++++----- nyaa/templates/layout.html | 2 +- nyaa/templates/view.html | 17 ++++++++--------- 5 files changed, 39 insertions(+), 16 deletions(-) diff --git a/nyaa/models.py b/nyaa/models.py index aed2f6a..e91a432 100644 --- a/nyaa/models.py +++ b/nyaa/models.py @@ -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: diff --git a/nyaa/routes.py b/nyaa/routes.py index 0168b2a..db38eb8 100644 --- a/nyaa/routes.py +++ b/nyaa/routes.py @@ -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 diff --git a/nyaa/static/css/main.css b/nyaa/static/css/main.css index fdca7db..fbc8366 100644 --- a/nyaa/static/css/main.css +++ b/nyaa/static/css/main.css @@ -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 { diff --git a/nyaa/templates/layout.html b/nyaa/templates/layout.html index 46efe48..72290cb 100644 --- a/nyaa/templates/layout.html +++ b/nyaa/templates/layout.html @@ -27,7 +27,7 @@ - + diff --git a/nyaa/templates/view.html b/nyaa/templates/view.html index 3494703..17d36ba 100644 --- a/nyaa/templates/view.html +++ b/nyaa/templates/view.html @@ -100,7 +100,8 @@ {%- if value is iterable %} -   {{ key }} +   {{ key }} + {{ loop(value.items()) }} {%- else %} @@ -133,35 +134,33 @@

- Comments - {{ comments|length }} + Comments - {{ comments | length }}

{% for comment in comments %} -
+

- {% set user_url = torrent.user and url_for('view_user', user_name=comment.user.username) %} - {{ comment.user.username }} + {{ comment.user.username }} {% if comment.user.id == torrent.uploader_id and not torrent.anonymous %} (uploader) {% endif %}

-

{{ comment.user.userlevel_str }}

- {{ comment.created_time | timesince }} + {{ comment.created_time | timesince }} {% if g.user.is_moderator or g.user.id == comment.user_id %}
- +
{% endif %}
{# Escape newlines into html entities because CF strips blank newlines #} -
{{ comment.text }}
+
{{ comment.text }}