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

Minor improvements

This commit is contained in:
nyaadev 2017-08-15 01:41:31 +02:00
parent 2cd2dbf66d
commit 0bcd782695
5 changed files with 22 additions and 17 deletions

View file

@ -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):

View file

@ -251,7 +251,13 @@ 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;

View file

@ -27,7 +27,7 @@
<dt>Email address:</dt>
<dd>{{ user.email }}</dd>
<dt>User class:</dt>
<dd>{{ level }}</dd>
<dd>{{ user.userlevel_str }}</dd>
<dt>User status:</dt>
<dd>{{ user.userstatus_str }}</dt>
{%- if g.user.is_superadmin -%}
@ -52,7 +52,7 @@
{% endif %}
<h3>
Browsing <span class="text-{{ user.userlevel_color }}">{{ user.username }}</span>'{{ '' if user.username[-1] == 's' else 's' }} torrents
Browsing <span class="text-{{ user.userlevel_color }}" data-toggle="tooltip" title="{{ user.userlevel_str }}">{{ user.username }}</span>'{{ '' if user.username[-1] == 's' else 's' }} torrents
</h3>
{% include "search_results.html" %}

View file

@ -31,9 +31,9 @@
<div class="col-md-5">
{% set user_url = torrent.user and url_for('users.view_user', user_name=torrent.user.username) %}
{%- if not torrent.anonymous and torrent.user -%}
<a class="text-{{ torrent.user.userlevel_color }}" href="{{ user_url }}">{{ torrent.user.username }}</a>
<a class="text-{{ torrent.user.userlevel_color }}" href="{{ user_url }}" data-toggle="tooltip" title="{{ torrent.user.userlevel_str }}">{{ torrent.user.username }}</a>
{%- else -%}
Anonymous {% if torrent.user and (g.user == torrent.user or g.user.is_moderator) %}(<a href="{{ user_url }}">{{ torrent.user.username }}</a>){% endif %}
Anonymous {% if torrent.user and (g.user == torrent.user or g.user.is_moderator) %}(<a class="text-{{ torrent.user.userlevel_color }}" href="{{ user_url }}" data-toggle="tooltip" title="{{ torrent.user.userlevel_str }}">{{ torrent.user.username }}</a>){% endif %}
{%- endif -%}
{% if g.user and g.user.is_superadmin and torrent.uploader_ip %}
({{ torrent.uploader_ip_string }})
@ -145,12 +145,12 @@
<div class="panel-body">
<div class="col-md-2">
<p>
<a class="text-{{ comment.user.userlevel_color }}" href="{{ url_for('users.view_user', user_name=comment.user.username) }}">{{ comment.user.username }}</a>
<a class="text-{{ comment.user.userlevel_color }}" href="{{ url_for('users.view_user', user_name=comment.user.username) }}" data-toggle="tooltip" title="{{ comment.user.userlevel_str }}">{{ comment.user.username }}</a>
{% if comment.user.id == torrent.uploader_id and not torrent.anonymous %}
(uploader)
{% endif %}
</p>
<p><img class="avatar" src="{{ comment.user.gravatar_url() }}" alt="{{ comment.user.userlevel_str }}"></p>
<img class="avatar" src="{{ comment.user.gravatar_url() }}" alt="{{ comment.user.userlevel_str }}">
</div>
<div class="col-md-10">
<div class="row">

View file

@ -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: