From 98dd83fc2122f774b95f25a1e375070f17d4be1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de> Date: Fri, 8 Feb 2019 18:16:04 +0100 Subject: [PATCH] Cleanup content-text-creator-component --- .../content-text-creator.component.html | 7 +--- .../content-text-creator.component.ts | 33 ++----------------- 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/src/app/components/creator/content-text-creator/content-text-creator.component.html b/src/app/components/creator/content-text-creator/content-text-creator.component.html index e7d342d96..60a77b90d 100644 --- a/src/app/components/creator/content-text-creator/content-text-creator.component.html +++ b/src/app/components/creator/content-text-creator/content-text-creator.component.html @@ -1,10 +1,5 @@ <form (ngSubmit)="submitContent()"> - <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="5px" *ngIf="!editDialogMode"> + <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="5px"> <button mat-raised-button type="submit" color="accent">{{'content.create' | translate}}</button> </div> - <div *ngIf="editDialogMode"> - <button mat-raised-button (click)="editDialogClose($event,'edit')" color="primary">Update</button> - <button mat-raised-button (click)="editDialogClose($event,'abort')" color="primary">Abort</button> - <button mat-raised-button (click)="openDeletionContentDialog($event)" color="warn">Delete</button> - </div> </form> diff --git a/src/app/components/creator/content-text-creator/content-text-creator.component.ts b/src/app/components/creator/content-text-creator/content-text-creator.component.ts index fed678afc..2a920daa4 100644 --- a/src/app/components/creator/content-text-creator/content-text-creator.component.ts +++ b/src/app/components/creator/content-text-creator/content-text-creator.component.ts @@ -1,10 +1,7 @@ -import { Component, EventEmitter, Inject, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { ContentText } from '../../../models/content-text'; import { ContentService } from '../../../services/http/content.service'; import { NotificationService } from '../../../services/util/notification.service'; -import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material'; -import { ContentListComponent } from '../content-list/content-list.component'; -import { ContentDeleteComponent } from '../_dialogs/content-delete/content-delete.component'; import { TranslateService } from '@ngx-translate/core'; @Component({ @@ -33,10 +30,7 @@ export class ContentTextCreatorComponent implements OnInit { constructor(private contentService: ContentService, private notificationService: NotificationService, - public dialog: MatDialog, - public dialogRef: MatDialogRef<ContentListComponent>, - private translationService: TranslateService, - @Inject(MAT_DIALOG_DATA) public data: any) { + private translationService: TranslateService) { } ngOnInit() { @@ -75,27 +69,4 @@ export class ContentTextCreatorComponent implements OnInit { sessionStorage.setItem('collection', this.contentCol); this.resetAfterSubmit(); } - - editDialogClose($event, action: string) { - $event.preventDefault(); - this.dialogRef.close(action); - } - - onNoClick(): void { - this.dialogRef.close(); - } - - openDeletionContentDialog($event): void { - $event.preventDefault(); - const dialogRef = this.dialog.open(ContentDeleteComponent, { - width: '400px' - }); - dialogRef.componentInstance.content = this.content; - dialogRef.afterClosed() - .subscribe(result => { - if (result === 'delete') { - this.dialogRef.close(result); - } - }); - } } -- GitLab