diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e85917a..35757b79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/bds/migrations/0006_bdsprofile_comments.py b/bds/migrations/0006_bdsprofile_comments.py new file mode 100644 index 00000000..7950955f --- /dev/null +++ b/bds/migrations/0006_bdsprofile_comments.py @@ -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", + ), + ), + ] diff --git a/bds/models.py b/bds/models.py index 1b9ca6bc..0ea46466 100644 --- a/bds/models.py +++ b/bds/models.py @@ -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") diff --git a/bds/static/bds/js/bds.js b/bds/static/bds/js/bds.js new file mode 100644 index 00000000..3c2fb49b --- /dev/null +++ b/bds/static/bds/js/bds.js @@ -0,0 +1,7 @@ +$(function () { + // Close notifications when delete button is pressed + $(".notification .delete").on("click", function () { + $(this).parent().remove(); + }); + +}); \ No newline at end of file diff --git a/bds/templates/bds/base.html b/bds/templates/bds/base.html index ac2b4875..f456f6dc 100644 --- a/bds/templates/bds/base.html +++ b/bds/templates/bds/base.html @@ -16,31 +16,35 @@ {# Javascript #} + {% block extra_head %}{% endblock extra_head %} {% include "bds/nav.html" %} + {% block layout %} +
+
+
-
-
-
- {% if messages %} - {% for message in messages %} -
- {% if 'safe' in message.tags %} - {{ message|safe }} - {% else %} - {{ message }} - {% endif %} -
- {% endfor %} - {% endif %} + {% if messages %} + {% for message in messages %} +
+ {% if 'safe' in message.tags %} + {{ message|safe }} + {% else %} + {{ message }} + {% endif %} + +
+ {% endfor %} + {% endif %} - {% block content %} - {% endblock content %} -
+ {% block content %} + {% endblock content %} +
- +
+ {% endblock layout %} diff --git a/bds/templates/bds/forms/textarea.html b/bds/templates/bds/forms/textarea.html index 541c63c7..c5bc50f4 100644 --- a/bds/templates/bds/forms/textarea.html +++ b/bds/templates/bds/forms/textarea.html @@ -1,3 +1,5 @@ +{% load bulma_utils %} + diff --git a/bds/templates/bds/home.html b/bds/templates/bds/home.html index 65a67743..4a3e95f6 100644 --- a/bds/templates/bds/home.html +++ b/bds/templates/bds/home.html @@ -1,22 +1,55 @@ {% extends "bds/base.html" %} +{% load bulma_utils %} -{% block content %} -
- Bienvenue sur GestioBDS ! +{% block layout %} +
+
+
+
+
+

{{ member_count }}

+ adhérent·e·s +
+
+
+
+
+
-
-
+ {% if messages %} + {% for message in messages %} +
+ {% if 'safe' in message.tags %} + {{ message|safe }} + {% else %} + {{ message }} + {% endif %} + +
+ {% endfor %} + {% endif %} +
+ Bienvenue sur GestioBDS ! - Le site est encore en développement. -
- Suivez notre avancement sur - - cette milestone sur le gitlab de l'ENS. -
- Faites vos remarques par mail à - klub-dev@ens.fr - ou en ouvrant une - - issue. +
+
+ + Le site est encore en développement. +
+ Suivez notre avancement sur + + cette milestone sur le gitlab de l'ENS. +
+ Faites vos remarques par mail à + klub-dev@ens.fr + ou en ouvrant une + + issue. +
+
+
-{% endblock %} +{% endblock layout %} + + + diff --git a/bds/templates/bds/nav.html b/bds/templates/bds/nav.html index 7baa3414..ff167189 100644 --- a/bds/templates/bds/nav.html +++ b/bds/templates/bds/nav.html @@ -12,7 +12,7 @@
- + logout
@@ -31,7 +31,7 @@
- + logout
diff --git a/bds/views.py b/bds/views.py index e12185f7..0318d1e6 100644 --- a/bds/views.py +++ b/bds/views.py @@ -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" diff --git a/cof/settings/bds_prod.py b/cof/settings/bds_prod.py index 31e986f8..12f5a552 100644 --- a/cof/settings/bds_prod.py +++ b/cof/settings/bds_prod.py @@ -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 diff --git a/cof/settings/local.py b/cof/settings/local.py index c34ffd76..c3607d7f 100644 --- a/cof/settings/local.py +++ b/cof/settings/local.py @@ -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 # ---