Merge branch 'Aufinal/misc_bds' into 'master'

Quelques améliorations pour le BDS

Closes #270

See merge request klub-dev-ens/gestioCOF!443
This commit is contained in:
Martin Pepin 2020-08-28 18:38:49 +02:00
commit 1518f4c703
11 changed files with 123 additions and 41 deletions

View file

@ -26,6 +26,7 @@ adhérents ni des cotisations.
### GestioBDS ### GestioBDS
- Ajout d'un bouton pour supprimer un compte - Ajout d'un bouton pour supprimer un compte
- Le nombre d'adhérent⋅es est affiché sur la page d'accueil
### Site du COF ### Site du COF

View file

@ -0,0 +1,23 @@
# Generated by Django 2.2.12 on 2020-08-28 12:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bds", "0005_remove_bdsprofile_certificate_file"),
]
operations = [
migrations.AddField(
model_name="bdsprofile",
name="comments",
field=models.TextField(
blank=True,
help_text="Attention : l'utilisateur·ice dispose d'un droit d'accès"
" aux données le/la concernant, dont le contenu de ce champ !",
verbose_name="commentaires",
),
),
]

View file

@ -84,6 +84,15 @@ class BDSProfile(models.Model):
_("type de cotisation"), choices=TYPE_COTIZ_CHOICES, max_length=9 _("type de cotisation"), choices=TYPE_COTIZ_CHOICES, max_length=9
) )
comments = models.TextField(
_("commentaires"),
blank=True,
help_text=_(
"Attention : l'utilisateur·ice dispose d'un droit d'accès aux données "
"le/la concernant, dont le contenu de ce champ !"
),
)
class Meta: class Meta:
verbose_name = _("Profil BDS") verbose_name = _("Profil BDS")
verbose_name_plural = _("Profils BDS") verbose_name_plural = _("Profils BDS")

7
bds/static/bds/js/bds.js Normal file
View file

@ -0,0 +1,7 @@
$(function () {
// Close notifications when delete button is pressed
$(".notification .delete").on("click", function () {
$(this).parent().remove();
});
});

View file

@ -16,15 +16,17 @@
{# Javascript #} {# Javascript #}
<script src="{% static 'vendor/jquery/jquery-3.3.1.min.js' %}"></script> <script src="{% static 'vendor/jquery/jquery-3.3.1.min.js' %}"></script>
<script src="{% static "vendor/jquery/jquery.autocomplete-light.min.js" %}"></script> <script src="{% static "vendor/jquery/jquery.autocomplete-light.min.js" %}"></script>
<script src="{% static 'bds/js/bds.js' %}"></script>
{% block extra_head %}{% endblock extra_head %} {% block extra_head %}{% endblock extra_head %}
</head> </head>
<body> <body>
{% include "bds/nav.html" %} {% include "bds/nav.html" %}
{% block layout %}
<section class="section">
<div class="columns"> <div class="columns">
<div class="column is-two-thirds is-offset-2"> <div class="column is-two-thirds is-offset-2">
<section class="section">
{% if messages %} {% if messages %}
{% for message in messages %} {% for message in messages %}
<div class="notification is-{{ message.level_tag|bulma_message_tag }}"> <div class="notification is-{{ message.level_tag|bulma_message_tag }}">
@ -33,14 +35,16 @@
{% else %} {% else %}
{{ message }} {{ message }}
{% endif %} {% endif %}
<button class="delete"></button>
</div> </div>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% block content %} {% block content %}
{% endblock content %} {% endblock content %}
</div>
</div>
</section> </section>
</div>
</div>
{% endblock layout %}
</body> </body>
</html> </html>

View file

@ -1,3 +1,5 @@
{% load bulma_utils %}
<label class="label {% if field.field.required %}{{ form.required_css_class }}{% endif %}"> <label class="label {% if field.field.required %}{{ form.required_css_class }}{% endif %}">
{{ field.label }} {{ field.label }}
</label> </label>

View file

@ -1,6 +1,33 @@
{% extends "bds/base.html" %} {% extends "bds/base.html" %}
{% load bulma_utils %}
{% block content %} {% block layout %}
<div class="columns">
<div class="column is-2">
<section class="section">
<div class="box">
<div class="content has-text-centered">
<h1>{{ member_count }}</h1>
adhérent·e·s
</div>
</div>
</section>
</div>
<div class="column is-two-thirds">
<section class="section">
{% if messages %}
{% for message in messages %}
<div class="notification is-{{ message.level_tag|bulma_message_tag }}">
{% if 'safe' in message.tags %}
{{ message|safe }}
{% else %}
{{ message }}
{% endif %}
<button class="delete"></button>
</div>
{% endfor %}
{% endif %}
<div class="container"> <div class="container">
Bienvenue sur GestioBDS&#8239;! Bienvenue sur GestioBDS&#8239;!
@ -19,4 +46,10 @@
<a href="#https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/issues?milestone_title=Int%C3%A9gration+du+BDS"> <a href="#https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/issues?milestone_title=Int%C3%A9gration+du+BDS">
issue</a>. issue</a>.
</div> </div>
{% endblock %} </section>
</div>
</div>
{% endblock layout %}

View file

@ -12,7 +12,7 @@
<div class="level-item" id="logout-mobile"> <div class="level-item" id="logout-mobile">
<figure class="image is-64x64"> <figure class="image is-64x64">
<a href="#TODO"> <a href="{% url 'authens:logout' %}">
<img src="{% static "bds/images/logout.svg" %}" alt="logout"> <img src="{% static "bds/images/logout.svg" %}" alt="logout">
</a> </a>
</figure> </figure>
@ -31,7 +31,7 @@
<div class="level-item" id="logout"> <div class="level-item" id="logout">
<figure class="image is-64x64"> <figure class="image is-64x64">
<a href="#TODO"> <a href="{% url 'authens:logout' %}">
<img src="{% static "bds/images/logout.svg" %}" alt="logout"> <img src="{% static "bds/images/logout.svg" %}" alt="logout">
</a> </a>
</figure> </figure>

View file

@ -8,6 +8,7 @@ from django.views.generic import DeleteView, TemplateView
from bds.autocomplete import bds_search from bds.autocomplete import bds_search
from bds.forms import ProfileForm, UserForm, UserFromClipperForm, UserFromScratchForm from bds.forms import ProfileForm, UserForm, UserFromClipperForm, UserFromScratchForm
from bds.mixins import MultipleFormView, StaffRequiredMixin from bds.mixins import MultipleFormView, StaffRequiredMixin
from bds.models import BDSProfile
from shared.views import AutocompleteView from shared.views import AutocompleteView
User = get_user_model() User = get_user_model()
@ -21,6 +22,11 @@ class BDSAutocompleteView(StaffRequiredMixin, AutocompleteView):
class Home(StaffRequiredMixin, TemplateView): class Home(StaffRequiredMixin, TemplateView):
template_name = "bds/home.html" template_name = "bds/home.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["member_count"] = BDSProfile.objects.filter(is_member=True).count()
return context
class UserUpdateView(StaffRequiredMixin, MultipleFormView): class UserUpdateView(StaffRequiredMixin, MultipleFormView):
template_name = "bds/user_update.html" template_name = "bds/user_update.html"

View file

@ -2,10 +2,8 @@
Django development settings for the cof project. Django development settings for the cof project.
The settings that are not listed here are imported from .common The settings that are not listed here are imported from .common
""" """
import os
from .common import * # NOQA from .common import * # NOQA
from .common import BASE_DIR, INSTALLED_APPS from .common import INSTALLED_APPS
# --- # ---
# BDS-only Django settings # BDS-only Django settings

View file

@ -13,7 +13,6 @@ for app in bds_prod.INSTALLED_APPS:
if app not in INSTALLED_APPS: if app not in INSTALLED_APPS:
INSTALLED_APPS.append(app) INSTALLED_APPS.append(app)
# --- # ---
# Tweaks for debug/local development # Tweaks for debug/local development
# --- # ---