Skip to content

Commit

Permalink
Fixed #11547
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Jul 5, 2022
1 parent 7f3f1fc commit e723853
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Fixed a styling issue with the Edit Route modal. ([#11528](https://github.com/craftcms/cms/issues/11528))
- Fixed a bug where assets uploaded from Assets fields weren’t retaining their original filename. ([#11530](https://github.com/craftcms/cms/issues/11530))
- Fixed a bug where project config changes made at the end of the request lifecycle weren’t getting saved.
- Fixed a bug where toggling entries’ and categories’ site-specific statuses from element editor slideouts wasn’t working. ([#11547](https://github.com/craftcms/cms/issues/11547))

## 4.1.0.2 - 2022-06-28

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.

8 changes: 5 additions & 3 deletions src/web/assets/cp/src/js/ElementEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ Craft.ElementEditor = Garnish.Base.extend(
const $globalField = Craft.ui
.createLightswitchField({
label: Craft.t('app', 'Enabled for all sites'),
name: 'enabled',
name: this.namespaceInputName('enabled'),
})
.insertBefore($enabledForSiteField);
$globalField.find('label').css('font-weight', 'bold');
Expand Down Expand Up @@ -480,7 +480,8 @@ Craft.ElementEditor = Garnish.Base.extend(
);

let serializedStatuses =
this.namespaceInputName('enabled') + `=${originalEnabledValue}`;
encodeURIComponent(this.namespaceInputName('enabled')) +
`=${originalEnabledValue}`;
for (let i = 0; i < this.$siteLightswitches.length; i++) {
const $input = this.$siteLightswitches.eq(i).data('lightswitch').$input;
serializedStatuses +=
Expand All @@ -494,6 +495,7 @@ Craft.ElementEditor = Garnish.Base.extend(
.replace(originalSerializedStatus, serializedStatuses)
);

debugger;
if (this.lastSerializedValue) {
this.lastSerializedValue = this.lastSerializedValue.replace(
originalSerializedStatus,
Expand Down Expand Up @@ -589,7 +591,7 @@ Craft.ElementEditor = Garnish.Base.extend(
const $field = Craft.ui.createLightswitchField({
fieldClass: `enabled-for-site-${site.id}-field`,
label: site.name,
name: `enabledForSite[${site.id}]`,
name: this.namespaceInputName(`enabledForSite[${site.id}]`),
on:
typeof status != 'undefined'
? status
Expand Down

0 comments on commit e723853

Please sign in to comment.