diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 68ca3cf..419739f 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -137,6 +137,11 @@ class Event(models.Model): else: return self.end_day if self.end_day else self.start_day + def get_dates(self): + first = self.start_day + last = self.get_consolidated_end_day() + return [first + timedelta(n) for n in range(int((last - first).days) + 1)] + def is_single_day(self, intuitive=True): return self.start_day == self.get_consolidated_end_day(intuitive) diff --git a/src/agenda_culturel/templates/agenda_culturel/page-day.html b/src/agenda_culturel/templates/agenda_culturel/page-day.html index 69572fc..5def194 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-day.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-day.html @@ -27,43 +27,77 @@ +
+
+ - - - {% if events %} - {% for event in events %} - {% include "agenda_culturel/single-event/event-in-list-by-day-inc.html" with event=event filter=filter %} - {% endfor %} - {% else %} -
- {% if filter.is_active %} - Il n'y a pas d'événement prévu à cette date correspondant au filtre sélectionné. + {% if events %} + {% for event in events %} + {% include "agenda_culturel/single-event/event-in-list-by-day-inc.html" with event=event filter=filter %} + {% endfor %} {% else %} - Il n'y a pas d'événement prévu à cette date. +
+ {% if filter.is_active %} + Il n'y a pas d'événement prévu à cette date correspondant au filtre sélectionné. + {% else %} + Il n'y a pas d'événement prévu à cette date. + {% endif %} +
{% endif %} -
- {% endif %} - +
+ + + + +
+ {% endblock %} \ No newline at end of file diff --git a/src/agenda_culturel/templates/agenda_culturel/page-event.html b/src/agenda_culturel/templates/agenda_culturel/page-event.html index 05e8303..db80e83 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-event.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-event.html @@ -3,6 +3,8 @@ {% block title %}{{ object.title }}{% endblock %} {% load cat_extra %} +{% load utils_extra %} + {% block entete_header %} {% css_categories %} {% endblock %} @@ -10,6 +12,28 @@ {% block content %} -{% include "agenda_culturel/single-event/event-single-inc.html" with event=event filter=filter %} +
+ + {% include "agenda_culturel/single-event/event-single-inc.html" with event=event filter=filter %} + + + +
{% endblock %} \ No newline at end of file diff --git a/src/agenda_culturel/templatetags/cat_extra.py b/src/agenda_culturel/templatetags/cat_extra.py index 239af6a..06a5024 100644 --- a/src/agenda_culturel/templatetags/cat_extra.py +++ b/src/agenda_culturel/templatetags/cat_extra.py @@ -89,16 +89,21 @@ def css_categories(): return mark_safe(result) @register.filter -def small_cat(category, url=None, contrast=True): +def small_cat(category, url=None, contrast=True, selected=True): name = Category.default_name if category is None else category.name css_class = Category.default_css_class if category is None else category.css_class() class_contrast = " contrast" if contrast else "" + class_selected = " selected" if selected else "" if url is None: - return mark_safe(' ' + name + "") + return mark_safe(' ' + name + "") else: - return mark_safe(' ' + name + "") + return mark_safe(' ' + name + "") + +@register.filter +def small_cat_no_selected(category, url=None): + return small_cat(category, url=url, selected=False) @register.filter def circle_cat(category):