Merge pull request #5274 from tsiegleauq/untranslated-default-projector

Show translated values in projector preview
This commit is contained in:
Sean 2020-03-23 17:57:09 +01:00 committed by GitHub
commit 2fb372ead9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,7 +115,7 @@ export class ProjectorEditDialogComponent extends BaseViewComponent implements O
aspectRatio: ['', [Validators.required, Validators.pattern(this.aspectRatioRe)]], aspectRatio: ['', [Validators.required, Validators.pattern(this.aspectRatioRe)]],
width: [0, Validators.required], width: [0, Validators.required],
projectiondefaults_id: [[]], projectiondefaults_id: [[]],
clock: [true], clock: [],
color: ['', Validators.required], color: ['', Validators.required],
background_color: ['', Validators.required], background_color: ['', Validators.required],
header_background_color: ['', Validators.required], header_background_color: ['', Validators.required],
@ -149,21 +149,9 @@ export class ProjectorEditDialogComponent extends BaseViewComponent implements O
this.updateForm.patchValue(this.projector.projector); this.updateForm.patchValue(this.projector.projector);
this.updateForm.patchValue({ this.updateForm.patchValue({
name: this.translate.instant(this.projector.name), name: this.translate.instant(this.projector.name),
clock: this.clockSlideService.isProjectedOn(this.projector) clock: this.clockSlideService.isProjectedOn(this.projector),
aspectRatio: this.projector.aspectRatio
}); });
this.subscriptions.push(
this.repo.getViewModelObservable(this.projector.id).subscribe(update => {
// patches the projector with updated values
const projectorPatch = {};
Object.keys(this.updateForm.controls).forEach(ctrl => {
if (update[ctrl]) {
projectorPatch[ctrl] = update[ctrl];
}
});
this.updateForm.patchValue(projectorPatch);
})
);
} }
} }