Ajout d'un lien pour la journée
This commit is contained in:
parent
c30640e137
commit
bfdb9c6342
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<article class="day{{ day|calendar_classes:fixed_style }}" id="{{ daytag }}">
|
<article class="day{{ day|calendar_classes:fixed_style }}" id="{{ daytag }}">
|
||||||
<header>
|
<header>
|
||||||
<h2><a href="{% url 'day_view' day.date.year day.date.month day.date.day %}">{{ day.date | date:"l j" }}</a></h2>
|
<h2><a href="{{ day.date | url_day }}">{{ day.date | date:"l j" }}</a></h2>
|
||||||
</header>
|
</header>
|
||||||
{% if day.events %}
|
{% if day.events %}
|
||||||
{% if resume %}
|
{% if resume %}
|
||||||
@ -38,7 +38,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<footer>
|
<footer>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<a href="{% url 'day_view' day.date.year day.date.month day.date.day %}" role="button">Voir la journée <svg width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
<a href="{{ day.date | url_day }}" role="button">Voir la journée <svg width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
<use href="{% static 'images/feather-sprite.svg' %}#chevron-right" />
|
<use href="{% static 'images/feather-sprite.svg' %}#chevron-right" />
|
||||||
</svg></a>
|
</svg></a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
{% load utils_extra %}
|
||||||
|
|
||||||
<article class='ephemeris'>
|
<article class='ephemeris'>
|
||||||
{% if not event.end_day or event.start_day == event.end_day %}
|
{% if not event.end_day or event.start_day == event.end_day %}
|
||||||
{{ event.start_day |date:"l" }}<br />
|
{{ event.start_day |date:"l" }}<br />
|
||||||
<span class="large">{{ event.start_day |date:"j" }}</span><br />
|
<a href="{{ event.start_day | url_day }}"><span class="large">{{ event.start_day |date:"j" }}</span><br />
|
||||||
{{ event.start_day |date:"F" }}
|
{{ event.start_day |date:"F" }}</a>
|
||||||
{% if event.start_time %}
|
{% if event.start_time %}
|
||||||
<footer>
|
<footer>
|
||||||
<span class="large">{{ event.start_time }}</span>
|
<span class="large">{{ event.start_time }}</span>
|
||||||
@ -11,13 +13,13 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
du
|
du
|
||||||
{{ event.start_day |date:"D" }}<br />
|
{{ event.start_day |date:"D" }}<br />
|
||||||
<span class="large">{{ event.start_day |date:"j" }} </span>
|
<a href="{{ event.start_day | url_day }}"><span class="large">{{ event.start_day |date:"j" }} </span>
|
||||||
{% if event.start_day|date:"F" != event.end_day|date:"F" %}
|
{% if event.start_day|date:"F" != event.end_day|date:"F" %}
|
||||||
{{ event.start_day |date:"F" }}
|
{{ event.start_day |date:"F" }}
|
||||||
{% endif %}<br />
|
{% endif %}</a><br />
|
||||||
au
|
au
|
||||||
{{ event.start_day |date:"D" }} <br />
|
{{ event.start_day |date:"D" }} <br />
|
||||||
<span class="large">{{ event.end_day |date:"j" }}</span><br />
|
<a href="{{ event.end_day | url_day }}"><span class="large">{{ event.end_day |date:"j" }}</span><br />
|
||||||
{{ event.end_day |date:"F" }}
|
{{ event.end_day |date:"F" }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</article>
|
</article>
|
||||||
|
@ -3,6 +3,7 @@ from django.utils.safestring import mark_safe
|
|||||||
|
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from datetime import timedelta, date
|
from datetime import timedelta, date
|
||||||
|
from django.urls import reverse_lazy
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
@ -17,22 +18,27 @@ def hostname(url):
|
|||||||
def add_de(txt):
|
def add_de(txt):
|
||||||
return ("d'" if txt[0].lower() in ['a', 'e', 'i', 'o', 'u', 'y'] else "de ") + txt
|
return ("d'" if txt[0].lower() in ['a', 'e', 'i', 'o', 'u', 'y'] else "de ") + txt
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def week(d):
|
def week(d):
|
||||||
return d.isocalendar()[1]
|
return d.isocalendar()[1]
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def shift_day(d, shift):
|
def shift_day(d, shift):
|
||||||
return d + timedelta(days=shift)
|
return d + timedelta(days=shift)
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def first_day_of_this_week(d):
|
def first_day_of_this_week(d):
|
||||||
return date.fromisocalendar(d.year, week(d), 1)
|
return date.fromisocalendar(d.year, week(d), 1)
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def last_day_of_this_week(d):
|
def last_day_of_this_week(d):
|
||||||
return date.fromisocalendar(d.year, week(d), 7)
|
return date.fromisocalendar(d.year, week(d), 7)
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def calendar_classes(d, fixed_style):
|
def calendar_classes(d, fixed_style):
|
||||||
result = ""
|
result = ""
|
||||||
@ -43,4 +49,9 @@ def calendar_classes(d, fixed_style):
|
|||||||
result += " today"
|
result += " today"
|
||||||
if not d.on_requested_interval:
|
if not d.on_requested_interval:
|
||||||
result += " other_month"
|
result += " other_month"
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def url_day(d):
|
||||||
|
return reverse_lazy("day_view", kwargs={"year": d.year, "month": d.month, "day": d.day})
|
Loading…
Reference in New Issue
Block a user