List aliases on profile page

This commit is contained in:
Alexandre Iooss 2020-08-23 12:07:04 +02:00
parent cbc3e39bd6
commit 44b7fe8f52
3 changed files with 44 additions and 43 deletions

View File

@ -1,6 +1,7 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static i18n pretty_money %} {% comment %}
{% load render_table from django_tables2 %} SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{# Use a fluid-width container #} {# Use a fluid-width container #}
{% block containertype %}container-fluid{% endblock %} {% block containertype %}container-fluid{% endblock %}
@ -9,10 +10,12 @@
<div class="row mt-4"> <div class="row mt-4">
<div class="col-xl-4"> <div class="col-xl-4">
{% block profile_info %} {% block profile_info %}
{% include "member/profile_info.html" %}
{% endblock %} {% endblock %}
</div> </div>
<div class="col-xl-8"> <div class="col-xl-8">
{% block profile_content %} {% block profile_content %}
{% include "member/profile_tables.html" %}
{% endblock %} {% endblock %}
</div> </div>
</div> </div>

View File

@ -1,18 +1,10 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% block profile_info %}
{% include "member/profile_info.html" %}
{% endblock %}
{% block profile_content %}
{% include "member/profile_tables.html" %}
{% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
<script> <script>
function refreshHistory() { function refreshHistory() {
$("#history_list").load("{% url 'member:user_detail' pk=user_object.pk %} #history_list"); $("#history_list").load("{% url 'member:user_detail' pk=user_object.pk %} #history_list");
$("#profile_infos").load("{% url 'member:user_detail' pk=user_object.pk %} #profile_infos"); $("#profile_infos").load("{% url 'member:user_detail' pk=user_object.pk %} #profile_infos");
} }
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,12 +1,12 @@
{% load i18n static pretty_money perms %} {% load i18n pretty_money perms %}
<div class="card bg-light shadow"> <div class="card bg-light shadow">
<div class="card-header text-center" > <div class="card-header text-center">
<h4> {% trans "Account #" %} {{ user_object.pk }}</h4> <h4>{% trans "Account #" %}{{ user_object.pk }}</h4>
</div> </div>
<div class="card-top text-center"> <div class="card-top text-center">
<a href="{% url 'member:user_update_pic' user_object.pk %}"> <a href="{% url 'member:user_update_pic' user_object.pk %}">
<img src="{{ user_object.note.display_image.url }}" class="img-thumbnail mt-2" > <img src="{{ user_object.note.display_image.url }}" class="img-thumbnail mt-2">
</a> </a>
</div> </div>
<div class="card-body" id="profile_infos"> <div class="card-body" id="profile_infos">
@ -18,12 +18,12 @@
<dd class="col-xl-6">{{ user_object.username }}</dd> <dd class="col-xl-6">{{ user_object.username }}</dd>
{% if user_object.pk == user.pk %} {% if user_object.pk == user.pk %}
<dt class="col-xl-6">{% trans 'password'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'password'|capfirst %}</dt>
<dd class="col-xl-6"> <dd class="col-xl-6">
<a class="small" href="{% url 'password_change' %}"> <a class="small" href="{% url 'password_change' %}">
{% trans 'Change password' %} {% trans 'Change password' %}
</a> </a>
</dd> </dd>
{% endif %} {% endif %}
<dt class="col-xl-6">{% trans 'section'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'section'|capfirst %}</dt>
@ -33,32 +33,38 @@
<dd class="col-xl-6"><a href="mailto:{{ user_object.email }}">{{ user_object.email }}</a></dd> <dd class="col-xl-6"><a href="mailto:{{ user_object.email }}">{{ user_object.email }}</a></dd>
<dt class="col-xl-6">{% trans 'phone number'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'phone number'|capfirst %}</dt>
<dd class="col-xl-6"><a href="tel:{{ user_object.profile.phone_number }}">{{ user_object.profile.phone_number }}</a></dd> <dd class="col-xl-6"><a
href="tel:{{ user_object.profile.phone_number }}">{{ user_object.profile.phone_number }}</a></dd>
<dt class="col-xl-6">{% trans 'address'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'address'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.address }}</dd> <dd class="col-xl-6">{{ user_object.profile.address }}</dd>
{% if "note.view_note"|has_perm:user_object.note %} {% if "note.view_note"|has_perm:user_object.note %}
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.note.balance | pretty_money }}</dd> <dd class="col-xl-6">{{ user_object.note.balance | pretty_money }}</dd>
<dt class="col-xl-6">{% trans 'paid'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'paid'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.paid|yesno }}</dd> <dd class="col-xl-6">{{ user_object.profile.paid|yesno }}</dd>
{% endif %} {% endif %}
<dt class="col-xl-6"> <a href="{% url 'member:user_alias' user_object.pk %}">{% trans 'aliases'|capfirst %}</a></dt>
<dd class="col-xl-6 text-truncate">{{ user_object.note.alias_set.all|join:", " }}</dd>
</dl> </dl>
{% if user_object.pk == user_object.pk %} <h4><a href="{% url 'member:user_alias' user_object.pk %}">{% trans 'aliases'|capfirst %}</a></h4>
<a class="small" href="{% url 'member:auth_token' %}">{% trans 'Manage auth token' %}</a> {% for alias in user_object.note.alias_set.all %}
{% endif %} <span class="badge badge-secondary">{{ alias }}</span>
{% endfor %}
</div> </div>
<div class="card-footer text-center"> <div class="card-footer">
<a class="btn btn-primary btn-sm" href="{% url 'member:user_update_profile' user_object.pk %}">{% trans 'Update Profile' %}</a> <a class="btn btn-sm btn-secondary" href="{% url 'member:user_update_profile' user_object.pk %}">
<i class="fa fa-edit"></i> {% trans 'Update Profile' %}
</a>
{% url 'member:user_detail' user_object.pk as user_profile_url %} {% url 'member:user_detail' user_object.pk as user_profile_url %}
{%if request.path_info != user_profile_url %} {% if request.path_info != user_profile_url %}
<a class="btn btn-primary btn-sm" href="{{ user_profile_url }}">{% trans 'View Profile' %}</a> <a class="btn btn-sm btn-primary" href="{{ user_profile_url }}">{% trans 'View Profile' %}</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% if user_object.pk == user_object.pk %}
<a class="small float-right text-decoration-none" href="{% url 'member:auth_token' %}">{% trans 'Manage auth token' %}</a>
{% endif %}