Skip to content

Commit

Permalink
Fix favorites multi-select-list storage cleanup after deleting items …
Browse files Browse the repository at this point in the history
…from lists (#3790)
  • Loading branch information
LuomaJuha committed Jun 14, 2024
1 parent c0dda59 commit cc1950f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion themes/bootstrap3/js/list_item_selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ VuFind.register("listItemSelection", function ListItemSelection() {

let nonDefaultIds = _sessionGet(form, 'nonDefaultIds') || [];
let checkedDefault = _sessionGet(form, 'checkedDefault') || false;

// Check if the form contains all the ids in the nonDefaultIds
const allIds = JSON.parse(form.querySelector('.all-ids-global').value || '[]');
if (allIds) {
nonDefaultIds = nonDefaultIds.filter(item => allIds.includes(item));
}
form.querySelectorAll('.checkbox-select-item').forEach(itemCheckbox => {
itemCheckbox.checked = nonDefaultIds.includes(itemCheckbox.value) ? !checkedDefault : checkedDefault;
});
Expand Down
6 changes: 5 additions & 1 deletion themes/bootstrap5/js/list_item_selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ VuFind.register("listItemSelection", function ListItemSelection() {

let nonDefaultIds = _sessionGet(form, 'nonDefaultIds') || [];
let checkedDefault = _sessionGet(form, 'checkedDefault') || false;

// Check if the form contains all the ids in the nonDefaultIds
const allIds = JSON.parse(form.querySelector('.all-ids-global').value || '[]');
if (allIds) {
nonDefaultIds = nonDefaultIds.filter(item => allIds.includes(item));
}
form.querySelectorAll('.checkbox-select-item').forEach(itemCheckbox => {
itemCheckbox.checked = nonDefaultIds.includes(itemCheckbox.value) ? !checkedDefault : checkedDefault;
});
Expand Down

0 comments on commit cc1950f

Please sign in to comment.