Skip to content

Commit

Permalink
Make sure all checkboxes are checked when the "All" option is selected.
Browse files Browse the repository at this point in the history
Resolves #16
  • Loading branch information
mmikkel committed Mar 30, 2024
1 parent 770e6db commit 81ff133
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.3.1 - 2024-03-30
### Fixed
- Fixed a bug where newly added cache items could appear as unchecked, when the "All" option was checked ([#16](https://github.com/mmikkel/CpClearCache-Craft/issues/16))

## 1.3.0 - 2022-11-10
### Fixed
- Fixed an issue where CP Clear Cache wouldn't work properly if the Control Panel Navigation was installed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mmikkel/cp-clearcache",
"description": "Less clickin’ to get clearin’",
"type": "craft-plugin",
"version": "1.3.0",
"version": "1.3.1",
"keywords": [
"craft",
"cms",
Expand Down
7 changes: 6 additions & 1 deletion src/resources/cpclearcache.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@
new Garnish.CheckboxSelect($checkboxes);
var checkedBoxes = Craft.getLocalStorage(_this.localStorageKey);
$checkboxes.find('input[type="checkbox"]').each(function () {
$(this).prop('checked', checkedBoxes === undefined || checkedBoxes.indexOf(this.value) > -1).trigger('change');
var checked = !checkedBoxes || checkedBoxes.indexOf(this.value) > -1;
if (!checked && !!checkedBoxes && checkedBoxes.indexOf('*') > -1 && !!$(this).closest('fieldset.checkbox-select').eq(0).find('input[type="checkbox"][value="*"]').length) {
// Not specifically checked, but "All" is checked
checked = true;
}
$(this).prop('checked', checked).trigger('change');
});
});

Expand Down

0 comments on commit 81ff133

Please sign in to comment.