diff --git a/resources/css/pages/template-archive-publications.css b/resources/css/pages/template-archive-publications.css index a104fa1..6b4bc42 100644 --- a/resources/css/pages/template-archive-publications.css +++ b/resources/css/pages/template-archive-publications.css @@ -36,8 +36,14 @@ } } &__comment { - @apply max-w-3xl pr-6 text-secondary; + @apply max-w-3xl pr-7 text-secondary; line-height: 1.6; + a:not(.cta) { + @apply underline font-bold underline-offset-2; + } + p { + @apply mb-2; + } } &__cover { @@ -80,6 +86,6 @@ .brochures-archives, .fiches-infos-archives, .videos-webinaires-archives { - @apply max-w-screen-xl mx-auto py-4 mt-8; + @apply max-w-screen-xl mx-auto pt-4 pb-16 mt-8; } } diff --git a/resources/js/archive-template-publications.js b/resources/js/archive-template-publications.js index 1affbec..d3c584e 100644 --- a/resources/js/archive-template-publications.js +++ b/resources/js/archive-template-publications.js @@ -98,23 +98,27 @@ async function filterPublications(publicationType, e) { const sectionFichesInfos = document.querySelector('.fiches-infos-archives'); const sectionBrochures = document.querySelector('.brochures-archives'); const sectionWebinaires = document.querySelector('.videos-webinaires-archives'); + const sectionHighlight = document.querySelector('#highlighted-document'); sectionFichesInfos.removeAttribute('hidden'); sectionWebinaires.removeAttribute('hidden'); sectionBrochures.removeAttribute('hidden'); - + sectionHighlight.removeAttribute('hidden'); switch (publicationType) { case 'all': sectionBrochures.setAttribute('isLoading', true); sectionFichesInfos.setAttribute('isLoading', true); + sectionHighlight.setAttribute('isLoading', true); await hydrateAll(); sectionBrochures.removeAttribute('isLoading'); sectionFichesInfos.removeAttribute('isLoading'); + sectionHighlight.removeAttribute('isLoading'); break; case 'brochures': sectionFichesInfos.setAttribute('hidden', true); sectionWebinaires.setAttribute('hidden', true); + sectionHighlight.setAttribute('hidden', true); sectionBrochures.setAttribute('isLoading', true); await hydrateBrochureArchiveGrid(); @@ -124,6 +128,7 @@ async function filterPublications(publicationType, e) { case 'fiches-infos': sectionBrochures.setAttribute('hidden', true); sectionWebinaires.setAttribute('hidden', true); + sectionHighlight.setAttribute('hidden', true); sectionFichesInfos.setAttribute('isLoading', true); await hydrateFicheInfoArchiveGrid(); @@ -133,6 +138,8 @@ async function filterPublications(publicationType, e) { case 'webinaires': sectionFichesInfos.setAttribute('hidden', true); sectionBrochures.setAttribute('hidden', true); + sectionHighlight.setAttribute('hidden', true); + sectionWebinaires.setAttribute('isLoading', true); setTimeout(() => { sectionWebinaires.removeAttribute('isLoading'); @@ -143,10 +150,30 @@ async function filterPublications(publicationType, e) { updateSearchResultsIndications(publicationType, e); toggleActiveFilterButton(e); } +async function loadMorePublications(publicationType, button, e) { + button.setAttribute('hidden', true); + const sectionFichesInfos = document.querySelector('.fiches-infos-archives'); + const sectionBrochures = document.querySelector('.brochures-archives'); + + switch (publicationType) { + case 'brochures': + sectionBrochures.setAttribute('isLoading', true); + await hydrateBrochureArchiveGrid(); + sectionBrochures.removeAttribute('isLoading'); + break; + + case 'fiches-infos': + sectionFichesInfos.setAttribute('isLoading', true); + await hydrateFicheInfoArchiveGrid(); + sectionFichesInfos.removeAttribute('isLoading'); + break; + } +} export default function filterPublicationsInit() { const filterButtons = document.querySelectorAll('.filters-toolbar__action-button'); const loadAllbutton = document.querySelector('.filters-toolbar__action-button--load-all'); + const loadMoreButtons = document.querySelectorAll('.cta--load-more'); if (!filterButtons) return; filterButtons.forEach((button) => { @@ -161,4 +188,12 @@ export default function filterPublicationsInit() { const publicationType = loadAllbutton.getAttribute('data-publication-type'); filterPublications(publicationType, e); }); + + if (!loadMoreButtons) return; + loadMoreButtons.forEach((button) => { + const publicationType = button.getAttribute('data-publication-type'); + button.addEventListener('click', (e) => { + loadMorePublications(publicationType, button, e); + }); + }); } diff --git a/template-publications.php b/template-publications.php index b38ec67..6f597f1 100644 --- a/template-publications.php +++ b/template-publications.php @@ -113,6 +113,42 @@ $total_posts_found = $brochuresPosts->found_posts + $fichesInfosPosts->found_pos + +
+ @@ -122,39 +158,6 @@ $total_posts_found = $brochuresPosts->found_posts + $fichesInfosPosts->found_posCurabitur eleifend neque eu erat lacinia tincidunt
- -