Skip to content

Commit

Permalink
Fixed New ad unit size error (#922)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-pilarczyk authored Jul 29, 2022
1 parent 39517dd commit 808ece4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.18.7] - 2022-07-29
### Fixed
- New ad unit size error

## [1.18.6] - 2022-07-20
### Fixed
- Handling missing ad unit's size
Expand Down Expand Up @@ -454,7 +458,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Publisher features (Sites & AdUnits)


[Unreleased]: https://github.com/adshares/adpanel/compare/v1.18.6...develop
[Unreleased]: https://github.com/adshares/adpanel/compare/v1.18.7...develop
[1.18.7]: https://github.com/adshares/adpanel/compare/v1.18.6...v1.18.7
[1.18.6]: https://github.com/adshares/adpanel/compare/v1.18.5...v1.18.6
[1.18.5]: https://github.com/adshares/adpanel/compare/v1.18.4...v1.18.5
[1.18.4]: https://github.com/adshares/adpanel/compare/v1.18.2...v1.18.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
class="dwmth-form-input"
formControlName="name"
data-test="publisher-edit-site-create-ad-units-form-short-headline"
[readonly]="!adUnitForm.get('size').value && adUnitForm.get('saved').value"
>
<span
*ngIf="adUnitForm.get('name').valid"
Expand Down Expand Up @@ -141,7 +142,7 @@
Ad unit size
</div>
<div
*ngIf="createSiteMode || adUnitForm.get('size').value"
*ngIf="adUnitForm.get('size').value || !adUnitForm.get('saved').value"
[ngClass]="filteredAdUnitSizes[adUnitIndex].length > 4 ? 'justify-between' : 'justify-start'"
class="row"
>
Expand Down Expand Up @@ -193,7 +194,7 @@
</div>
</div>
<div
*ngIf="!createSiteMode && !adUnitForm.get('size').value"
*ngIf="!adUnitForm.get('size').value && adUnitForm.get('saved').value"
class="row"
>
<span class="error-msg">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class EditSiteCreateAdUnitsComponent extends HandleSubscription implement

if (savedAdUnits.length > 0) {
savedAdUnits.forEach((savedAdUnit, index) => {
this.adUnitForms.push(this.generateFormField(savedAdUnit));
this.adUnitForms.push(this.generateFormField(savedAdUnit, true));
this.adUnitPanelsStatus[index] = false;
this.selectChosenSize(savedAdUnit, index);
});
Expand Down Expand Up @@ -120,7 +120,7 @@ export class EditSiteCreateAdUnitsComponent extends HandleSubscription implement
}
}

generateFormField(adUnit: Partial<AdUnit>): FormGroup {
generateFormField(adUnit: Partial<AdUnit>, saved: boolean = false): FormGroup {
this.filteredAdUnitSizes.push(cloneDeep(this.adUnitSizes));
this.allAdUnitSizes.push(cloneDeep(this.adUnitSizes));

Expand All @@ -133,6 +133,7 @@ export class EditSiteCreateAdUnitsComponent extends HandleSubscription implement
label: new FormControl(adUnit.label, Validators.required),
tags: new FormControl(adUnit.tags, Validators.required),
id: new FormControl(adUnit.id),
saved: new FormControl(saved)
});
}

Expand Down

0 comments on commit 808ece4

Please sign in to comment.