Ajout d'une ligne "maintenant"

Fix #235
This commit is contained in:
Jean-Marie Favreau 2024-12-07 11:15:56 +01:00
parent e050ce5eda
commit cd52ae0286
4 changed files with 30 additions and 1 deletions

View File

@ -117,6 +117,15 @@ class DayInCalendar:
if e.start_time is None if e.start_time is None
else e.start_time else e.start_time
) )
if self.is_today():
now = timezone.now()
nday = now.date()
ntime = now.time()
for idx,e in enumerate(self.events):
if (nday < e.start_day) or (nday == e.start_day and e.start_time and ntime <= e.start_time):
self.events[idx].is_first_after_now = True
break
def events_by_category_ordered(self): def events_by_category_ordered(self):
from .models import Category from .models import Category

View File

@ -148,7 +148,7 @@ TIME_ZONE = "Europe/Paris"
USE_I18N = True USE_I18N = True
USE_TZ = True USE_TZ = False
LANGUAGES = ( LANGUAGES = (
("fr", _("French")), ("fr", _("French")),

View File

@ -329,6 +329,7 @@ footer [data-tooltip] {
scroll-behavior: smooth; scroll-behavior: smooth;
transition-duration: 200ms; transition-duration: 200ms;
.cat { .cat {
margin-right: 0; margin-right: 0;
} }
@ -1552,3 +1553,19 @@ label.required::after {
} }
} }
} }
.line-now {
font-size: 60%;
div {
display: grid;
grid-template-columns: fit-content(2em) auto;
column-gap: .2em;
color: red;
.line {
margin-top: .6em;
border-top: 1px solid red;
}
}
margin-bottom: 0;
}

View File

@ -85,6 +85,9 @@
{% if day.events %} {% if day.events %}
<ul> <ul>
{% for event in day.events %} {% for event in day.events %}
{% if event.is_first_after_now %}
<li class="line-now"><div><div>{% now "H:i" %}</div><div class="line"></div></div></li>
{% endif %}
<li>{{ event.category | circle_cat:event.has_recurrences }} <li>{{ event.category | circle_cat:event.has_recurrences }}
{% if event.start_day == day.date and event.start_time %} {% if event.start_day == day.date and event.start_time %}
{{ event.start_time }} {{ event.start_time }}