mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-24 06:51:29 +01:00
Redesign user list
This commit is contained in:
parent
cd520a0251
commit
ab58570a0c
@ -81,7 +81,7 @@ def list_all():
|
|||||||
topics = qb.buildTopicQuery().all()
|
topics = qb.buildTopicQuery().all()
|
||||||
|
|
||||||
tags = db.session.query(func.count(Tags.c.tag_id), Tag) \
|
tags = db.session.query(func.count(Tags.c.tag_id), Tag) \
|
||||||
.select_from(Tag).outerjoin(Tags).group_by(Tag.id).order_by(db.asc(Tag.title))
|
.select_from(Tag).outerjoin(Tags).group_by(Tag.id).order_by(db.asc(Tag.title)).all()
|
||||||
|
|
||||||
selected_tags = set(qb.tags)
|
selected_tags = set(qb.tags)
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ from app.utils import randomString, loginUser, rank_required, nonEmptyOrNone, ad
|
|||||||
from app.tasks.forumtasks import checkForumAccount
|
from app.tasks.forumtasks import checkForumAccount
|
||||||
from app.tasks.emails import sendVerifyEmail, sendEmailRaw
|
from app.tasks.emails import sendVerifyEmail, sendEmailRaw
|
||||||
from app.tasks.phpbbparser import getProfile
|
from app.tasks.phpbbparser import getProfile
|
||||||
|
from sqlalchemy import func
|
||||||
|
|
||||||
# Define the User profile form
|
# Define the User profile form
|
||||||
class UserProfileForm(FlaskForm):
|
class UserProfileForm(FlaskForm):
|
||||||
@ -43,7 +44,11 @@ class UserProfileForm(FlaskForm):
|
|||||||
|
|
||||||
@bp.route("/users/", methods=["GET"])
|
@bp.route("/users/", methods=["GET"])
|
||||||
def list_all():
|
def list_all():
|
||||||
users = User.query.order_by(db.desc(User.rank), db.asc(User.display_name)).all()
|
users = db.session.query(User, func.count(Package.id)) \
|
||||||
|
.select_from(User).outerjoin(Package) \
|
||||||
|
.order_by(db.desc(User.rank), db.asc(User.display_name)) \
|
||||||
|
.group_by(User.id).all()
|
||||||
|
|
||||||
return render_template("users/list.html", users=users)
|
return render_template("users/list.html", users=users)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,20 +1,59 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
Users
|
{{ _("Users") }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<ul class="userlist">
|
<h1>{{ _("Users") }}</h1>
|
||||||
{% for user in users %}
|
|
||||||
<li>
|
<div class="userlist list-group">
|
||||||
<a href="{{ url_for('users.profile', username=user.username) }}" class="{{ user.rank }}">
|
<div class="list-group-item">
|
||||||
{{ user.display_name }}
|
<div class="row text-muted">
|
||||||
</a> -
|
<div class="col-sm-2">
|
||||||
{{ user.rank.getTitle() }}
|
{{ _("Rank") }}
|
||||||
{% if current_user.is_authenticated %}
|
</div>
|
||||||
- {{ user.packages.count() }} packages.
|
|
||||||
{% endif %}
|
<span class="col-sm">
|
||||||
|
{{ _("Username") }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div class="col-sm-1 text-center">
|
||||||
|
{{ _("Packages") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% for pair in users %}
|
||||||
|
{% set user = pair[0] %}
|
||||||
|
{% set count_pkgs = pair[1] %}
|
||||||
|
|
||||||
|
<a class="list-group-item list-group-item-action" href="{{ url_for('users.profile', username=user.username) }}">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2 {{ user.rank }}"
|
||||||
|
title="{{ _('Rank: %(rank)s.', rank=user.rank.getTitle()) }}">
|
||||||
|
{% if user.rank == user.rank.ADMIN %}
|
||||||
|
<i class="fas fa-user-cog mr-2"></i>
|
||||||
|
{% elif user.rank == user.rank.MODERATOR %}
|
||||||
|
<i class="fas fa-user-shield mr-2"></i>
|
||||||
|
{% elif user.rank == user.rank.EDITOR %}
|
||||||
|
<i class="fas fa-user-edit mr-2"></i>
|
||||||
|
{% else %}
|
||||||
|
<i class="fas fa-user mr-2"></i>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{{ user.rank.getTitle() }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span class="col-sm {{ user.rank }}">
|
||||||
|
{{ user.display_name }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div class="col-sm-1 text-center">
|
||||||
|
<b>{{ count_pkgs }}</b>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user