badge pour afficher le nombre d'événements à modérer

This commit is contained in:
Jean-Marie Favreau 2023-12-07 22:17:31 +01:00
parent 59f14b0df3
commit fbbae450ca
4 changed files with 32 additions and 7 deletions

View File

@ -165,10 +165,10 @@ footer {
#calendar {
width: 100%;
overflow: scroll;
overflow: auto;
.grid {
grid-template-columns: repeat(auto-fit, minmax(0%, 1fr));
min-width: 992px;
min-width: 1200px;
}
.grid.week-in-month {
grid-template-columns: 2.5em repeat(auto-fit, minmax(0%, 1fr));
@ -440,7 +440,9 @@ nav>div {
float: left;
top: 0;
left: 0;
width: auto;
padding-right: 4em;
max-width: 80%;
}
ul, div {
@ -451,12 +453,11 @@ nav>div {
/* header */
.header {
float: left;
z-index: 3;
float: right;
z-index: 0;
position: relative;
text-align: right;
display: block;
width: 100%;
}
.header ul {
@ -581,4 +582,12 @@ nav>div {
width: auto;
}
}
}
nav .badge {
@extend [role="button"];
font-size: 70%;
padding: 0.2em .8em;
border-radius: 40%;
}

View File

@ -8,7 +8,7 @@
{% with "date-"|add:daytag as daytag %}
<article class="day{{ day|calendar_classes:fixed_style }}" id="{{ daytag }}">
<header>
<header{% if day.is_today %} id="today"{% endif %}>
<{% if headers %}{{ headers }}{% else %}h2{% endif %}><a href="{{ day.date | url_day }}?{{ filter.get_url }}">{{ day.date | date:"l j" }}</a></{% if headers %}{{ headers }}{% else %}h2{% endif %}>
</header>
{% if day.events %}

View File

@ -45,8 +45,12 @@
</li>
<li>
<a href="{% url 'home' %}" aria-label="Retour accueil">Les nuits énimagmatiques</a>
</li>
{% if user.is_authenticated %}
<li>
{% show_badges_events %}
</li>
{% endif %}
</ul>
</nav>
</div>

View File

@ -1,5 +1,7 @@
from django import template
from django.utils.safestring import mark_safe
from django.urls import reverse_lazy
from agenda_culturel.models import Event
from django.db.models import Q
@ -35,3 +37,13 @@ def picto_status(event):
else:
return ""
@register.simple_tag
def show_badges_events():
# TODO: seulement ceux dans le futur ?
nb_drafts = nb_draft_events()
if nb_drafts != 0:
return mark_safe('<a href="' + reverse_lazy("view_all_events") + '?status=draft" class="badge" data-tooltip="' + str(nb_drafts) + ' brouillons à valider">' + str(nb_drafts) + '</a>')
else:
return ""