Ajout d'un data picker
This commit is contained in:
parent
5cfa24bd4d
commit
838adec3f0
@ -1910,3 +1910,29 @@ dialog {
|
||||
#cal-heatmap-startday g {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#quand-popup {
|
||||
form {
|
||||
aspect-ratio: 3/2;
|
||||
display: grid;
|
||||
row-gap: auto;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
footer {
|
||||
text-align: left;
|
||||
ul, p {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
li {
|
||||
display: inline-block;
|
||||
}
|
||||
li:not(:last-child)::after {
|
||||
content: ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,10 +6,6 @@
|
||||
{% block title %}{% block og_title %}Erreur pendant la recherche d'événement suivant{% endblock %}{% endblock %}
|
||||
|
||||
|
||||
{% block entete_header %}
|
||||
<script src="{% static 'js/modal.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block fluid %}{% endblock %}
|
||||
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
{% block entete_header %}
|
||||
{% css_categories %}
|
||||
<script src="{% static 'js/modal.js' %}"></script>
|
||||
<script src="{% static 'js/calendar-buttons.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
@ -24,6 +23,7 @@
|
||||
{% endcache %}
|
||||
{% endblock %}
|
||||
|
||||
{% block when_parameters %}{{ filter.get_url }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
{% endcache %}
|
||||
{% endblock %}
|
||||
|
||||
{% block when_parameters %}{{ filter.get_url }}{% endblock %}
|
||||
|
||||
{% block body-class %}a-venir{% endblock %}
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
{% block entete_header %}
|
||||
{% css_categories %}
|
||||
<script src="{% static 'js/modal.js' %}"></script>
|
||||
<script src="{% static 'js/calendar-buttons.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
@ -23,6 +22,9 @@
|
||||
{% endcache %}
|
||||
{% endblock %}
|
||||
|
||||
{% block when_parameters %}{{ filter.get_url }}{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
{% load utils_extra %}
|
||||
{% load duplicated_extra %}
|
||||
{% load rimports_extra %}
|
||||
{% load static %}
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@ -13,6 +14,7 @@
|
||||
<meta name="google-site-verification" content="pvRD0rc_xIE-1IYmbao0kj5ngGo1IWxJqKwoxrQwxuA" />
|
||||
<meta name="msvalidate.01" content="60E9E7DB667A3C4D6697261420DF3D1B" />
|
||||
<meta name="keywords" content="Clermont-Ferrand, Puy-de-Dôme, agenda culturel, agenda participatif, sortir à clermont, sorties, concerts, théâtre, danse, animations, ateliers, lectures">
|
||||
<script src="{% static 'js/modal.js' %}"></script>
|
||||
|
||||
{% load static %}
|
||||
<meta property="og:title" content="Pommes de lune — {% block og_title %}{% endblock %}" />
|
||||
@ -42,8 +44,9 @@
|
||||
<ul>
|
||||
{% block sidemenu-bouton %}{% endblock %}
|
||||
{% if user.is_authenticated %}{% block configurer-bouton %}<li class="configurer-bouton"><a href="{% url 'administration' %}" aria-label="Administrer">{% picto_from_name "settings" %}</a></li>{% endblock %}{% endif %}
|
||||
{% block ajouter-bouton %}<li class="ajouter-bouton"><a href="{% url 'add_event' %}" aria-label="Ajouter un événement">{% picto_from_name "plus" %}</a></li>{% endblock %}
|
||||
{% block quand-bouton %}<li class="quand-bouton" href="#quand-popup" data-target="quand-popup" onClick="toggleModal(event)"><a aria-label="Quand">{% picto_from_name "calendar" %}</a></li>{% endblock %}
|
||||
{% block rechercher-bouton %}<li class="rechercher-bouton"><a href="{% url 'event_search' %}" aria-label="Rechercher">{% picto_from_name "search" %}</a></li>{% endblock %}
|
||||
{% block ajouter-bouton %}<li class="ajouter-bouton"><a href="{% url 'add_event' %}" aria-label="Ajouter un événement">{% picto_from_name "plus" %}</a></li>{% endblock %}
|
||||
</ul>
|
||||
</div>
|
||||
<div id="main-nav">
|
||||
@ -51,13 +54,9 @@
|
||||
<input class="menu-btn" type="checkbox" id="menu-btn" />
|
||||
<label class="menu-icon" for="menu-btn">{% picto_from_name "menu" %}</label>
|
||||
<ul class="menu">
|
||||
{% block ajouter-menu %}<li id="menu-ajouter" class="ajouter-bouton"><a href="{% url 'add_event' %}">Ajouter un événement {% picto_from_name "plus-circle" %}</a></li>{% endblock %}
|
||||
<li><a id="quand" href="#quand-popup" data-target="quand-popup" onClick="toggleModal(event)">Quand ? {% picto_from_name "calendar" %}</a></li>
|
||||
{% block rechercher-menu %}<li id="menu-rechercher" class="rechercher-bouton"><a href="{% url 'event_search' %}">Rechercher {% picto_from_name "search" %}</a></li>{% endblock %}
|
||||
{% block navigation-menu %}
|
||||
<li><a href="{% url 'a_venir' %}">Maintenant</a></li>
|
||||
<li><a href="{% url 'cette_semaine' %}">Cette semaine</a></li>
|
||||
<li><a href="{% url 'ce_mois_ci' %}">Ce mois-ci</a></li>
|
||||
{% endblock%}
|
||||
{% block ajouter-menu %}<li id="menu-ajouter" class="ajouter-bouton"><a href="{% url 'add_event' %}">Ajouter un événement {% picto_from_name "plus-circle" %}</a></li>{% endblock %}
|
||||
</ul>
|
||||
</div>
|
||||
<nav class="container-fluid">
|
||||
@ -136,4 +135,33 @@
|
||||
Fabriqué en Auvergne, 100% sans IA
|
||||
</div>
|
||||
</footer>
|
||||
<dialog id="quand-popup">
|
||||
<article>
|
||||
<header>
|
||||
<a href="#quand-popup"
|
||||
aria-label="Fermer"
|
||||
class="close"
|
||||
data-target="quand-popup"
|
||||
onClick="toggleModal(event)"></a>
|
||||
|
||||
<h2>Aller à la date</h2>
|
||||
</header>
|
||||
<form method="post" action="{% url 'day_view_when' %}?{% block when_parameters %}{% endblock %}">
|
||||
{% csrf_token %}
|
||||
<input type="date" name="when" required="" id="when_picker" value="{% now "Y-m-d" %}">
|
||||
<input type="submit" value="Voir les événements">
|
||||
</form>
|
||||
<footer>
|
||||
<p>Accès rapides :</p>
|
||||
<ul>
|
||||
{% block navigation-menu %}
|
||||
<li><a href="{% url 'a_venir' %}">maintenant</a></li>
|
||||
<li><a href="{% url 'cette_semaine' %}">cette semaine</a></li>
|
||||
<li><a href="{% url 'ce_mois_ci' %}">ce mois-ci</a></li>
|
||||
{% endblock%}
|
||||
</ul>
|
||||
</footer>
|
||||
</article>
|
||||
</dialog>
|
||||
|
||||
</body>
|
@ -7,10 +7,6 @@
|
||||
{% block og_image %}{% static 'images/merci.svg' %}{% endblock %}
|
||||
|
||||
|
||||
{% block entete_header %}
|
||||
<script src="{% static 'js/modal.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block fluid %}{% endblock %}
|
||||
|
||||
|
||||
|
@ -172,11 +172,11 @@ def no_emoji(text):
|
||||
def navigation_links(filter, category):
|
||||
extra = '?' + filter.get_url()
|
||||
if category is None:
|
||||
result = '<li><a href="' + reverse_lazy('a_venir') + extra + '">Maintenant</a></li>'
|
||||
result += '<li><a href="' + reverse_lazy('cette_semaine') + extra + '">Cette semaine</a></li>'
|
||||
result += '<li><a href="' + reverse_lazy('ce_mois_ci') + extra + '">Ce mois-ci</a></li>'
|
||||
result = '<li><a href="' + reverse_lazy('a_venir') + extra + '">maintenant</a></li>'
|
||||
result += '<li><a href="' + reverse_lazy('cette_semaine') + extra + '">cette semaine</a></li>'
|
||||
result += '<li><a href="' + reverse_lazy('ce_mois_ci') + extra + '">ce mois-ci</a></li>'
|
||||
else:
|
||||
result = '<li><a href="' + reverse_lazy('a_venir_category', kwargs={'cat': category.slug }) + extra + '">Maintenant</a></li>'
|
||||
result += '<li><a href="' + reverse_lazy('cette_semaine_category', kwargs={'cat': category.slug }) + extra + '">Cette semaine</a></li>'
|
||||
result += '<li><a href="' + reverse_lazy('ce_mois_ci_category', kwargs={'cat': category.slug }) + extra + '">Ce mois-ci</a></li>'
|
||||
result = '<li><a href="' + reverse_lazy('a_venir_category', kwargs={'cat': category.slug }) + extra + '">maintenant</a></li>'
|
||||
result += '<li><a href="' + reverse_lazy('cette_semaine_category', kwargs={'cat': category.slug }) + extra + '">cette semaine</a></li>'
|
||||
result += '<li><a href="' + reverse_lazy('ce_mois_ci_category', kwargs={'cat': category.slug }) + extra + '">ce mois-ci</a></li>'
|
||||
return mark_safe(result)
|
@ -46,6 +46,7 @@ urlpatterns = [
|
||||
path("cat:<cat>/cette-semaine/", week_view, name="cette_semaine_category"),
|
||||
path("cat:<cat>/mois/<int:year>/<int:month>/", month_view, name="month_view_category"),
|
||||
path("cat:<cat>/jour/<int:year>/<int:month>/<int:day>/", day_view, name="day_view_category"),
|
||||
path("cat:<cat>/jour/", day_view, name="day_view_category_when"),
|
||||
path("cat:<cat>/a-venir/", upcoming_events, name="a_venir_category"),
|
||||
path("cat:<cat>/aujourdhui/", day_view, name="aujourdhui_category"),
|
||||
path("cat:<cat>/a-venir/<int:year>/<int:month>/<int:day>/", upcoming_events, name="a_venir_jour_category"),
|
||||
@ -56,6 +57,7 @@ urlpatterns = [
|
||||
path("semaine/<int:year>/<int:week>/", week_view, name="week_view"),
|
||||
path("mois/<int:year>/<int:month>/", month_view, name="month_view"),
|
||||
path("jour/<int:year>/<int:month>/<int:day>/", day_view, name="day_view"),
|
||||
path("jour/", day_view, name="day_view_when"),
|
||||
path("aujourdhui/", day_view, name="aujourdhui"),
|
||||
path("a-venir/", upcoming_events, name="a_venir"),
|
||||
path("a-venir/<int:year>/<int:month>/<int:day>/", upcoming_events, name="a_venir_jour"),
|
||||
|
@ -267,6 +267,24 @@ def week_view(request, year=None, week=None, home=False, cat=None):
|
||||
|
||||
|
||||
def day_view(request, year=None, month=None, day=None, cat=None):
|
||||
if year is None or month is None or day is None:
|
||||
if "when" in request.POST:
|
||||
when = datetime.strptime(request.POST["when"], "%Y-%m-%d")
|
||||
year = when.year
|
||||
month = when.month
|
||||
day = when.day
|
||||
|
||||
request = EventFilter.set_default_values(request)
|
||||
qs = get_event_qs(request).select_related("exact_location")
|
||||
if cat is not None:
|
||||
category = Category.objects.filter(slug=cat).first()
|
||||
qs = qs.filter(category=category)
|
||||
else:
|
||||
category = None
|
||||
filter = EventFilter(request.GET, qs, request=request)
|
||||
|
||||
return HttpResponseRedirect(reverse_lazy("day_view", args=[year, month, day]) + "?" + filter.get_url())
|
||||
|
||||
return upcoming_events(request, year, month, day, 0, cat)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user