Avatar condition and breadcrumb update

This commit is contained in:
Inga Kirschnick 2023-03-14 14:21:23 +01:00
parent 777151b2bf
commit f1be57e509
5 changed files with 7 additions and 15 deletions

View File

@ -35,13 +35,13 @@ def dashboard():
@bp.route('/user_manual')
@register_breadcrumb(bp, '.user_manual', 'User manual')
@register_breadcrumb(bp, '.user_manual', '<i class="material-icons left">help</i>User manual')
def user_manual():
return render_template('main/user_manual.html.j2', title='User manual')
@bp.route('/news')
@register_breadcrumb(bp, '.news', 'News')
@register_breadcrumb(bp, '.news', '<i class="material-icons left">email</i>News')
def news():
return render_template('main/news.html.j2', title='News')
@ -59,7 +59,7 @@ def terms_of_use():
@bp.route('/social-area')
@register_breadcrumb(bp, '.social_area', 'Social Area')
@register_breadcrumb(bp, '.social_area', '<i class="material-icons left">group</i>Social Area')
def social_area():
users = [
u.to_json_serializeable(relationships=True, filter_by_privacy_settings=True,) for u

View File

@ -70,11 +70,7 @@
<div class="row">
<div class="col s2"></div>
<div class="col s8">
{% if user.avatar %}
<img src="{{ url_for('.profile_avatar', user_id=user.id) }}" alt="user-image" class="circle responsive-img" id="avatar">
{% else %}
<img src="{{ url_for('static', filename='images/user_avatar.png') }}" alt="user-image" class="circle responsive-img" id="avatar">
{% endif %}
</div>
<div class="col s2"></div>
</div>

View File

@ -12,11 +12,7 @@
<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">

View File

@ -26,7 +26,7 @@ from .utils import (
@bp.route('')
@register_breadcrumb(bp, '.', '<i class="material-icons left">group</i>Users')
@register_breadcrumb(bp, '.', '<i class="material-icons left">group</i>Social Area')
@login_required
def users():
return redirect(url_for('main.social_area', _anchor='users'))
@ -65,7 +65,7 @@ def user(user_id):
def profile_avatar(user_id):
user = User.query.get_or_404(user_id)
if user.avatar is None:
return redirect(url_for('static', filename='images/default_avatar.png'))
return redirect(url_for('static', filename='images/user_avatar.png'))
if not user.is_public and not (user == current_user or current_user.is_administrator()):
abort(403)
return send_from_directory(
@ -78,7 +78,7 @@ def profile_avatar(user_id):
@bp.route('/<hashid:user_id>/edit', methods=['GET', 'POST'])
@register_breadcrumb(bp, '.entity.edit', 'Edit', endpoint_arguments_constructor=user_eac)
@register_breadcrumb(bp, '.entity.edit', '<i class="material-icons left">settings</i>Edit', endpoint_arguments_constructor=user_eac)
@login_required
def edit_profile(user_id):
user = User.query.get_or_404(user_id)

View File

@ -11,7 +11,7 @@ def user_dynamic_list_constructor():
user = User.query.get_or_404(user_id)
return [
{
'text': f'<i class="material-icons left">account_circle</i>{user.username}',
'text': f'<i class="material-icons left">person</i>{user.username}',
'url': url_for('.user', user_id=user_id)
}
]