contentdb/app/templates/users/profile.html

265 lines
8.3 KiB
HTML
Raw Normal View History

2018-03-18 19:14:55 +01:00
{% extends "base.html" %}
{% block title %}
{{ user.username }}
{% endblock %}
2023-07-15 20:11:41 +02:00
{% block headextra %}
<meta name="og:image" content="{{ user.get_profile_pic_url() }}"/>
{% endblock %}
{% block scriptextra %}
<script src="/static/quick_review_voting.js"></script>
{% endblock %}
2018-03-18 19:14:55 +01:00
{% block content %}
2020-12-05 02:20:00 +01:00
<article class="row mb-5">
<div class="col-auto image mx-0">
<img class="img-fluid user-photo img-thumbnail img-thumbnail-1" src="{{ user.get_profile_pic_url() }}" alt="{{ _('Profile picture') }}">
2020-12-05 02:20:00 +01:00
</div>
<div class="col">
2020-12-10 00:59:01 +01:00
{% if user.can_see_edit_profile(current_user) %}
<a class="btn btn-primary float-right" href="{{ url_for('users.profile_edit', username=user.username) }}">
2021-07-25 18:10:57 +02:00
<i class="fas fa-pen mr-1"></i>
2020-12-10 00:59:01 +01:00
{{ _("Edit Profile") }}
</a>
2021-01-29 20:38:14 +01:00
<a class="btn btn-secondary float-right mr-3" href="{{ url_for('todo.view_user', username=user.username) }}">
2021-07-25 18:10:57 +02:00
<i class="fas fa-tasks mr-1"></i>
2021-01-29 20:38:14 +01:00
{{ _("To Do List") }}
</a>
2022-01-21 00:30:56 +01:00
{% endif %}
<a class="btn btn-secondary float-right mr-3" href="{{ url_for('report.report', url=url_current()) }}">
2022-01-21 00:30:56 +01:00
<i class="fas fa-flag mr-1"></i>
{{ _("Report") }}
</a>
2020-12-10 00:59:01 +01:00
2023-06-19 22:27:49 +02:00
{% if current_user.is_authenticated and current_user.rank.at_least(current_user.rank.MODERATOR) %}
{% if not user.rank.at_least(current_user.rank) %}
2022-01-21 23:23:24 +01:00
<a class="btn btn-secondary float-right mr-3" href="{{ url_for('users.modtools', username=user.username) }}">
<i class="fas fa-user-shield mr-1"></i>
{{ _("Moderator Tools") }}
</a>
{% endif %}
{% if user.email %}
<a class="btn btn-secondary float-right mr-3" href="{{ url_for('admin.send_single_email', username=user.username) }}">
<i class="fas fa-envelope mr-1"></i>
{{ _("Send Email") }}
</a>
{% endif %}
2020-12-10 00:59:01 +01:00
{% endif %}
<h1 class="ml-3 my-0 {{ user.rank.name }}">
2020-12-05 02:20:00 +01:00
{{ user.display_name }}
2021-02-23 01:01:28 +01:00
{% if user.username != user.display_name %}
<span class="text-muted small ml-2">
({{ user.username }})
</span>
{% endif %}
2020-12-05 02:20:00 +01:00
</h1>
<div class="info-row mx-0 mt-2 mb-0">
<div class="btn-group-horizontal">
<span class="btn">
<i class="fas fa-user"></i>
<span class="count">
{{ user.rank.get_title() }}
2020-12-05 02:20:00 +01:00
</span>
</span>
{% if user.forums_username %}
<a class="btn" href="https://forum.minetest.net/memberlist.php?mode=viewprofile&un={{ user.forums_username }}">
<i class="fas fa-comments"></i>
<span class="count">
2020-12-05 02:24:27 +01:00
{{ _("Forums") }}
2020-12-05 02:20:00 +01:00
</span>
</a>
{% endif %}
{% if user.github_username %}
<a class="btn" href="https://github.com/{{ user.github_username }}">
<i class="fas fa-code-branch"></i>
<span class="count">
{{ _("GitHub") }}
</span>
</a>
{% endif %}
{% if user.website_url %}
2020-12-05 02:24:27 +01:00
<a class="btn" href="{{ user.website_url }}" rel="nofollow">
<i class="fas fa-globe-europe"></i>
<span class="count">
{{ _("Website") }}
</span>
</a>
2020-12-05 02:20:00 +01:00
{% endif %}
{% if user.donate_url %}
2020-12-05 02:24:27 +01:00
<a class="btn" href="{{ user.donate_url }}" rel="nofollow">
<i class="fas fa-donate"></i>
<span class="count">
{{ _("Donate") }}
</span>
</a>
2020-12-05 02:20:00 +01:00
{% endif %}
2022-11-09 19:47:44 +01:00
{% set package_count = user.packages.filter_by(state='APPROVED').count() %}
2020-12-05 02:20:00 +01:00
<a class="btn" href="{{ url_for('packages.list_all', author=user.username) }}">
<i class="fas fa-box"></i>
<span class="count">
2022-11-09 19:47:44 +01:00
<strong>{{ package_count }}</strong>
2020-12-05 02:20:00 +01:00
{{ _("packages") }}
</span>
</a>
2023-08-14 22:48:50 +02:00
{% set collection_count = user.collections.filter_by(private=False).count() %}
<a class="btn" href="{{ url_for('collections.list_all', author=user.username) }}">
<i class="fas fa-list"></i>
<span class="count">
<strong>{{ collection_count }}</strong>
{{ _("collections") }}
</span>
</a>
2020-12-05 02:20:00 +01:00
<a class="btn" href="#reviews">
<i class="fas fa-star-half-alt"></i>
<span class="count">
{% set num_reviews = user.reviews | length %}
<strong>{{ num_reviews }}</strong>
2020-12-05 02:20:00 +01:00
{{ _("reviews") }}
</span>
</a>
2022-01-03 02:44:12 +01:00
<a class="btn" href="{{ url_for('threads.user_comments', username=user.username) }}">
2020-12-05 02:20:00 +01:00
<i class="fas fa-comment"></i>
<span class="count">
<strong>{{ user.replies.count() }}</strong>
{{ _("comments") }}
</span>
2022-01-03 02:41:50 +01:00
</a>
2022-11-09 19:47:44 +01:00
{% if package_count %}
<a class="btn" href="{{ url_for('users.statistics', username=user.username) }}">
<i class="fas fa-chart-line"></i>
<span class="count">
{{ _("Statistics") }}
</span>
</a>
{% endif %}
2018-12-22 21:13:43 +01:00
</div>
</div>
</div>
2020-12-05 02:20:00 +01:00
</article>
2018-03-18 19:14:55 +01:00
2020-12-05 02:20:00 +01:00
{% if not current_user.is_authenticated and user.rank == user.rank.NOT_JOINED and user.forums_username %}
<div class="alert alert-secondary mb-5">
<a class="float-right btn btn-default btn-sm"
2022-01-08 00:27:00 +01:00
href="{{ url_for('users.claim_forums', username=user.forums_username) }}">{{ _("Claim") }}</a>
2020-12-05 02:20:00 +01:00
2022-01-08 00:27:00 +01:00
{{ _("Is this you? Claim your account now!") }}
2018-05-18 05:06:27 +02:00
</div>
2021-07-25 17:09:21 +02:00
{% else %}
<div class="row mb-5">
2021-07-26 00:41:34 +02:00
{% for medal in medals_unlocked %}
2021-07-25 17:09:21 +02:00
<div class="col-md-4">
<div class="card h-100">
2021-07-25 17:09:21 +02:00
<div class="card-body media align-items-center">
2021-07-26 00:41:34 +02:00
<i class="fas {{ medal.icon }} ml-2 mr-4 text-size"
style="font-size: 45px; color: {{ medal.color }};"></i>
<div class="media-body">
<h5 class="mt-0">
2021-07-26 00:41:34 +02:00
{{ medal.title }}
</h5>
<p class="my-0">
2021-07-26 00:41:34 +02:00
{{ medal.description }}
</p>
</div>
</div>
</div>
</div>
2021-07-26 00:41:34 +02:00
{% endfor %}
2023-06-19 22:27:49 +02:00
{% if current_user == user or (current_user.is_authenticated and current_user.rank.at_least(current_user.rank.ADMIN)) %}
2021-07-26 00:41:34 +02:00
{% for medal in medals_locked %}
{% set value = medal.progress[0] %}
{% set target = medal.progress[1] %}
2021-07-26 00:41:34 +02:00
<div class="col-md-4">
<div class="border border-dark rounded p-3 text-muted my-0 h-100">
2021-07-26 00:41:34 +02:00
<p>
{{ medal.description }}
</p>
<div class="progress">
<div class="progress-bar" role="progressbar"
style="width: {{ [100 * value / target, 100] | min }}%;"
aria-valuenow="{{ value }}" aria-valuemin="0" aria-valuemax="{{ target }}">
{% if value >= target * 0.2 %}
{{ _("%(value)d / %(target)d", value=value, target=target) }}
{% endif %}
2021-07-26 00:41:34 +02:00
</div>
{% if value < target * 0.2 %}
<div class="ml-3 d-flex align-items-center text-muted h-100">
{{ _("%(value)d / %(target)d", value=medal.progress[0], target=medal.progress[1]) }}
</div>
{% endif %}
</div>
</div>
</div>
2021-07-26 00:41:34 +02:00
{% endfor %}
2021-07-25 19:17:59 +02:00
{% endif %}
</div>
2018-03-18 19:14:55 +01:00
{% endif %}
2020-12-05 02:20:00 +01:00
2023-08-13 14:29:32 +02:00
<div class="float-right">
{% if packages %}
<div class="btn-group btn-group-sm mr-2" role="group" aria-label="Sorting">
<span class="btn btn-sm btn-primary">
{{ _("Alphabetical") }}
</span>
<a href="{{ url_for('packages.list_all', author=user.username, sort='downloads', order='desc') }}"
class="btn btn-sm btn-secondary">
{{ _("Downloads") }}
</a>
<a href="{{ url_for('packages.list_all', author=user.username, sort='approved_at', order='desc') }}"
class="btn btn-sm btn-secondary">
{{ _("Newest") }}
</a>
</div>
{% if current_user == user or (current_user.is_authenticated and current_user.rank.at_least(current_user.rank.EDITOR)) %}
<a class="btn btn-sm btn-secondary mr-2"
href="{{ url_for('todo.tags', author=user.username) }}">
{{ _("View list of tags") }}
</a>
{% endif %}
{% endif %}
{% if current_user == user or user.check_perm(current_user, "CHANGE_AUTHOR") %}
<a class="btn btn-sm btn-primary"
href="{{ url_for('packages.create_edit', author=user.username) }}">
<i class="fas fa-plus mr-1"></i>
{{ _("Create package") }}
</a>
{% endif %}
</div>
2020-07-10 20:10:36 +02:00
<h2 class="my-3">{{ _("Packages") }}</h2>
2018-05-29 23:58:46 +02:00
{% from "macros/packagegridtile.html" import render_pkggrid %}
{{ render_pkggrid(packages, show_author=False) }}
2020-07-10 20:10:36 +02:00
{% if maintained_packages %}
<h2 class="my-3">{{ _("Maintained Packages") }}</h2>
<p class="text-muted">
{{ _("This user is also a maintainer of the following packages") }}
</p>
{{ render_pkggrid(maintained_packages) }}
{% endif %}
2020-12-05 02:20:00 +01:00
<h2 class="my-3" id="reviews">{{ _("Reviews") }}</h2>
2021-08-18 23:09:41 +02:00
{% from "macros/reviews.html" import render_reviews with context %}
2020-07-10 20:10:36 +02:00
{{ render_reviews(user.reviews, current_user, True) }}
{% endblock %}