Add elements to preview button

This commit is contained in:
FinnStutzenstein 2019-02-28 09:37:25 +01:00
parent f532a60b36
commit 80e236e5b0
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;
if (action === 'project') {
this.projectorService.projectOnMultiple(projectors, projectorElement); 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>