EDT: fix pb affichage signalés par PB

This commit is contained in:
Emmanuel Viennet 2024-01-09 02:03:16 +01:00
parent a63ed6c0ef
commit 1e33626b60
2 changed files with 8 additions and 5 deletions

View File

@ -179,7 +179,6 @@ document.addEventListener('DOMContentLoaded', function() {
var renderRange = document.getElementById('renderRange'); var renderRange = document.getElementById('renderRange');
var options = calendar.getOptions(); var options = calendar.getOptions();
var viewName = calendar.getViewName(); var viewName = calendar.getViewName();
var html = []; var html = [];
if (viewName === 'day') { if (viewName === 'day') {
html.push(calendar.getDate().toDate().toLocaleString('fr-Fr', { html.push(calendar.getDate().toDate().toLocaleString('fr-Fr', {
@ -221,13 +220,15 @@ document.addEventListener('DOMContentLoaded', function() {
changeCalendarDate(); changeCalendarDate();
} }
// Update current URL when date change (newDate=ISO string) // Update current URL when date change (newDate=ISO string)
function updateCurrentDateInUrl(newDate) { function updateParametersInUrl(newParams) {
// Parse the current URL // Parse the current URL
const currentUrl = new URL(window.location.href); const currentUrl = new URL(window.location.href);
// Access and modify the search parameters // Access and modify the search parameters
const searchParams = currentUrl.searchParams; const searchParams = currentUrl.searchParams;
searchParams.set('current_date', newDate); // Set the new date Object.entries(newParams).forEach(([key, value]) => {
searchParams.set(key, value);
});
// Create the new URL // Create the new URL
const newUrl = `${currentUrl.origin}${currentUrl.pathname}?${searchParams.toString()}`; const newUrl = `${currentUrl.origin}${currentUrl.pathname}?${searchParams.toString()}`;
@ -240,7 +241,7 @@ document.addEventListener('DOMContentLoaded', function() {
setRenderRangeText(); setRenderRangeText();
// current calendar date, ISO, without time // current calendar date, ISO, without time
const iso_date = calendar.getDateRangeStart().toDate().toISOString().split('T')[0]; const iso_date = calendar.getDateRangeStart().toDate().toISOString().split('T')[0];
updateCurrentDateInUrl(iso_date); updateParametersInUrl( { current_date: iso_date } );
calendar_control_form.current_date.value = iso_date; calendar_control_form.current_date.value = iso_date;
} }
// View menu // View menu
@ -260,6 +261,8 @@ document.addEventListener('DOMContentLoaded', function() {
const selectedText = this.textContent; const selectedText = this.textContent;
const selectedView = this.getAttribute('data-view'); const selectedView = this.getAttribute('data-view');
calendar.changeView(selectedView); // Change the calendar view calendar.changeView(selectedView); // Change the calendar view
updateParametersInUrl( { view : selectedView } );
setRenderRangeText();
dropbtn.textContent = selectedText; // Update the button text dropbtn.textContent = selectedText; // Update the button text
dropdownContent.style.display = 'none'; dropdownContent.style.display = 'none';
}); });

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.6.75" SCOVERSION = "9.6.76"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"