[ACA-1066] Improved files preview (#173)

* preview files child route

* fix previewing root files (personal)
This commit is contained in:
Denys Vuika
2018-01-09 16:00:19 +00:00
committed by GitHub
parent c38a193712
commit 00d14069c5
13 changed files with 138 additions and 55 deletions

View File

@@ -80,9 +80,10 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
if (node.isFolder) {
this.updateCurrentNode(node);
} else {
this.router.navigate(['/personal-files', node.parentId]);
this.router.navigate(['/personal-files', node.parentId], { replaceUrl: true });
}
})
.skipWhile(node => !node.isFolder)
.flatMap((node) => this.fetchNodes(node.id))
.subscribe(
(page) => {
@@ -154,7 +155,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
event.preventDefault();
} else if (node.isFile) {
this.router.navigate(['/preview', node.id]);
this.router.navigate(['./preview', node.id], { relativeTo: this.route });
}
}
@@ -164,7 +165,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
showPreview(node: MinimalNodeEntryEntity) {
if (node) {
if (node.isFile) {
this.router.navigate(['/preview', node.id]);
this.router.navigate(['./preview', node.id], { relativeTo: this.route });
}
}
}