diff --git a/src/app/components/creator/_dialogs/content-edit/content-edit.component.html b/src/app/components/creator/_dialogs/content-edit/content-edit.component.html index 6a0ee94f4adfe0a56835c896b4862895507faa20..7554243a02b6e037e5312da2eb5867f45e7b7cb5 100644 --- a/src/app/components/creator/_dialogs/content-edit/content-edit.component.html +++ b/src/app/components/creator/_dialogs/content-edit/content-edit.component.html @@ -6,10 +6,10 @@ <textarea matInput [(ngModel)]="content.body" rows="3" maxlength="100" placeholder="Inhalt" name="body"></textarea> </mat-form-field> <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="10px"> - <button (click)="dialogRef.close()" mat-button color="primary"> + <button (click)="dialogRef.close('abort')" mat-button color="primary"> {{ 'room-page.abort' | translate }} </button> - <button (click)="dialogRef.close('edit')" mat-raised-button color="primary"> + <button (click)="dialogRef.close('update')" mat-raised-button color="primary"> {{ 'room-page.update' | translate }} </button> </div> diff --git a/src/app/components/creator/content-list/content-list.component.ts b/src/app/components/creator/content-list/content-list.component.ts index 911909ef768beed4a61defd03ca9c4214dd218ad..766db7dff36a3e8ec0d923c8d75d924d0b42feaf 100644 --- a/src/app/components/creator/content-list/content-list.component.ts +++ b/src/app/components/creator/content-list/content-list.component.ts @@ -113,7 +113,7 @@ export class ContentListComponent implements OnInit { const index = this.findIndexOfSubject(delContent.subject); this.contentBackup = delContent; const dialogRef = this.dialog.open(ContentDeleteComponent, { - width: '800px' + width: '400px' }); dialogRef.componentInstance.content = delContent; dialogRef.afterClosed() @@ -131,7 +131,7 @@ export class ContentListComponent implements OnInit { const index = this.findIndexOfSubject(edContent.subject); const dialogRef = this.dialog.open(ContentEditComponent, { - width: '800px' + width: '400px' }); dialogRef.componentInstance.content = edContent; dialogRef.afterClosed() @@ -144,20 +144,18 @@ export class ContentListComponent implements OnInit { if (!action) { this.contents[index] = this.contentBackup; } else { - if (action.valueOf() === 'delete') { - this.notificationService.show('Content "' + this.contents[index].subject + '" deleted.'); - this.contentService.deleteContent(this.contents[index].id).subscribe(); - this.contents.splice(index, 1); - if (this.contents.length === 0) { - this.location.back(); - } - } - if (action.valueOf() === 'edit') { - this.notificationService.show('Content "' + this.contents[index].subject + '" updated.'); - this.contentService.updateContent(this.contents[index]); - } - if (action.valueOf() === 'abort') { - this.contents[index] = this.contentBackup; + switch (action.valueOf()) { + case 'delete': + this.notificationService.show('Content "' + this.contents[index].subject + '" deleted.'); + this.contentService.deleteContent(this.contents[index].id).subscribe(); + this.contents.splice(index, 1); + if (this.contents.length === 0) { + this.location.back(); + } + break; + case 'abort': + this.contents[index] = this.contentBackup; + break; } } }