From: Jérémy Fabre Date: Mon, 26 Sep 2016 08:44:26 +0000 (+0200) Subject: Add the event date specific formats X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=a919d496189f7eb1b33d951021a23cad8348a13e;p=mezzo.git Add the event date specific formats --- diff --git a/app/templates/agenda/includes/event_date.html b/app/templates/agenda/includes/event_date.html new file mode 100644 index 00000000..9bbb7104 --- /dev/null +++ b/app/templates/agenda/includes/event_date.html @@ -0,0 +1,49 @@ +{% load i18n %} + + +{% if event.start and not event.end %} + + {{ event.start|date:"l j F" }} + + + {% if event.start|date:"H:i" != "23:59" %} + {% trans "at" %} + {{ event.start|date:"H\hi" }} + {% endif %} + + +{% else %} + + + {% if event.start|date:"d.m.y" == event.end|date:"d.m.y" %} + + {{ event.start|date:"l j F" }} + + + {% if event.start|date:"H:i" != "23:59" %} + {% trans "from" %} + {{ event.start|date:"H\hi" }} + {% if event.end|date:"H:i" != "23:59" %} + {% trans "to" %} + {{ event.end|date:"H\hi" }} + {% endif %} + {% endif %} + + + {% elif event.start|date:"m.y" == event.end|date:"m.y" %} + + {% trans "From" %} + {{ event.start|date:"j" }} + {% trans "to" %} + {{ event.end|date:"j F" }} + + + {% else %} + + {{ event.start|date:"j F" }} + - + {{ event.end|date:"j F" }} + + {% endif %} + +{% endif %} diff --git a/app/templates/core/inc/generic_card.html b/app/templates/core/inc/generic_card.html index 3cd99152..790a9780 100644 --- a/app/templates/core/inc/generic_card.html +++ b/app/templates/core/inc/generic_card.html @@ -42,24 +42,20 @@

{{ content.content_object.title }}

{% if content.content_type.model == 'article' %} - {{ content.content_object.publish_date|date:"DATE_FORMAT" }} + {{ content.content_object.publish_date|date:"d.m.y" }} {% for category in content.content_object.categories.all %} {% if forloop.first %} | {% endif %} {% if not forloop.first %}, {% endif %} {{ category }} {% endfor %} {% elif content.content_type.model == 'event' %} - {% if content.content_object.start %} - {% if content.content_object.end %} - {% trans "From" %} - {% endif %} - {{ content.content_object.start|date:"DATE_FORMAT" }} - {% if content.content_object.end %} - {% trans "to" %} {{ content.content_object.end|date:"DATE_FORMAT" }} - {% endif %} - {% endif %} + {% with content.content_object as event %} + + {% include 'agenda/includes/event_date.html' %} + + {% endwith %} {% if content.content_object.location %} -
{{ content.content_object.location }} +
{{ content.content_object.location }} {% endif %} {% endif %}
diff --git a/app/templates/home/inc/slider.html b/app/templates/home/inc/slider.html index acd26a62..f0031e5c 100644 --- a/app/templates/home/inc/slider.html +++ b/app/templates/home/inc/slider.html @@ -39,19 +39,15 @@

{{ slider.content_object.title }}

{{ slider.content_object.sub_title }} -
-
{% if slider.content_object.start %} - {% if slider.content_object.end %} - {% trans "From" %} - {% endif %} - {{ slider.content_object.start|date:"DATE_FORMAT" }} - {% if slider.content_object.end %} - {% trans "to" %} {{ slider.content_object.end|date:"DATE_FORMAT" }} - {% endif %} + {% with slider.content_object as event %} + + {% include 'agenda/includes/event_date.html' %} + + {% endwith %} {% endif %} {% if slider.content_object.location %} -
{{ slider.content_object.location }} +
{{ slider.content_object.location }} {% endif %}