Template formating on member app

This commit is contained in:
Alexandre Iooss 2020-08-23 14:21:31 +02:00
parent c64de202a6
commit e14c8734c2
6 changed files with 76 additions and 63 deletions

View File

@ -2,6 +2,7 @@
{% comment %} {% comment %}
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% block contenttitle %}{% endblock %}
{# Use a fluid-width container #} {# Use a fluid-width container #}
{% block containertype %}container-fluid{% endblock %} {% block containertype %}container-fluid{% endblock %}

View File

@ -1,11 +1,12 @@
{% load i18n static pretty_money perms %} {% load i18n pretty_money perms %}
<div class="card bg-light shadow">
<div class="card-header text-center"> <div class="card bg-light">
<h4> Club {{ club.name }} </h4> <h4 class="card-header text-center">
</div> Club {{ club.name }}
</h4>
<div class="card-top text-center"> <div class="card-top text-center">
<a href="{% url 'member:club_update_pic' club.pk %}"> <a href="{% url 'member:club_update_pic' club.pk %}">
<img src="{{ club.note.display_image.url }}" class="img-thumbnail mt-2" > <img src="{{ club.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">
@ -14,41 +15,43 @@
<dd class="col-xl-6">{{ club.name }}</dd> <dd class="col-xl-6">{{ club.name }}</dd>
{% if club.parent_club %} {% if club.parent_club %}
<dt class="col-xl-6"><a href="{% url 'member:club_detail' club.parent_club.pk %}">{% trans 'Club Parent'|capfirst %}</a></dt> <dt class="col-xl-6">
<dd class="col-xl-6"> {{ club.parent_club.name }}</dd> <a href="{% url 'member:club_detail' club.parent_club.pk %}">{% trans 'Club Parent'|capfirst %}</a>
</dt>
<dd class="col-xl-6"> {{ club.parent_club.name }}</dd>
{% endif %} {% endif %}
{% if club.require_memberships %} {% if club.require_memberships %}
{% if club.membership_start %} {% if club.membership_start %}
<dt class="col-xl-6">{% trans 'membership start'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'membership start'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_start }}</dd> <dd class="col-xl-6">{{ club.membership_start }}</dd>
{% endif %} {% endif %}
{% if club.membership_end %} {% if club.membership_end %}
<dt class="col-xl-6">{% trans 'membership end'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'membership end'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_end }}</dd> <dd class="col-xl-6">{{ club.membership_end }}</dd>
{% endif %} {% endif %}
{% if club.membership_duration %} {% if club.membership_duration %}
<dt class="col-xl-6">{% trans 'membership duration'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'membership duration'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_duration }} {% trans "days" %}</dd> <dd class="col-xl-6">{{ club.membership_duration }} {% trans "days" %}</dd>
{% endif %} {% endif %}
{% if club.membership_fee_paid == club.membership_fee_unpaid %} {% if club.membership_fee_paid == club.membership_fee_unpaid %}
<dt class="col-xl-6">{% trans 'membership fee'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'membership fee'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd> <dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd>
{% else %} {% else %}
<dt class="col-xl-6">{% trans 'membership fee (paid students)'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'membership fee (paid students)'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd> <dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd>
<dt class="col-xl-6">{% trans 'membership fee (unpaid students)'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'membership fee (unpaid students)'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_unpaid|pretty_money }}</dd> <dd class="col-xl-6">{{ club.membership_fee_unpaid|pretty_money }}</dd>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if "note.view_note"|has_perm:club.note %} {% if "note.view_note"|has_perm:club.note %}
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.note.balance | pretty_money }}</dd> <dd class="col-xl-6">{{ club.note.balance | pretty_money }}</dd>
{% endif %} {% endif %}
<dt class="col-xl-6"><a href="{% url 'member:club_alias' club.pk %}">{% trans 'aliases'|capfirst %}</a></dt> <dt class="col-xl-6"><a href="{% url 'member:club_alias' club.pk %}">{% trans 'aliases'|capfirst %}</a></dt>
@ -59,17 +62,19 @@
</dl> </dl>
</div> </div>
{% if not club.weiclub %} {% if not club.weiclub %}
<div class="card-footer text-center"> <div class="card-footer text-center">
{% if can_add_members %} {% if can_add_members %}
<a class="btn btn-primary btn-sm my-1" href="{% url 'member:club_add_member' club_pk=club.pk %}" data-turbolinks="false"> {% trans "Add member" %}</a> <a class="btn btn-primary btn-sm my-1" href="{% url 'member:club_add_member' club_pk=club.pk %}"
{% endif %} data-turbolinks="false"> {% trans "Add member" %}</a>
{% if ".change_"|has_perm:club %} {% endif %}
<a class="btn btn-primary btn-sm my-1" href="{% url 'member:club_update' pk=club.pk %}" data-turbolinks="false"> {% trans "Edit" %}</a> {% if ".change_"|has_perm:club %}
{% endif %} <a class="btn btn-primary btn-sm my-1" href="{% url 'member:club_update' pk=club.pk %}" data-turbolinks="false">
{% url 'member:club_detail' club.pk as club_detail_url %} {% trans "Edit" %}</a>
{%if request.path_info != club_detail_url %} {% endif %}
<a class="btn btn-primary btn-sm my-1" href="{{ club_detail_url }}">{% trans 'View Profile' %}</a> {% url 'member:club_detail' club.pk as club_detail_url %}
{% endif %} {%if request.path_info != club_detail_url %}
</div> <a class="btn btn-primary btn-sm my-1" href="{{ club_detail_url }}">{% trans 'View Profile' %}</a>
{% endif %}
</div>
{% endif %} {% endif %}
</div> </div>

View File

@ -1,5 +1,4 @@
{% extends "member/club_detail.html" %} {% extends "member/club_detail.html" %}
{% load i18n static pretty_money django_tables2 crispy_forms_tags %}
{% block profile_content%} {% block profile_content%}
{% include "member/picture_update.html" %} {% include "member/picture_update.html" %}

View File

@ -1,9 +1,9 @@
{% load i18n pretty_money perms %} {% load i18n pretty_money perms %}
<div class="card bg-light shadow"> <div class="card bg-light">
<div class="card-header text-center"> <h4 class="card-header text-center">
<h4>{% trans "Account #" %}{{ user_object.pk }}</h4> {% trans "Account #" %}{{ user_object.pk }}
</div> </h4>
<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">
@ -52,7 +52,6 @@
{% for alias in user_object.note.alias_set.all %} {% for alias in user_object.note.alias_set.all %}
<span class="badge badge-secondary">{{ alias }}</span> <span class="badge badge-secondary">{{ alias }}</span>
{% endfor %} {% endfor %}
</div> </div>
<div class="card-footer"> <div class="card-footer">
<a class="btn btn-sm btn-secondary" href="{% url 'member:user_update_profile' user_object.pk %}"> <a class="btn btn-sm btn-secondary" href="{% url 'member:user_update_profile' user_object.pk %}">
@ -66,5 +65,7 @@
</div> </div>
{% if user_object.pk == user_object.pk %} {% 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> <a class="small float-right text-decoration-none" href="{% url 'member:auth_token' %}">
{% trans 'Manage auth token' %}
</a>
{% endif %} {% endif %}

View File

@ -1,5 +1,4 @@
{% extends "member/profile_detail.html" %} {% extends "member/profile_detail.html" %}
{% load i18n static pretty_money django_tables2 crispy_forms_tags %}
{% block profile_content%} {% block profile_content%}
{% include "member/picture_update.html" %} {% include "member/picture_update.html" %}

View File

@ -3,14 +3,22 @@
{% comment %} {% comment %}
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% block contenttitle %}{% endblock %}
{% block content %} {% block content %}
<form method="post"> <div class="card bg-light">
{% csrf_token %} <h3 class="card-header text-center">
{{ form|crispy }} {{ title }}
{{ profile_form|crispy }} </h3>
<button class="btn btn-primary" type="submit"> <div class="card-body">
{% trans "Save Changes" %} <form method="post">
</button> {% csrf_token %}
</form> {{ form | crispy }}
{{ profile_form | crispy }}
<button class="btn btn-primary" type="submit">
{% trans "Save Changes" %}
</button>
</form>
</div>
</div>
{% endblock %} {% endblock %}