Amélioration du rendu des pages jour et événement, avec une colonne à droite
This commit is contained in:
parent
49f528e395
commit
aa9453b24f
@ -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)
|
||||
|
||||
|
@ -27,7 +27,8 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="grid two-columns">
|
||||
<div>
|
||||
<article>
|
||||
<header>
|
||||
<div class="title"><h1>{{ day | date:"l j F Y" }}</h1></div>
|
||||
@ -63,7 +64,40 @@
|
||||
</article>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
<aside>
|
||||
<article>
|
||||
<head>
|
||||
<h2>En résumé</h2>
|
||||
{% regroup events by category as events_by_category %}
|
||||
<nav>
|
||||
<ul>
|
||||
{% for category in events_by_category %}
|
||||
{% with category.grouper.id|stringformat:"i" as idcat %}
|
||||
{% with filter.get_url_without_filters|add:"?category="|add:idcat as cat_url %}
|
||||
{% with category.list|length as nb %}
|
||||
<li>
|
||||
<a class="small-cat contrast" role="button" href="{{ cat_url }}"><span class="cat {{ category.grouper.css_class }}"></span>{{ category.grouper.name }} : {{ category.list|length }}</a>
|
||||
</li>
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
</head>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<head>
|
||||
<h2>Voir aussi</h2>
|
||||
</head>
|
||||
<a role="button" href="{% url 'week_view' day.year day|week %}?{{ filter.get_url }}">Toute la semaine</a>
|
||||
</article>
|
||||
</aside>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
@ -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 %}
|
||||
|
||||
<div class="grid two-columns">
|
||||
|
||||
{% include "agenda_culturel/single-event/event-single-inc.html" with event=event filter=filter %}
|
||||
<aside>
|
||||
<article>
|
||||
<head>
|
||||
<h2>À la même date</h2>
|
||||
</head>
|
||||
<nav>
|
||||
<ul>
|
||||
{% for d in event.get_dates %}
|
||||
<li>
|
||||
<a href="{% url 'day_view' d.year d.month d.day %}">{{ d }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</article>
|
||||
</aside>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
@ -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('<span class="small-cat' + class_contrast +' selected" role="button"><span class="cat ' + css_class + '"></span> ' + name + "</span>")
|
||||
return mark_safe('<span class="small-cat' + class_contrast + class_selected + '" role="button"><span class="cat ' + css_class + '"></span> ' + name + "</span>")
|
||||
else:
|
||||
return mark_safe('<a class="small-cat' + class_contrast +' selected" role="button" href="' + url + '"><span class="cat ' + css_class + '"></span> ' + name + "</a>")
|
||||
return mark_safe('<a class="small-cat' + class_contrast + class_selected + '" role="button" href="' + url + '"><span class="cat ' + css_class + '"></span> ' + name + "</a>")
|
||||
|
||||
@register.filter
|
||||
def small_cat_no_selected(category, url=None):
|
||||
return small_cat(category, url=url, selected=False)
|
||||
|
||||
@register.filter
|
||||
def circle_cat(category):
|
||||
|
Loading…
Reference in New Issue
Block a user