Merge pull request #4426 from FinnStutzenstein/addElementtoPreview

Add elements to preview button
This commit is contained in:
Emanuel Schütze 2019-02-28 10:45:18 +01:00 committed by GitHub
commit 9e2d42f9f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 9 deletions

View File

@ -47,8 +47,14 @@ export class ProjectionDialogService {
}); });
const response = await dialogRef.afterClosed().toPromise(); const response = await dialogRef.afterClosed().toPromise();
if (response) { if (response) {
const [projectors, projectorElement]: ProjectionDialogReturnType = response; const [action, projectors, projectorElement]: ProjectionDialogReturnType = response;
this.projectorService.projectOnMultiple(projectors, projectorElement); if (action === 'project') {
this.projectorService.projectOnMultiple(projectors, projectorElement);
} else if (action === 'addToPreview') {
projectors.forEach(projector => {
this.projectorService.addElementToPreview(projector, projectorElement);
});
}
} }
} }
} }

View File

@ -37,6 +37,7 @@
</div> </div>
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions> <mat-dialog-actions>
<button mat-button osAutofocus (click)="onOk()" color="primary" translate>OK</button> <button mat-button osAutofocus (click)="onProject()" color="primary" translate>Project</button>
<button mat-button (click)="onAddToPreview()" translate>Add to preview</button>
<button mat-button (click)="onCancel()" translate>Cancel</button> <button mat-button (click)="onCancel()" translate>Cancel</button>
</mat-dialog-actions> </mat-dialog-actions>

View File

@ -14,7 +14,7 @@ import {
SlideOptions SlideOptions
} from 'app/site/base/slide-options'; } from 'app/site/base/slide-options';
export type ProjectionDialogReturnType = [Projector[], IdentifiableProjectorElement]; export type ProjectionDialogReturnType = ['project' | 'addToPreview', Projector[], IdentifiableProjectorElement];
/** /**
*/ */
@ -85,10 +85,16 @@ export class ProjectionDialogComponent {
return isSlideChoiceOption(option); return isSlideChoiceOption(option);
} }
public onOk(): void { public onProject(): void {
let element = this.projectorElementBuildDescriptor.getBasicProjectorElement(this.optionValues); let element = this.projectorElementBuildDescriptor.getBasicProjectorElement(this.optionValues);
element = { ...element, ...this.optionValues }; element = { ...element, ...this.optionValues };
this.dialogRef.close([this.selectedProjectors, element]); this.dialogRef.close(['project', this.selectedProjectors, element]);
}
public onAddToPreview(): void {
let element = this.projectorElementBuildDescriptor.getBasicProjectorElement(this.optionValues);
element = { ...element, ...this.optionValues };
this.dialogRef.close(['addToPreview', this.selectedProjectors, element]);
} }
public onCancel(): void { public onCancel(): void {

View File

@ -50,9 +50,9 @@
</button> </button>
</div> </div>
<div class="queue"> <div class="queue" *ngIf="projector.elements_history.length">
<h5 translate>History</h5> <h5 translate>History</h5>
<p *ngFor="let elements of projector?.elements_history"> <p *ngFor="let elements of projector.elements_history">
{{ getSlideTitle(elements[0]) }} {{ getSlideTitle(elements[0]) }}
</p> </p>
</div> </div>
@ -143,7 +143,7 @@
</mat-list> </mat-list>
</div> </div>
<div class="queue"> <div class="queue" *ngIf="projector.elements_preview.length">
<h5 translate>Queue</h5> <h5 translate>Queue</h5>
<div cdkDropList class="drop-list" (cdkDropListDropped)="onSortingChange($event)"> <div cdkDropList class="drop-list" (cdkDropListDropped)="onSortingChange($event)">
<div class="list-entry" *ngFor="let element of projector.elements_preview; let i = index" cdkDrag> <div class="list-entry" *ngFor="let element of projector.elements_preview; let i = index" cdkDrag>