Navigation vers une autre semaine

Fix #138
This commit is contained in:
Jean-Marie Favreau 2024-09-15 19:09:24 +02:00
parent fe55c23b74
commit 24c7160e70
4 changed files with 51 additions and 12 deletions

View File

@ -2,26 +2,39 @@
function displayButtons() {
delta = 60
agenda = document.getElementById("calendar");
grid = agenda.querySelector(".grid");
buttonLeft = agenda.querySelector(".slider-button.button-left");
buttonRight = agenda.querySelector(".slider-button.button-right");
buttonLeft = agenda.querySelector(".slider-button.slider-button-inside.button-left");
buttonRight = agenda.querySelector(".slider-button.slider-button-inside.button-right");
buttonLeftPage = agenda.querySelector(".slider-button.slider-button-page.button-left");
buttonRightPage = agenda.querySelector(".slider-button.slider-button-page.button-right");
if (agenda.offsetWidth < grid.offsetWidth) {
if (agenda.scrollLeft == 0)
if (agenda.scrollLeft < delta) {
buttonLeft.classList.add("hidden");
else
buttonLeftPage.classList.remove("hidden");
}
else {
buttonLeft.classList.remove("hidden");
if (agenda.scrollLeft + agenda.offsetWidth - grid.offsetWidth == 0)
buttonLeftPage.classList.add("hidden");
}
if (agenda.scrollLeft + agenda.offsetWidth - grid.offsetWidth >= -2) {
buttonRight.classList.add("hidden");
else
buttonRightPage.classList.remove("hidden");
}
else {
buttonRight.classList.remove("hidden");
buttonRightPage.classList.add("hidden");
}
}
else {
buttonLeft.classList.add("hidden");
buttonRight.classList.add("hidden");
buttonLeftPage.classList.add("hidden");
buttonRightPage.classList.add("hidden");
}
}

View File

@ -312,10 +312,13 @@ footer [data-tooltip] {
border-radius: 1em;
line-height: 2em;
text-align: center;
position: absolute;
top: 75vh;
position: fixed;
top: 65vh;
z-index: 10;
opacity: 0.9;
a {
color: var(--primary-inverse);
}
}
.slider-button.hidden {
display: none;

View File

@ -54,7 +54,13 @@
</div>
</header>
<div id="calendar">
<div class="slider-button button-left hidden">{% picto_from_name "arrow-left" %}</div>
<div class="slider-button slider-button-inside button-left hidden">{% picto_from_name "arrow-left" %}</div>
{% if calendar.firstdate|shift_day:-1|not_before_first %}
{% if calendar.lastdate|not_after_last %}
<div class="slider-button slider-button-page button-left hidden"><a href="{% url 'month_view' calendar.previous_month.year calendar.previous_month.month %}?{{ filter.get_url }}">{% picto_from_name "chevrons-left" %}</a></div>
{% endif %}
{% endif %}
<div class="grid week-in-month">
{% for d in calendar.calendar_days_list %}
{% if forloop.counter0|divisibleby:7 %}
@ -64,7 +70,12 @@
{% include "agenda_culturel/day-inc.html" with day=d resume=1 fixed_style=calendar.all_in_past filter=filter headers="h3" %}
{% endfor %}
</div>
<div class="slider-button button-right hidden">{% picto_from_name "arrow-right" %}</div>
{% if calendar.lastdate|shift_day:+1|not_after_last %}
{% if calendar.lastdate|not_before_first %}
<div class="slider-button slider-button-page button-right hidden"><a href="{% url 'month_view' calendar.next_month.year calendar.next_month.month %}?{{ filter.get_url }}">{% picto_from_name "chevrons-right" %}</a></div>
{% endif %}
{% endif %}
<div class="slider-button slider-button-inside button-right hidden">{% picto_from_name "arrow-right" %}</div>
</div>

View File

@ -55,13 +55,25 @@
</div>
</header>
<div id="calendar">
<div class="slider-button button-left hidden">{% picto_from_name "arrow-left" %}</div>
<div class="slider-button slider-button-inside button-left hidden">{% picto_from_name "arrow-left" %}</div>
{% if calendar.firstdate|shift_day:-1|not_before_first %}
{% if calendar.lastdate|not_after_last %}
<div class="slider-button slider-button-page button-left hidden"><a href="{% url 'week_view' calendar.previous_week.year calendar.previous_week|week %}?{{ filter.get_url }}">{% picto_from_name "chevrons-left" %}</a></div>
{% endif %}
{% endif %}
<div class="grid">
{% for d in calendar.calendar_days_list %}
{% include "agenda_culturel/day-inc.html" with day=d fixed_style=calendar.all_in_past filter=filter %}
{% endfor %}
</div>
<div class="slider-button button-right hidden">{% picto_from_name "arrow-right" %}</div>
<div class="slider-button slider-button-inside button-right hidden">{% picto_from_name "arrow-right" %}</div>
{% if calendar.lastdate|shift_day:+1|not_after_last %}
{% if calendar.lastdate|not_before_first %}
<div class="slider-button slider-button-page button-right hidden"><a href="{% url 'week_view' calendar.next_week.year calendar.next_week|week %}?{{ filter.get_url }}">{% picto_from_name "chevrons-right" %}</a></div>
{% endif %}
{% endif %}
</div>
<footer>