Skip to content

Commit

Permalink
Added logic to un check the select-all-checkbox on event CLOSE_BANNER…
Browse files Browse the repository at this point in the history
… and Remove Item from Multi Select
  • Loading branch information
TyroneAEM committed Mar 4, 2024
1 parent cef86c3 commit 36a5e58
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions blocks/adp-collection-header/adp-collection-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ function createCollectionInfoHeader(collectionInfoHeader, collection) {

document.getElementById('select-all-checkbox').addEventListener('click', function(event) {

Check failure on line 40 in blocks/adp-collection-header/adp-collection-header.js

View workflow job for this annotation

GitHub Actions / build

Unexpected function expression

Check warning on line 40 in blocks/adp-collection-header/adp-collection-header.js

View workflow job for this annotation

GitHub Actions / build

Unexpected unnamed function

Check failure on line 40 in blocks/adp-collection-header/adp-collection-header.js

View workflow job for this annotation

GitHub Actions / build

Missing space before function parentheses
// Get the checked state of the select all checkbox

Check failure on line 41 in blocks/adp-collection-header/adp-collection-header.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 6
var isChecked = event.target.checked;
const isChecked = event.target.checked;

Check failure on line 42 in blocks/adp-collection-header/adp-collection-header.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 6

// Get all the checkboxes within the cards

Check failure on line 44 in blocks/adp-collection-header/adp-collection-header.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 6
var checkboxes = document.querySelectorAll('.checkbox-container input[type="checkbox"], .filetype-video .checkbox-container input[type="checkbox"]');
const checkboxes = document.querySelectorAll('.checkbox-container input[type="checkbox"], .filetype-video .checkbox-container input[type="checkbox"]');

Check warning on line 45 in blocks/adp-collection-header/adp-collection-header.js

View workflow job for this annotation

GitHub Actions / build

This line has a length of 157. Maximum allowed is 140

Check failure on line 45 in blocks/adp-collection-header/adp-collection-header.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 6

Check failure on line 45 in blocks/adp-collection-header/adp-collection-header.js

View workflow job for this annotation

GitHub Actions / build

'checkboxes' is assigned a value but never used
// isChecked then selectAllAssets() else deselectAllAssets

Check failure on line 46 in blocks/adp-collection-header/adp-collection-header.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 6
isChecked ? selectAllAssets() : deselectAllAssets();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export default class CollectionsDatasource {
},
removeItemFromMultiSelectionHandler: () => {
infiniteResultsContainer.removeItemFromMultiSelection(assetId);
//Uncheck select all checkbox
document.getElementById('select-all-checkbox').checked = false;
},
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default async function decorate(block) {
infiniteResultsContainer.deselectItem(e.detail.assetId);
});
addEventListener(EventNames.CLOSE_BANNER, () => {
//Uncheck select all checkbox
document.getElementById('select-all-checkbox').checked = false;
infiniteResultsContainer.clearAllSelections();
});
}
Expand Down
2 changes: 2 additions & 0 deletions blocks/adp-infinite-results-linkshare/LinkShareDatasource.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export default class LinkShareDatasource {
},
removeItemFromMultiSelectionHandler: () => {
infiniteResultsContainer.removeItemFromMultiSelection(assetId);
//Uncheck select all checkbox
document.getElementById('select-all-checkbox').checked = false;
},
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export default async function decorate(block) {
infiniteResultsContainer.deselectItem(e.detail.assetId);
});
addEventListener(EventNames.CLOSE_BANNER, () => {
//Uncheck select all checkbox
document.getElementById('select-all-checkbox').checked = false;
infiniteResultsContainer.clearAllSelections();
});
}
Expand All @@ -30,5 +32,3 @@ export function selectAllAssets() {
export function deselectAllAssets() {
infiniteResultsContainer.deselectAllItems();
}


4 changes: 2 additions & 2 deletions blocks/adp-share-header/adp-share-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ function createShareInfoHeader(shareInfoHeader) {

document.getElementById('select-all-checkbox').addEventListener('click', function(event) {

Check warning on line 24 in blocks/adp-share-header/adp-share-header.js

View workflow job for this annotation

GitHub Actions / build

Unexpected unnamed function
// Get the checked state of the select all checkbox
var isChecked = event.target.checked;
const isChecked = event.target.checked;

// Get all the checkboxes within the cards
var checkboxes = document.querySelectorAll('.checkbox-container input[type="checkbox"], .filetype-video .checkbox-container input[type="checkbox"]');
const checkboxes = document.querySelectorAll('.checkbox-container input[type="checkbox"], .filetype-video .checkbox-container input[type="checkbox"]');

Check warning on line 29 in blocks/adp-share-header/adp-share-header.js

View workflow job for this annotation

GitHub Actions / build

This line has a length of 157. Maximum allowed is 140
// isChecked then selectAllAssets() else deselectAllAssets
isChecked ? selectAllAssets() : deselectAllAssets();
});
Expand Down

0 comments on commit 36a5e58

Please sign in to comment.