From 0bcd7826951287180ddb739b0aa3e7374ec6a9ca Mon Sep 17 00:00:00 2001 From: nyaadev Date: Tue, 15 Aug 2017 01:41:31 +0200 Subject: [PATCH] Minor improvements --- nyaa/models.py | 4 +++- nyaa/static/css/main.css | 16 +++++++++++----- nyaa/templates/user.html | 4 ++-- nyaa/templates/view.html | 8 ++++---- nyaa/views/users.py | 7 ++----- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/nyaa/models.py b/nyaa/models.py index c2afe8d..1b80977 100644 --- a/nyaa/models.py +++ b/nyaa/models.py @@ -525,8 +525,10 @@ class User(db.Model): return 'User' elif self.level == UserLevelType.TRUSTED: return 'Trusted' - elif self.level >= UserLevelType.MODERATOR: + elif self.level == UserLevelType.MODERATOR: return 'Moderator' + elif self.level >= UserLevelType.SUPERADMIN: + return 'Administrator' @property def userstatus_str(self): diff --git a/nyaa/static/css/main.css b/nyaa/static/css/main.css index 93c8633..fd6dec9 100644 --- a/nyaa/static/css/main.css +++ b/nyaa/static/css/main.css @@ -251,18 +251,24 @@ ul.nav-tabs#profileTabs { margin-top: 10px; margin-bottom: 10px; } - +.comment-panel .panel-body { + padding-top: 10px; + padding-bottom: 10px; +} +.comment-panel .col-md-2 p { + margin-bottom: 5px; +} .comment-panel:target { border-color: black; border-width: 2px; } .text-purple, a.text-purple:visited { - color: #a760bc; + color: #a760bc; } a.text-purple:hover, a.text-purple:active, a.text-purple:focus { - color: #a760e0; + color: #a760e0; } .comment-content { @@ -385,13 +391,13 @@ h6:hover .header-anchor { margin-left: 20px; margin-bottom: 10px; } - + #navFilter-criteria > .bootstrap-select:first-child > button { /* !important is used here to override the programmatically added style on element */ border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; } - + .search-container > .search-bar { margin-top: 15px; } diff --git a/nyaa/templates/user.html b/nyaa/templates/user.html index 2e69a51..35691c5 100644 --- a/nyaa/templates/user.html +++ b/nyaa/templates/user.html @@ -27,7 +27,7 @@
Email address:
{{ user.email }}
User class:
-
{{ level }}
+
{{ user.userlevel_str }}
User status:
{{ user.userstatus_str }} {%- if g.user.is_superadmin -%} @@ -52,7 +52,7 @@ {% endif %}

- Browsing {{ user.username }}'{{ '' if user.username[-1] == 's' else 's' }} torrents + Browsing {{ user.username }}'{{ '' if user.username[-1] == 's' else 's' }} torrents

{% include "search_results.html" %} diff --git a/nyaa/templates/view.html b/nyaa/templates/view.html index 41eb23c..cb80e63 100644 --- a/nyaa/templates/view.html +++ b/nyaa/templates/view.html @@ -31,9 +31,9 @@
{% set user_url = torrent.user and url_for('users.view_user', user_name=torrent.user.username) %} {%- if not torrent.anonymous and torrent.user -%} - {{ torrent.user.username }} + {{ torrent.user.username }} {%- else -%} - Anonymous {% if torrent.user and (g.user == torrent.user or g.user.is_moderator) %}({{ torrent.user.username }}){% endif %} + Anonymous {% if torrent.user and (g.user == torrent.user or g.user.is_moderator) %}({{ torrent.user.username }}){% endif %} {%- endif -%} {% if g.user and g.user.is_superadmin and torrent.uploader_ip %} ({{ torrent.uploader_ip_string }}) @@ -145,12 +145,12 @@

- {{ comment.user.username }} + {{ comment.user.username }} {% if comment.user.id == torrent.uploader_id and not torrent.anonymous %} (uploader) {% endif %}

-

{{ comment.user.userlevel_str }}

+ {{ comment.user.userlevel_str }}
diff --git a/nyaa/views/users.py b/nyaa/views/users.py index 9fb5da3..539f296 100644 --- a/nyaa/views/users.py +++ b/nyaa/views/users.py @@ -53,8 +53,6 @@ def view_user(user_name): return flask.redirect(url) - user_level = ['Regular', 'Trusted', 'Moderator', 'Administrator'][user.level] - req_args = flask.request.args search_term = chain_get(req_args, 'q', 'term') @@ -119,7 +117,6 @@ def view_user(user_name): user=user, user_page=True, rss_filter=rss_query_string, - level=user_level, admin_form=admin_form) # Similar logic as home page else: @@ -135,7 +132,6 @@ def view_user(user_name): user=user, user_page=True, rss_filter=rss_query_string, - level=user_level, admin_form=admin_form) @@ -166,9 +162,10 @@ def _create_user_class_choices(user): if flask.g.user: if flask.g.user.is_moderator: choices.append(('trusted', 'Trusted')) - choices.append(('banned', 'Banned')) if flask.g.user.is_superadmin: choices.append(('moderator', 'Moderator')) + if flask.g.user.is_moderator: + choices.append(('banned', 'Banned')) if user: if user.is_moderator: