From fbbae450caf4b1f07af5b9a7444ad0cb0f76cd03 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Thu, 7 Dec 2023 22:17:31 +0100 Subject: [PATCH] =?UTF-8?q?badge=20pour=20afficher=20le=20nombre=20d'?= =?UTF-8?q?=C3=A9v=C3=A9nements=20=C3=A0=20mod=C3=A9rer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agenda_culturel/static/style.scss | 19 ++++++++++++++----- .../templates/agenda_culturel/day-inc.html | 2 +- .../templates/agenda_culturel/page.html | 6 +++++- .../templatetags/event_extra.py | 12 ++++++++++++ 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/agenda_culturel/static/style.scss b/src/agenda_culturel/static/style.scss index 318035a..868595d 100644 --- a/src/agenda_culturel/static/style.scss +++ b/src/agenda_culturel/static/style.scss @@ -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%; + } \ No newline at end of file diff --git a/src/agenda_culturel/templates/agenda_culturel/day-inc.html b/src/agenda_culturel/templates/agenda_culturel/day-inc.html index 1d02ff2..22137ed 100644 --- a/src/agenda_culturel/templates/agenda_culturel/day-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/day-inc.html @@ -8,7 +8,7 @@ {% with "date-"|add:daytag as daytag %}
-
+ <{% if headers %}{{ headers }}{% else %}h2{% endif %}>{{ day.date | date:"l j" }}
{% if day.events %} diff --git a/src/agenda_culturel/templates/agenda_culturel/page.html b/src/agenda_culturel/templates/agenda_culturel/page.html index 16d12b4..f8b78c5 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page.html +++ b/src/agenda_culturel/templates/agenda_culturel/page.html @@ -45,8 +45,12 @@
  • Les nuits énimagmatiques -
  • + {% if user.is_authenticated %} +
  • + {% show_badges_events %} +
  • + {% endif %} diff --git a/src/agenda_culturel/templatetags/event_extra.py b/src/agenda_culturel/templatetags/event_extra.py index 0d925fd..375baff 100644 --- a/src/agenda_culturel/templatetags/event_extra.py +++ b/src/agenda_culturel/templatetags/event_extra.py @@ -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('' + str(nb_drafts) + '') + + else: + return "" \ No newline at end of file