Add profiles to Trombi

This commit is contained in:
Skia
2017-05-12 10:25:26 +02:00
parent d88ffae51b
commit adeda41b52
6 changed files with 85 additions and 8 deletions

View File

@ -0,0 +1,35 @@
{% extends "core/base.jinja" %}
{% block title %}
{% trans user_name=trombi_user.user.get_display_name() %}{{ user_name }}'s Trombi profile{% endtrans %}
{% endblock %}
{% block content %}
<h3>{% trans user_name=trombi_user.user.get_display_name() %}{{ user_name }}'s Trombi profile{% endtrans %}</h3>
<p> <a href="{{ url('trombi:user_tools') }}">{% trans %}Back to tools{% endtrans %}</a></p>
<div>
{% set profile_file = None %}
{% set scrub_file = None %}
{% if trombi_user.profile_pict %}
{% set profile_file = trombi_user.profile_pict.url %}
{% else %}
{% set profile_file = static('core/img/na.gif') %}
{% endif %}
{% if trombi_user.scrub_pict %}
{% set scrub_file = trombi_user.scrub_pict.url %}
{% else %}
{% set scrub_file = static('core/img/na.gif') %}
{% endif %}
<div style="max-width: 410px; margin: auto;">
<img src="{{ profile_file }}" alt="" style="max-width: 200px">
<img src="{{ scrub_file }}" alt="" style="max-width: 200px">
</div>
<dl>
{% for c in trombi_user.received_comments.all() %}
<dt style="font-weight: bold; font-size: 110%">{{ c.author.user.get_display_name() }}</dt>
<dd>{{ c.content}}</dd>
{% endfor %}
</dl>
</div>
{% endblock %}

View File

@ -38,14 +38,21 @@
<img src="{{ file }}" alt="" style="max-width: 100px">
</div>
<div>{{ u.user.get_display_name() }}</div>
{% if can_comment %}
{% set comment = u.received_comments.filter(author__id=user.trombi_user.id).first() %}
{% if comment %}
<a href="{{ url("trombi:edit_comment", comment_id=comment.id) }}">{% trans %}Edit comment{% endtrans %}</a>
{% else %}
<a href="{{ url("trombi:new_comment", user_id=u.id) }}">{% trans %}Comment{% endtrans %}</a>
{% endif %}
{% if trombi.show_profiles %}
<div>
<a href="{{ url("trombi:user_profile", user_id=u.id) }}">{% trans %}Profile{% endtrans %}</a>
</div>
{% endif %}
<div>
{% if can_comment %}
{% set comment = u.received_comments.filter(author__id=user.trombi_user.id).first() %}
{% if comment %}
<a href="{{ url("trombi:edit_comment", comment_id=comment.id) }}">{% trans %}Edit comment{% endtrans %}</a>
{% else %}
<a href="{{ url("trombi:new_comment", user_id=u.id) }}">{% trans %}Comment{% endtrans %}</a>
{% endif %}
{% endif %}
</div>
</div>
{% endfor %}
</div>