contentdb/app/templates/users/profile.html

211 lines
6.4 KiB
HTML

{% extends "base.html" %}
{% block title %}
{{ user.username }}
{% endblock %}
{% block content %}
<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.getProfilePicURL() }}" alt="{{ _('Profile picture') }}">
</div>
<div class="col">
{% if user.can_see_edit_profile(current_user) %}
<a class="btn btn-primary float-end" href="{{ url_for('users.profile_edit', username=user.username) }}">
<i class="fas fa-pen me-1"></i>
{{ _("Edit Profile") }}
</a>
<a class="btn btn-secondary float-end me-3" href="{{ url_for('todo.view_user', username=user.username) }}">
<i class="fas fa-tasks me-1"></i>
{{ _("To Do List") }}
</a>
{% endif %}
<a class="btn btn-secondary float-end me-3" href="{{ url_for('report.report', url=url_current()) }}">
<i class="fas fa-flag me-1"></i>
{{ _("Report") }}
</a>
{% if current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.MODERATOR) %}
{% if not user.rank.atLeast(current_user.rank) %}
<a class="btn btn-secondary float-end me-3" href="{{ url_for('users.modtools', username=user.username) }}">
<i class="fas fa-user-shield me-1"></i>
{{ _("Moderator Tools") }}
</a>
{% endif %}
{% if user.email %}
<a class="btn btn-secondary float-end me-3" href="{{ url_for('admin.send_single_email', username=user.username) }}">
<i class="fas fa-envelope me-1"></i>
{{ _("Send Email") }}
</a>
{% endif %}
{% endif %}
<h1 class="ms-3 my-0 {{ user.rank.name }}">
{{ user.display_name }}
{% if user.username != user.display_name %}
<span class="text-muted small ms-2">
({{ user.username }})
</span>
{% endif %}
</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.getTitle() }}
</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">
{{ _("Forums") }}
</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 %}
<a class="btn" href="{{ user.website_url }}" rel="nofollow">
<i class="fas fa-globe-europe"></i>
<span class="count">
{{ _("Website") }}
</span>
</a>
{% endif %}
{% if user.donate_url %}
<a class="btn" href="{{ user.donate_url }}" rel="nofollow">
<i class="fas fa-donate"></i>
<span class="count">
{{ _("Donate") }}
</span>
</a>
{% endif %}
<a class="btn" href="{{ url_for('packages.list_all', author=user.username) }}">
<i class="fas fa-box"></i>
<span class="count">
<strong>{{ user.packages.count() }}</strong>
{{ _("packages") }}
</span>
</a>
<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>
{{ _("reviews") }}
</span>
</a>
<a class="btn" href="{{ url_for('threads.user_comments', username=user.username) }}">
<i class="fas fa-comment"></i>
<span class="count">
<strong>{{ user.replies.count() }}</strong>
{{ _("comments") }}
</span>
</a>
</div>
</div>
</div>
</article>
{% 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-end btn btn-default btn-sm"
href="{{ url_for('users.claim_forums', username=user.forums_username) }}">{{ _("Claim") }}</a>
{{ _("Is this you? Claim your account now!") }}
</div>
{% else %}
<div class="row mb-5">
{% for medal in medals_unlocked %}
<div class="col-md-4">
<div class="card h-100">
<div class="card-body d-flex align-items-center">
<i class="flex-shrink-0 fas {{ medal.icon }} ms-2 me-4 text-size"
style="font-size: 45px; color: {{ medal.color }};"></i>
<div class="flex-grow-1 ms-3">
<h5 class="mt-0">
{{ medal.title }}
</h5>
<p class="my-0">
{{ medal.description }}
</p>
</div>
</div>
</div>
</div>
{% endfor %}
{% if current_user == user or (current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.ADMIN)) %}
{% for medal in medals_locked %}
<div class="col-md-4">
<div class="border border-dark rounded p-3 text-muted my-0 h-100">
<p>
{{ medal.description }}
</p>
<div class="progress">
<div class="progress-bar" role="progressbar"
style="width: {{ [100 * medal.progress[0] / medal.progress[1], 100] | min }}%;"
aria-valuenow="{{ medal.progress[0] }}" aria-valuemin="0" aria-valuemax="{{ medal.progress[1] }}">
{{ _("%(value)d / %(target)d", value=medal.progress[0], target=medal.progress[1]) }}
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}
</div>
{% endif %}
{% if current_user == user or user.checkPerm(current_user, "CHANGE_AUTHOR") %}
<a class="float-end btn btn-sm btn-primary"
href="{{ url_for('packages.create_edit', author=user.username) }}">
<i class="fas fa-plus me-1"></i>
{{ _("Create package") }}
</a>
{% endif %}
{% if current_user == user or (current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.EDITOR)) %}
<a class="float-end btn btn-sm btn-secondary me-2"
href="{{ url_for('todo.tags', author=user.username) }}">
{{ _("View list of tags") }}
</a>
{% endif %}
<h2 class="my-3">{{ _("Packages") }}</h2>
{% from "macros/packagegridtile.html" import render_pkggrid %}
{{ render_pkggrid(packages, show_author=False) }}
{% 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 %}
<h2 class="my-3" id="reviews">{{ _("Reviews") }}</h2>
{% from "macros/reviews.html" import render_reviews with context %}
{{ render_reviews(user.reviews, current_user, True) }}
{% endblock %}