[APM-7] Feature enhancement for the create and edit folder directive (#3179)

* Add observable menu open state to the sidenav-layout component

* add documentation, fix inversed value

* Add success events to folder create/edit directives

* Overridable dialog titles for the directives

* Update the documentation
This commit is contained in:
Popovics András
2018-04-17 20:27:42 +01:00
committed by Eugenio Romano
parent 21ad4c2894
commit ee9393caf0
12 changed files with 569 additions and 242 deletions

View File

@@ -42,6 +42,12 @@ export class FolderDialogComponent implements OnInit {
@Output()
error: EventEmitter<any> = new EventEmitter<any>();
@Output()
success: EventEmitter<any> = new EventEmitter<MinimalNodeEntryEntity>();
editTitle = 'CORE.FOLDER_DIALOG.EDIT_FOLDER_TITLE';
createTitle = 'CORE.FOLDER_DIALOG.CREATE_FOLDER_TITLE';
constructor(
private formBuilder: FormBuilder,
private dialog: MatDialogRef<FolderDialogComponent>,
@@ -50,7 +56,12 @@ export class FolderDialogComponent implements OnInit {
@Optional()
@Inject(MAT_DIALOG_DATA)
public data: any
) {}
) {
if (data) {
this.editTitle = data.editTitle || this.editTitle;
this.createTitle = data.createTitle || this.createTitle;
}
}
get editing(): boolean {
return !!this.data.folder;
@@ -121,7 +132,10 @@ export class FolderDialogComponent implements OnInit {
(editing ? this.edit() : this.create())
.subscribe(
(folder: MinimalNodeEntryEntity) => dialog.close(folder),
(folder: MinimalNodeEntryEntity) => {
this.success.emit(folder);
dialog.close(folder);
},
(error) => this.handleError(error)
);
}