contentdb/app/templates/users/profile.html

248 lines
7.5 KiB
HTML
Raw Normal View History

2018-03-18 19:14:55 +01:00
{% extends "base.html" %}
{% block title %}
{{ user.username }}
{% endblock %}
{% block content %}
2020-12-05 02:20:00 +01:00
<article class="row mb-5">
<div class="col-auto image mx-0">
2020-12-10 00:59:01 +01:00
<img class="img-fluid user-photo img-thumbnail img-thumbnail-1" src="{{ user.getProfilePicURL() }}" 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>
2020-12-10 00:59:01 +01:00
{% endif %}
{% if current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.MODERATOR) and user.email %}
2020-12-10 00:59:01 +01:00
<a class="btn btn-secondary float-right mr-3" href="{{ url_for('admin.send_single_email', username=user.username) }}">
2021-07-25 18:10:57 +02:00
<i class="fas fa-envelope mr-1"></i>
{{ _("Send Email") }}
2020-12-10 00:59:01 +01:00
</a>
{% 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.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">
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 %}
<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">
<strong>{{ user.reviews | length }}</strong>
{{ _("reviews") }}
</span>
</a>
<span>
<i class="fas fa-comment"></i>
<span class="count">
<strong>{{ user.replies.count() }}</strong>
{{ _("comments") }}
</span>
</span>
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"
2020-12-22 11:58:43 +01:00
href="{{ url_for('users.claim_forums', username=user.forums_username) }}">Claim</a>
2020-12-05 02:20: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">
{% if review_percent is not none and review_percent < 25 and review_idx >= 0 %}
<div class="col-md-4">
<div class="card">
{% if review_idx == 0 %}
{% set badge_color = "gold" %}
{% elif review_idx == 1 %}
{% set badge_color = "#888" %}
{% elif review_idx == 2 %}
{% set badge_color = "#cd7f32" %}
{% else %}
{% set badge_color = "white" %}
{% endif %}
<div class="card-body media align-items-center">
2021-07-25 18:10:57 +02:00
<i class="fas fa-star-half-alt ml-2 mr-4 text-size" style="font-size: 45px; color: {{ badge_color }};"></i>
2021-07-25 17:09:21 +02:00
<div class="media-body">
{% if review_idx == 0 %}
<h5 class="mt-0">
{{ _("Most reviews", perc=review_percent) }}
</h5>
<p class="my-0">
{{ _("%(display_name)s has written the most reviews on ContentDB.",
display_name=user.display_name) }}
</p>
{% elif review_idx <= 2 %}
<h5 class="mt-0">
{% if review_idx == 1 %}
{{ _("2nd most reviews", perc=review_percent) }}
{% else %}
{{ _("3rd most reviews", perc=review_percent) }}
{% endif %}
</h5>
<p class="my-0">
{{ _("This puts %(display_name)s in the top %(perc)s%%",
display_name=user.display_name, perc=review_percent) }}
</p>
{% else %}
<h5 class="mt-0">
{{ _("Top %(perc)s%% reviewer", perc=review_percent) }}
</h5>
<p class="my-0">
{% if review_idx == 1 %}
{{ _("Only 1 user has written more reviews.") }}
{% else %}
{{ _("Only %(place)d users have written more reviews.", place=review_idx) }}
{% endif %}
</p>
{% endif %}
</div>
</div>
</div>
</div>
{% elif current_user == user %}
<div class="col-md-4">
2021-07-25 17:36:39 +02:00
<p class="border border-dark rounded p-3 text-muted my-0">
2021-07-25 17:09:21 +02:00
{{ _("Consider writing more reviews to get a badge.") }}
{% if review_idx %}
{{ _("You are in place %(place)s.", place=review_idx + 1) }}
{% endif %}
2021-07-25 17:36:39 +02:00
</p>
2021-07-25 17:09:21 +02:00
</div>
{% endif %}
{% if total_downloads >= 50000 %}
{% if total_downloads >= 300000 %}
{% set badge_color = "gold" %}
{% elif total_downloads >= 100000 %}
{% set badge_color = "#888" %}
{% elif total_downloads >= 75000 %}
{% set badge_color = "#cd7f32" %}
{% else %}
{% set badge_color = "white" %}
{% endif %}
<div class="col-md-4">
<div class="card">
<div class="card-body media align-items-center">
<i class="fas fa-users ml-2 mr-4 text-size" style="font-size: 45px; color: {{ badge_color }};"></i>
<div class="media-body">
<h5 class="mt-0">
{% if total_downloads >= 300000 %}
{{ _(">300k downloads") }}
{% elif total_downloads >= 100000 %}
{{ _(">100k downloads") }}
{% elif total_downloads >= 75000 %}
{{ _(">75k downloads") }}
{% else %}
{{ _(">50k downloads") }}
{% endif %}
</h5>
<p class="my-0">
{{ _("Has received %(downloads)d downloads across all packages.",
display_name=user.display_name, downloads=total_downloads) }}
</p>
</div>
</div>
</div>
</div>
{% endif %}
</div>
2018-03-18 19:14:55 +01:00
{% endif %}
2020-12-05 02:20:00 +01:00
{% if current_user == user or user.checkPerm(current_user, "CHANGE_AUTHOR") %}
<a class="float-right 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 %}
{% if current_user == user or (current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.EDITOR)) %}
<a class="float-right btn btn-sm btn-secondary mr-2"
href="{{ url_for('todo.tags', author=user.username) }}">
View list of tags
</a>
{% endif %}
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
2020-12-05 02:20:00 +01:00
<h2 class="my-3" id="reviews">{{ _("Reviews") }}</h2>
2020-07-10 20:10:36 +02:00
{% from "macros/reviews.html" import render_reviews %}
{{ render_reviews(user.reviews, current_user, True) }}
{% endblock %}