Skip to content
Snippets Groups Projects

Resolve "Save toggling on Job Offers Page for Students"

Files

@@ -88,17 +88,13 @@
<div class="flex justify-end">
<button
class="fa-solid fa-chevron-down"
th:aria-expanded="${expanded}"
th:aria-controls="|edition-${edition.id}|"></button>
</div>
</td>
</tr>
</tbody>
<tbody
class="accordion__content"
th:id="|edition-${edition.id}|"
th:aria-expanded="${expanded}">
<tbody class="accordion__content" th:id="|edition-${edition.id}|">
<tr
th:each="offer : ${edition.offers}"
th:if="${!offer.hidden}"
@@ -235,6 +231,37 @@
</div>
<script th:inline="text">
if (localStorage.getItem("expandedItems") == null) {
localStorage.setItem("expandedItems", "{}");
}
$(() => {
let expandedItems = JSON.parse(localStorage.getItem("expandedItems"));
$('[class="accordion__content"]').each(function () {
let accordionId = $(this).attr("id");
if (expandedItems.hasOwnProperty(accordionId)) {
let isExpanded = expandedItems[accordionId];
$(
'tbody[id="' +
accordionId +
'"], button[aria-controls="' +
accordionId +
'"]',
).attr("aria-expanded", isExpanded);
}
});
$("button, tbody.accordion__header").on("click", function () {
let button = $(this).closest("tbody.accordion__header").find("button");
let accordionId = button.attr("aria-controls");
let isExpanded = button.attr("aria-expanded");
if (isExpanded) {
let expandedItems = JSON.parse(localStorage.getItem("expandedItems"));
expandedItems[accordionId] = isExpanded;
localStorage.setItem("expandedItems", JSON.stringify(expandedItems));
}
});
});
$(() => {
$("#program-select").change(function () {
let url = new URL(window.location);
Loading