Amélioration du rendu des pages jour et événement, avec une colonne à droite
This commit is contained in:
		@@ -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,43 +27,77 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 <div class="grid two-columns">
 | 
			
		||||
    <div>
 | 
			
		||||
        <article>
 | 
			
		||||
                <header>
 | 
			
		||||
                    <div class="title"><h1>{{ day | date:"l j F Y" }}</h1></div>
 | 
			
		||||
                    <div class="navigation">
 | 
			
		||||
                        <div>
 | 
			
		||||
                        {% with day|shift_day:-1 as pred_day %}
 | 
			
		||||
                        <a role="button" href="{% url 'day_view' pred_day.year pred_day.month pred_day.day %}?{{ filter.get_url }}">
 | 
			
		||||
                            {% picto_from_name "chevron-left" %} précédent</a>
 | 
			
		||||
                        {% endwith %}
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="right">
 | 
			
		||||
                            {% with day|shift_day:1 as next_day %}
 | 
			
		||||
                            <a role="button" href="{% url 'day_view' next_day.year next_day.month next_day.day %}?{{ filter.get_url }}">suivant 
 | 
			
		||||
                                {% picto_from_name "chevron-right" %}
 | 
			
		||||
                            </a>
 | 
			
		||||
                        {% endwith %}
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </header>
 | 
			
		||||
        </article>
 | 
			
		||||
 | 
			
		||||
<article>
 | 
			
		||||
        <header>
 | 
			
		||||
            <div class="title"><h1>{{ day | date:"l j F Y" }}</h1></div>
 | 
			
		||||
            <div class="navigation">
 | 
			
		||||
                <div>
 | 
			
		||||
                {% with day|shift_day:-1 as pred_day %}
 | 
			
		||||
                <a role="button" href="{% url 'day_view' pred_day.year pred_day.month pred_day.day %}?{{ filter.get_url }}">
 | 
			
		||||
                    {% picto_from_name "chevron-left" %} précédent</a>
 | 
			
		||||
                {% endwith %}
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="right">
 | 
			
		||||
                    {% with day|shift_day:1 as next_day %}
 | 
			
		||||
                    <a role="button" href="{% url 'day_view' next_day.year next_day.month next_day.day %}?{{ filter.get_url }}">suivant 
 | 
			
		||||
                        {% picto_from_name "chevron-right" %}
 | 
			
		||||
                    </a>
 | 
			
		||||
                {% endwith %}
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </header>
 | 
			
		||||
</article>
 | 
			
		||||
 | 
			
		||||
    {% 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 %}
 | 
			
		||||
    <article>
 | 
			
		||||
        {% if filter.is_active %}
 | 
			
		||||
        <em>Il n'y a pas d'événement prévu à cette date correspondant au filtre sélectionné.</em>
 | 
			
		||||
        {% 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 %}
 | 
			
		||||
        <em>Il n'y a pas d'événement prévu à cette date.</em>
 | 
			
		||||
        <article>
 | 
			
		||||
            {% if filter.is_active %}
 | 
			
		||||
            <em>Il n'y a pas d'événement prévu à cette date correspondant au filtre sélectionné.</em>
 | 
			
		||||
            {% else %}
 | 
			
		||||
            <em>Il n'y a pas d'événement prévu à cette date.</em>
 | 
			
		||||
            {% endif %}
 | 
			
		||||
        </article>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
    </article>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
    <article>
 | 
			
		||||
            <a role="button" href="{% url 'week_view' day.year day|week %}?{{ filter.get_url }}">Toute la semaine</a>
 | 
			
		||||
    </article>
 | 
			
		||||
    </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 %}
 | 
			
		||||
 | 
			
		||||
{% include "agenda_culturel/single-event/event-single-inc.html" with event=event filter=filter %}
 | 
			
		||||
<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):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user