Update profile page with avatar

This commit is contained in:
Inga Kirschnick
2022-12-05 09:40:02 +01:00
parent 620d9d1ea2
commit be517a04af
10 changed files with 160 additions and 155 deletions

View File

@ -5,18 +5,23 @@
<div class="container">
<div class="row">
<div class="col s12">
<h1 id="title">{{ title }}</h1>
</div>
<h1 id="title">{{ title }}</h1>
</div>
<div class="col s12">
<form method="POST">
{{ edit_profile_settings_form.hidden_tag() }}
<div class="card">
<div class="card">
<form method="POST" enctype="multipart/form-data">
<div class="card-content">
{{ edit_profile_settings_form.hidden_tag() }}
<div class="row">
<div class="col s1"></div>
<div class="col s3">
{% if current_user.avatar %}
<img src="{{ url_for('profile.avatar_download', avatar_id=current_user.avatar.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">
{{wtf.render_field(edit_profile_settings_form.user_avatar, accept='image/*', class='file-path validate')}}
{% endif %}
{{wtf.render_field(edit_profile_settings_form.avatar, accept='image/jpeg, image/png, image/gif', class='file-path validate')}}
</div>
<div class="col s1"></div>
<div class="col s7">
@ -35,8 +40,8 @@
{{ wtf.render_field(edit_profile_settings_form.submit, material_icon='send') }}
</div>
</div>
</div>
</form>
</form>
</div>
</div>
</div>
</div>

View File

@ -9,27 +9,26 @@
<div class="card-content">
<div class="row">
<div class="col s1"></div>
<div class="col s3">
{% if about_me %}
<img src="{{ user_image }}" alt="user-image" class="circle responsive-img" style="margin-top:50px;">
<div class="col s4">
{% if user.avatar %}
<img src="{{ url_for('profile.avatar_download', avatar_id=user.avatar.id) }}" alt="user-image" class="circle responsive-img">
{% else %}
<img src="{{ user_image }}" alt="user-image" class="circle responsive-img">
<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">
<h3>{{ user_name }}</h3>
<div class="chip">Last seen: {{ last_seen }}</div>
{% if location %}
<p><span class="material-icons" style="margin-right:20px; margin-top:20px;">location_on</span><i>{{ location }}</i></p>
<h3>{{ user.username }}</h3>
<div class="chip">Last seen: {{ user.last_seen.strftime('%Y-%m-%d %H:%M') }}</div>
{% 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 about_me%}
{% if user.about_me%}
<div class="card">
<div class="card-content">
<span class="card-title">About me</span>
<p>{{ about_me }}</p>
<p>{{ user.about_me }}</p>
</div>
</div>
{% endif %}
@ -39,47 +38,41 @@
<div class="col s1"></div>
<div class="col s6">
<table>
{% if full_name %}
{% if user.full_name %}
<tr>
<td><span class="material-icons">person</span></td>
<td>{{ full_name }} </td>
<td>{{ user.full_name }} </td>
</tr>
{% endif %}
{% if email %}
{% if user.email %}
<tr>
<td><span class="material-icons">email</span></td>
<td>{{ email }}</td>
<td>{{ user.email }}</td>
</tr>
{% endif %}
{% if website %}
{% if user.website %}
<tr>
<td><span class="material-icons">laptop</span></td>
<td><a href="{{ website }}">{{ website }}</a></td>
<td><a href="{{ user.website }}">{{ user.website }}</a></td>
</tr>
{% endif %}
{% if organization %}
{% if user.organization %}
<tr>
<td><span class="material-icons">business</span></td>
<td>{{ organization }}</td>
<td>{{ user.organization }}</td>
</tr>
{% endif %}
</table>
<br>
<p><i>Member since: {{ member_since }}</i></p>
<p><i>Member since: {{ user.member_since.strftime('%Y-%m-%d') }}</i></p>
<p></p>
<br>
<a class="waves-effect waves-light btn-small" href="{{ url_for('settings.settings') }}">Edit profile</a>
<a class="waves-effect waves-light btn-small" href="{{ url_for('profile.edit_profile') }}">Edit profile</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s6">
</div>
</div>
</div>
{% endblock page_content %}

View File

@ -27,7 +27,13 @@
<div class="card">
<div class="card-content">
<span class="card-title">Privacy settings</span>
{{ wtf.render_field(edit_privacy_settings_form.public_profile) }}
<br>
{{ wtf.render_field(edit_privacy_settings_form.private_profile) }}
<br>
{{ wtf.render_field(edit_privacy_settings_form.private_email) }}
<br>
{{ wtf.render_field(edit_privacy_settings_form.only_username) }}
<br>
</div>
<div class="card-action">
<div class="right-align">