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
- Ajout d'un bouton pour supprimer un compte
- Le nombre d'adhérent⋅es est affiché sur la page d'accueil
### 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
)
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:
verbose_name = _("Profil 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,31 +16,35 @@
{# Javascript #}
<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 'bds/js/bds.js' %}"></script>
{% block extra_head %}{% endblock extra_head %}
</head>
<body>
{% include "bds/nav.html" %}
{% block layout %}
<div class="columns">
<div class="column is-two-thirds is-offset-2">
<section class="section">
<section class="section">
<div class="columns">
<div class="column is-two-thirds is-offset-2">
{% 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 %}
</div>
{% endfor %}
{% endif %}
{% 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 %}
{% block content %}
{% endblock content %}
</div>
{% block content %}
{% endblock content %}
</section>
</div>
</section>
</div>
{% endblock layout %}
</body>
</html>

View file

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

View file

@ -1,22 +1,55 @@
{% extends "bds/base.html" %}
{% load bulma_utils %}
{% block content %}
<div class="container">
Bienvenue sur GestioBDS&#8239;!
{% 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">
<br>
<br>
{% 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">
Bienvenue sur GestioBDS&#8239;!
Le site est encore en développement.
<br>
Suivez notre avancement sur
<a href="https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/merge_requests?milestone_title=Int%C3%A9gration+du+BDS">
cette milestone</a> sur le gitlab de l'ENS.
<br>
Faites vos remarques par mail à
<a href="mailto:klub-dev@ens.fr"><tt>klub-dev@ens.fr</tt></a>
ou en ouvrant une
<a href="#https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/issues?milestone_title=Int%C3%A9gration+du+BDS">
issue</a>.
<br>
<br>
Le site est encore en développement.
<br>
Suivez notre avancement sur
<a href="https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/merge_requests?milestone_title=Int%C3%A9gration+du+BDS">
cette milestone</a> sur le gitlab de l'ENS.
<br>
Faites vos remarques par mail à
<a href="mailto:klub-dev@ens.fr"><tt>klub-dev@ens.fr</tt></a>
ou en ouvrant une
<a href="#https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/issues?milestone_title=Int%C3%A9gration+du+BDS">
issue</a>.
</div>
</section>
</div>
</div>
{% endblock %}
{% endblock layout %}

View file

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

View file

@ -8,6 +8,7 @@ from django.views.generic import DeleteView, TemplateView
from bds.autocomplete import bds_search
from bds.forms import ProfileForm, UserForm, UserFromClipperForm, UserFromScratchForm
from bds.mixins import MultipleFormView, StaffRequiredMixin
from bds.models import BDSProfile
from shared.views import AutocompleteView
User = get_user_model()
@ -21,6 +22,11 @@ class BDSAutocompleteView(StaffRequiredMixin, AutocompleteView):
class Home(StaffRequiredMixin, TemplateView):
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):
template_name = "bds/user_update.html"

View file

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

View file

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