Réparer les scripts intégrés aux vues
This commit is contained in:
parent
63224d8b06
commit
64ce1285aa
12 changed files with 112 additions and 97 deletions
|
|
@ -327,7 +327,7 @@ foreach ($volunteers as $v): ?><option value="<?= (int)$v['id'] ?>"
|
|||
const params = new URLSearchParams(new FormData(form));
|
||||
['view', 'date', 'month'].forEach(key => params.delete(key));
|
||||
document.querySelectorAll('a[href^="/agenda?"] , a[href^="/agenda/export.ics?"]').forEach(link => {
|
||||
if (link.title === < ? = json_encode(t('common.reset')) ? > ) return;
|
||||
if (link.title === <?= json_encode(t('common.reset')) ?> ) return;
|
||||
const url = new URL(link.href, location.origin);
|
||||
params.forEach((value, key) => url.searchParams.set(key, value));
|
||||
link.href = url.pathname + '?' + url.searchParams.toString();
|
||||
|
|
@ -335,20 +335,20 @@ foreach ($volunteers as $v): ?><option value="<?= (int)$v['id'] ?>"
|
|||
}
|
||||
const modal = document.getElementById('agendaModal');
|
||||
const addButton = document.getElementById('agendaAddButton');
|
||||
if (modal && addButton && < ? = (!$edit && PermissionService::can('agenda', 'edit')) ? 'true' :
|
||||
'false' ? > ) {
|
||||
const month = < ? = json_encode($cursor - > format('Y-m')) ? > ;
|
||||
const weekDates = < ? = json_encode(array_map(static fn($i) => $weekStart - > modify('+'.$i.
|
||||
' days') - > format('Y-m-d'), range(0, 6))) ? > ;
|
||||
if (modal && addButton && <?= (!$edit && PermissionService::can('agenda', 'edit')) ? 'true' :
|
||||
'false' ?> ) {
|
||||
const month = <?= json_encode($cursor->format('Y-m')) ?> ;
|
||||
const weekDates = <?= json_encode(array_map(static fn($i) => $weekStart->modify('+'.$i.
|
||||
' days')->format('Y-m-d'), range(0, 6))) ?> ;
|
||||
document.querySelectorAll('.agenda-calendar .agenda-day:not(.muted)').forEach((cell, index) => {
|
||||
const number = cell.querySelector('.agenda-number')?.textContent.trim();
|
||||
const date = < ? = $viewMode === 'week' ? 'weekDates[index]' :
|
||||
'month+\'-\'+String(parseInt(number,10)).padStart(2,\'0\')' ? > ;
|
||||
const date = <?= $viewMode === 'week' ? 'weekDates[index]' :
|
||||
'month+\'-\'+String(parseInt(number,10)).padStart(2,\'0\')' ?> ;
|
||||
if (!date) return;
|
||||
cell.classList.add('agenda-day-clickable');
|
||||
cell.tabIndex = 0;
|
||||
cell.setAttribute('role', 'button');
|
||||
cell.setAttribute('aria-label', < ? = json_encode(t('agenda.add_on_date')) ? > +' ' +
|
||||
cell.setAttribute('aria-label', <?= json_encode(t('agenda.add_on_date')) ?> +' ' +
|
||||
date.split('-').reverse().join('/'));
|
||||
const open = event => {
|
||||
if (event.target.closest('.agenda-event,button,a,input,select,textarea,label'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue