mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 19:19: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'
|
||||
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 userlevel_color(self):
|
||||
|
|
|
@ -480,8 +480,6 @@ def profile():
|
|||
|
||||
form = forms.ProfileForm(flask.request.form)
|
||||
|
||||
level = ['Regular', 'Trusted', 'Moderator', 'Administrator'][flask.g.user.level]
|
||||
|
||||
if flask.request.method == 'POST' and form.validate():
|
||||
user = flask.g.user
|
||||
new_email = form.email.data.strip()
|
||||
|
@ -511,12 +509,7 @@ def profile():
|
|||
flask.g.user = user
|
||||
return flask.redirect('/profile')
|
||||
|
||||
_user = models.User.by_id(flask.g.user.id)
|
||||
username = _user.username
|
||||
current_email = _user.email
|
||||
|
||||
return flask.render_template('profile.html', form=form, name=username, email=current_email,
|
||||
level=level)
|
||||
return flask.render_template('profile.html', form=form)
|
||||
|
||||
|
||||
@app.route('/user/activate/<payload>')
|
||||
|
|
|
@ -258,15 +258,16 @@ a.text-purple:hover, a.text-purple:active, a.text-purple:focus { color: #a760e0;
|
|||
}
|
||||
|
||||
.btn-grey {
|
||||
color: #000000;
|
||||
background-color: #cccfd2;
|
||||
border-color: #ccc;
|
||||
color: #000000;
|
||||
background-color: #cccfd2;
|
||||
border-color: #ccc;
|
||||
}
|
||||
.btn-grey:hover, .btn-grey:focus, .btn-grey:active, .btn-grey.active, .open > .dropdown-toggle.btn-grey {
|
||||
background-color: #aaaaaa;
|
||||
background-color: #aaaaaa;
|
||||
}
|
||||
.btn span.glyphicon {
|
||||
opacity: 0;
|
||||
}
|
||||
.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" />
|
||||
|
||||
<!-- 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 -->
|
||||
<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">
|
||||
<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>
|
||||
{{g.user.username}}
|
||||
{{ g.user.username }}
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<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 %}
|
||||
{% 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="col-sm-4 avatar" style="display: none;">
|
||||
<!-- TO BE IMPLEMENTED -->
|
||||
<div class="row" style="margin-bottom: 20px;">
|
||||
<div class="col-sm-2" style="max-width: 150px;">
|
||||
<img class="avatar" src="{{ g.user.gravatar_url() }}">
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="col-sm-10">
|
||||
<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-3">User Class:</dt><dd class="col-sm-9">{{ level }}</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 ID:</dt><dd class="col-sm-10">{{ g.user.id }}</dd>
|
||||
<dt class="col-sm-2">User Class:</dt><dd class="col-sm-10">{{ g.user.userlevel_str }}</dd>
|
||||
<dt class="col-sm-2">User Created on:</dt><dd class="col-sm-10">{{ g.user.created_time }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -59,7 +59,7 @@
|
|||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<label class="control-label" for="current_email">Current Email</label>
|
||||
<div>{{email}}</div>
|
||||
<div>{{ g.user.email }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
|
@ -5,20 +5,27 @@
|
|||
|
||||
{% if g.user and g.user.is_moderator %}
|
||||
<h2>User Information</h2><br>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>User ID:</dt>
|
||||
<dd>{{ user.id }}</dd>
|
||||
<dt>Account created on:</dt>
|
||||
<dd>{{ user.created_time }}</dd>
|
||||
<dt>Email address:</dt>
|
||||
<dd>{{ user.email }}</dd>
|
||||
<dt>User class:</dt>
|
||||
<dd>{{ level }}</dd>
|
||||
{%- if g.user.is_superadmin -%}
|
||||
<dt>Last login IP:</dt>
|
||||
<dd>{{ user.ip_string }}</dd><br>
|
||||
{%- endif -%}
|
||||
</dl>
|
||||
<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">
|
||||
<dt>User ID:</dt>
|
||||
<dd>{{ user.id }}</dd>
|
||||
<dt>Account created on:</dt>
|
||||
<dd>{{ user.created_time }}</dd>
|
||||
<dt>Email address:</dt>
|
||||
<dd>{{ user.email }}</dd>
|
||||
<dt>User class:</dt>
|
||||
<dd>{{ level }}</dd>
|
||||
{%- if g.user.is_superadmin -%}
|
||||
<dt>Last login IP:</dt>
|
||||
<dd>{{ user.ip_string }}</dd><br>
|
||||
{%- endif -%}
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
{% if admin_form %}
|
||||
<form method="POST">
|
||||
{{ admin_form.csrf_token }}
|
||||
|
@ -34,7 +41,7 @@
|
|||
{% endif %}
|
||||
|
||||
<h3>
|
||||
Browsing {{ user.username }}'s torrents
|
||||
Browsing <span class="text-{{ user.userlevel_color }}">{{ user.username }}</span>'s torrents
|
||||
</h3>
|
||||
|
||||
{% include "search_results.html" %}
|
||||
|
|
|
@ -25,15 +25,15 @@
|
|||
<div class="row">
|
||||
<div class="col-md-1">Submitter:</div>
|
||||
<div class="col-md-5">
|
||||
{% set user_url = torrent.user and url_for('view_user', user_name=torrent.user.username) %}
|
||||
{%- if not torrent.anonymous and torrent.user -%}
|
||||
<a href="{{ user_url }}">{{ 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 %}
|
||||
{%- endif -%}
|
||||
{%- if g.user and g.user.is_superadmin and torrent.uploader_ip -%}
|
||||
({{ torrent.uploader_ip_string }})
|
||||
{%- endif -%}
|
||||
{% set user_url = torrent.user and url_for('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>
|
||||
{%- else -%}
|
||||
Anonymous {% if torrent.user and (g.user == torrent.user or g.user.is_moderator) %}(<a href="{{ user_url }}">{{ torrent.user.username }}</a>){% endif %}
|
||||
{%- endif -%}
|
||||
{% if g.user and g.user.is_superadmin and torrent.uploader_ip %}
|
||||
({{ torrent.uploader_ip_string }})
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">Seeders:</div>
|
||||
|
|
Loading…
Reference in a new issue