nopaque/app/templates/users/profile.html.j2
2023-03-01 14:09:15 +01:00

139 lines
5.1 KiB
Django/Jinja

{% extends "base.html.j2" %}
{% import "materialize/wtf.html.j2" as wtf %}
{% block page_content %}
<div class="container">
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<div class="row">
<div class="col s1"></div>
<div class="col s3">
<br>
<br>
{% if user.avatar %}
<img src="{{ url_for('.profile_avatar', user_id=user_id) }}" alt="user-image" class="circle responsive-img">
{% else %}
<img src="{{ url_for('static', filename='images/user_avatar.png') }}" alt="user-image" class="circle responsive-img">
{% endif %}
</div>
<div class="col s1"></div>
<div class="col s7">
<div class="row">
<div class="col s12">
<h3 style="float:left">{{ user.username }}<span class="new badge green" id="public-information-badge" data-badge-caption="" style="margin-top:20px;"></span></h3>
</div>
<div class="col 12">
{% if user.show_last_seen %}
<div class="chip">Last seen: {{ last_seen }}</div>
{% endif %}
{% if user.location %}
<p><span class="material-icons" style="margin-right:20px; margin-top:20px;">location_on</span><i>{{ user.location }}</i></p>
{% endif %}
<p></p>
<br>
{% if user.about_me %}
<div style="border-left: solid 3px #E91E63; padding-left: 15px;">
<h5>About me</h5>
<p>{{ user.about_me }}</p>
</div>
{% endif %}
</div>
</div>
</div>
</div>
<p></p>
<br>
<div class="row">
<div class="col s1"></div>
<div class="col s8">
<table>
{% if user.full_name %}
<tr>
<td><span class="material-icons">person</span></td>
<td>{{ user.full_name }} </td>
</tr>
{% endif %}
{% if user.show_email %}
<tr>
<td><span class="material-icons">email</span></td>
<td>{{ user.email }}</td>
</tr>
{% endif %}
{% if user.website %}
<tr>
<td><span class="material-icons">laptop</span></td>
<td><a href="{{ user.website }}">{{ user.website }}</a></td>
</tr>
{% endif %}
{% if user.organization %}
<tr>
<td><span class="material-icons">business</span></td>
<td>{{ user.organization }}</td>
</tr>
{% endif %}
</table>
<br>
{% if user.show_member_since %}
<p><i>Member since: {{ member_since }}</i></p>
{% endif %}
<p></p>
<br>
{% if current_user.is_authenticated and current_user.hashid == user.id %}
<a class="waves-effect waves-light btn-small" href="{{ url_for('.edit_profile', user_id=current_user.id) }}">Edit profile</a>
{% endif %}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s6">
<div class="card">
<div class="card-content">
<h4>Followed corpora</h4>
<div class="followed-corpus-list no-autoinit"></div>
</div>
</div>
</div>
<div class="col s6">
<div class="card">
<div class="card-content">
<h4>Public corpora</h4>
<div class="public-corpus-list no-autoinit"></div>
</div>
</div>
</div>
</div>
</div>
{% endblock page_content %}
{% block scripts %}
{{ super() }}
<script>
let publicInformationBadge = document.querySelector('#public-information-badge');
if ("{{ user.id }}" == "{{ current_user.hashid }}") {
if ("{{ user.is_public }}" == "True") {
publicInformationBadge.dataset.badgeCaption = 'Your profile is public';
publicInformationBadge.classList.add('green');
publicInformationBadge.classList.remove('red');
} else {
publicInformationBadge.dataset.badgeCaption = 'Your profile is private';
publicInformationBadge.classList.add('red');
publicInformationBadge.classList.remove('green');
}
} else {
publicInformationBadge.remove();
}
let followedCorpusList = new FollowedCorpusList(document.querySelector('.followed-corpus-list'));
followedCorpusList.add({{ followed_corpora|tojson }});
let publicCorpusList = new PublicCorpusList(document.querySelector('.public-corpus-list'));
publicCorpusList.add({{ own_public_corpora|tojson }});
</script>
{% endblock scripts %}