mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 23:59:59 +00:00
fix #173 and add avatar to mod user info
add rank color to username everywhere some other minor changes
This commit is contained in:
parent
a88f6a0847
commit
020a0871bd
|
@ -411,8 +411,10 @@ class User(db.Model):
|
||||||
return 'User'
|
return 'User'
|
||||||
elif self.level == UserLevelType.TRUSTED:
|
elif self.level == UserLevelType.TRUSTED:
|
||||||
return 'Trusted'
|
return 'Trusted'
|
||||||
elif self.level >= UserLevelType.MODERATOR:
|
elif self.level == UserLevelType.MODERATOR:
|
||||||
return 'Moderator'
|
return 'Moderator'
|
||||||
|
elif self.level == UserLevelType.SUPERADMIN:
|
||||||
|
return 'Administrator'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def userlevel_color(self):
|
def userlevel_color(self):
|
||||||
|
|
|
@ -480,8 +480,6 @@ def profile():
|
||||||
|
|
||||||
form = forms.ProfileForm(flask.request.form)
|
form = forms.ProfileForm(flask.request.form)
|
||||||
|
|
||||||
level = ['Regular', 'Trusted', 'Moderator', 'Administrator'][flask.g.user.level]
|
|
||||||
|
|
||||||
if flask.request.method == 'POST' and form.validate():
|
if flask.request.method == 'POST' and form.validate():
|
||||||
user = flask.g.user
|
user = flask.g.user
|
||||||
new_email = form.email.data.strip()
|
new_email = form.email.data.strip()
|
||||||
|
@ -511,12 +509,7 @@ def profile():
|
||||||
flask.g.user = user
|
flask.g.user = user
|
||||||
return flask.redirect('/profile')
|
return flask.redirect('/profile')
|
||||||
|
|
||||||
_user = models.User.by_id(flask.g.user.id)
|
return flask.render_template('profile.html', form=form)
|
||||||
username = _user.username
|
|
||||||
current_email = _user.email
|
|
||||||
|
|
||||||
return flask.render_template('profile.html', form=form, name=username, email=current_email,
|
|
||||||
level=level)
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/user/activate/<payload>')
|
@app.route('/user/activate/<payload>')
|
||||||
|
|
|
@ -270,3 +270,4 @@ a.text-purple:hover, a.text-purple:active, a.text-purple:focus { color: #a760e0;
|
||||||
}
|
}
|
||||||
.btn.active span.glyphicon {
|
.btn.active span.glyphicon {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
|
||||||
|
|
||||||
<!-- Custom styles for this template -->
|
<!-- Custom styles for this template -->
|
||||||
<link href="/static/css/main.css?v=3" rel="stylesheet">
|
<link href="/static/css/main.css?v=4" rel="stylesheet">
|
||||||
|
|
||||||
<!-- Core JavaScript -->
|
<!-- Core JavaScript -->
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle visible-lg visible-sm visible-xs" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
<a href="#" class="dropdown-toggle visible-lg visible-sm visible-xs" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
||||||
<i class="fa fa-user fa-fw"></i>
|
<i class="fa fa-user fa-fw"></i>
|
||||||
{{g.user.username}}
|
{{ g.user.username }}
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" class="dropdown-toggle hidden-lg hidden-sm hidden-xs" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
<a href="#" class="dropdown-toggle hidden-lg hidden-sm hidden-xs" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
||||||
|
|
|
@ -3,17 +3,17 @@
|
||||||
{% block body %}
|
{% block body %}
|
||||||
{% from "_formhelpers.html" import render_field %}
|
{% from "_formhelpers.html" import render_field %}
|
||||||
|
|
||||||
<h2 style="margin-bottom: 20px;">Profile of <strong>{{ name }}</strong></h2>
|
<h2 style="margin-bottom: 20px;">Profile of <strong class="text-{{ g.user.userlevel_color }}">{{ g.user.username }}</strong></h2>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row" style="margin-bottom: 20px;">
|
||||||
<div class="col-sm-4 avatar" style="display: none;">
|
<div class="col-sm-2" style="max-width: 150px;">
|
||||||
<!-- TO BE IMPLEMENTED -->
|
<img class="avatar" src="{{ g.user.gravatar_url() }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-10">
|
||||||
<dl class="row" style="margin: 20px 0 15px 0;">
|
<dl class="row" style="margin: 20px 0 15px 0;">
|
||||||
<dt class="col-sm-3">User ID:</dt><dd class="col-sm-9">{{ g.user.id }}</dd>
|
<dt class="col-sm-2">User ID:</dt><dd class="col-sm-10">{{ g.user.id }}</dd>
|
||||||
<dt class="col-sm-3">User Class:</dt><dd class="col-sm-9">{{ level }}</dd>
|
<dt class="col-sm-2">User Class:</dt><dd class="col-sm-10">{{ g.user.userlevel_str }}</dd>
|
||||||
<dt class="col-sm-3">User Created on:</dt><dd class="col-sm-9">{{ g.user.created_time }}</dd>
|
<dt class="col-sm-2">User Created on:</dt><dd class="col-sm-10">{{ g.user.created_time }}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label class="control-label" for="current_email">Current Email</label>
|
<label class="control-label" for="current_email">Current Email</label>
|
||||||
<div>{{email}}</div>
|
<div>{{ g.user.email }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
|
|
||||||
{% if g.user and g.user.is_moderator %}
|
{% if g.user and g.user.is_moderator %}
|
||||||
<h2>User Information</h2><br>
|
<h2>User Information</h2><br>
|
||||||
|
<div class="row" style="margin-bottom: 20px;">
|
||||||
|
<div class="col-sm-2" style="max-width: 150px;">
|
||||||
|
<img class="avatar" src="https://nyaa.si/static/img/avatar/default.png">
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-10">
|
||||||
<dl class="dl-horizontal">
|
<dl class="dl-horizontal">
|
||||||
<dt>User ID:</dt>
|
<dt>User ID:</dt>
|
||||||
<dd>{{ user.id }}</dd>
|
<dd>{{ user.id }}</dd>
|
||||||
|
@ -19,6 +24,8 @@
|
||||||
<dd>{{ user.ip_string }}</dd><br>
|
<dd>{{ user.ip_string }}</dd><br>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
</dl>
|
</dl>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% if admin_form %}
|
{% if admin_form %}
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
{{ admin_form.csrf_token }}
|
{{ admin_form.csrf_token }}
|
||||||
|
@ -34,7 +41,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
Browsing {{ user.username }}'s torrents
|
Browsing <span class="text-{{ user.userlevel_color }}">{{ user.username }}</span>'s torrents
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
{% include "search_results.html" %}
|
{% include "search_results.html" %}
|
||||||
|
|
|
@ -27,13 +27,13 @@
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
{% set user_url = torrent.user and url_for('view_user', user_name=torrent.user.username) %}
|
{% set user_url = torrent.user and url_for('view_user', user_name=torrent.user.username) %}
|
||||||
{%- if not torrent.anonymous and torrent.user -%}
|
{%- if not torrent.anonymous and torrent.user -%}
|
||||||
<a href="{{ user_url }}">{{ torrent.user.username }}</a>
|
<a class="text-{{ torrent.user.userlevel_color }}" href="{{ user_url }}">{{ torrent.user.username }}</a>
|
||||||
{%- else -%}
|
{%- 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 href="{{ user_url }}">{{ torrent.user.username }}</a>){% endif %}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if g.user and g.user.is_superadmin and torrent.uploader_ip -%}
|
{% if g.user and g.user.is_superadmin and torrent.uploader_ip %}
|
||||||
({{ torrent.uploader_ip_string }})
|
({{ torrent.uploader_ip_string }})
|
||||||
{%- endif -%}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-1">Seeders:</div>
|
<div class="col-md-1">Seeders:</div>
|
||||||
|
|
Loading…
Reference in a new issue