Skip to content

Commit

Permalink
Merge pull request #16164 from craftcms/bugfix/16151-disable-disallow…
Browse files Browse the repository at this point in the history
…ed-actions

check if data-id is empty or isn't there at all
  • Loading branch information
brandonkelly authored Nov 22, 2024
2 parents 6b3bf49 + 4374ab4 commit 1c36828
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Element indexes now sort by ID by default, for sources that don’t define a default sort option.
- Fixed a bug where element indexes were sorting by the first sortable attribute alphabetically by default, rather than the first sortable attribute defined by the element type.
- Fixed a bug where bulk asset actions where shown as available when subfolders were selected, when they shouldn’t have. ([#16151](https://github.com/craftcms/cms/issues/16151))

## 4.13.2 - 2024-11-19

Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/web/assets/cp/src/js/ElementActionTrigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,13 @@ Craft.ElementActionTrigger = Garnish.Base.extend(
return false;
}

if (this.settings.requireId && this.$selectedItems.is('[data-id=""]')) {
return false;
if (this.settings.requireId) {
for (let i = 0; i < this.$selectedItems.length; i++) {
const $item = this.$selectedItems.eq(i);
if (!Garnish.hasAttr($item, 'data-id') || $item.is('[data-id=""]')) {
return false;
}
}
}

if (typeof this.settings.validateSelection === 'function') {
Expand Down

0 comments on commit 1c36828

Please sign in to comment.