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,31 +16,35 @@
{# 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 %}
<div class="columns">
<div class="column is-two-thirds is-offset-2">
<section class="section">
<section class="section"> {% if messages %}
<div class="columns"> {% for message in messages %}
<div class="column is-two-thirds is-offset-2"> <div class="notification is-{{ message.level_tag|bulma_message_tag }}">
{% if messages %} {% if 'safe' in message.tags %}
{% for message in messages %} {{ message|safe }}
<div class="notification is-{{ message.level_tag|bulma_message_tag }}"> {% else %}
{% if 'safe' in message.tags %} {{ message }}
{{ message|safe }} {% endif %}
{% else %} <button class="delete"></button>
{{ message }} </div>
{% endif %} {% endfor %}
</div> {% endif %}
{% endfor %}
{% endif %}
{% block content %} {% block content %}
{% endblock content %} {% endblock content %}
</div> </section>
</div> </div>
</section> </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,22 +1,55 @@
{% extends "bds/base.html" %} {% extends "bds/base.html" %}
{% load bulma_utils %}
{% block content %} {% block layout %}
<div class="container"> <div class="columns">
Bienvenue sur GestioBDS&#8239;! <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> {% if messages %}
<br> {% 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>
<br> <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"> Le site est encore en développement.
cette milestone</a> sur le gitlab de l'ENS. <br>
<br> Suivez notre avancement sur
Faites vos remarques par mail à <a href="https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/merge_requests?milestone_title=Int%C3%A9gration+du+BDS">
<a href="mailto:klub-dev@ens.fr"><tt>klub-dev@ens.fr</tt></a> cette milestone</a> sur le gitlab de l'ENS.
ou en ouvrant une <br>
<a href="#https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/issues?milestone_title=Int%C3%A9gration+du+BDS"> Faites vos remarques par mail à
issue</a>. <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> </div>
{% endblock %} {% 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
# --- # ---