diff --git a/demo-shell-ng2/app/components/document-list.component.ts b/demo-shell-ng2/app/components/document-list.component.ts index af961245eb..441ffd0684 100644 --- a/demo-shell-ng2/app/components/document-list.component.ts +++ b/demo-shell-ng2/app/components/document-list.component.ts @@ -7,30 +7,48 @@ import {DocumentEntity} from "./core/entities/document.entity"; selector: 'alfresco-document-list', styles: [ ` + :host .breadcrumb { + margin-bottom: 4px; + } + :host .folder-icon { float: left; margin-right: 10px; } + :host .file-icon { width: 52px; height: 52px; float: left; margin-right: 10px; } + + :host .document-header:hover { + text-decoration: underline; + } ` ], template: ` +
- + ... -

+

{{document.displayName}}

{{document.description}}

+ + Modified {{document.modifiedOn}} by {{document.modifiedBy}} +
`, @@ -40,20 +58,25 @@ export class DocumentList implements OnInit { // example: @Input() navigate: boolean = true; + // example: + @Input() breadcrumb: boolean = false; // example: @Input('folder-icon-class') folderIconClass: string = 'fa fa-folder-o fa-4x'; // example: @Input() thumbnails: boolean = true; - - rootFolderPath: string = 'swsdp/documentLibrary'; + + rootFolder = { + name: 'Document Library', + path: 'swsdp/documentLibrary' + }; currentFolderPath: string = 'swsdp/documentLibrary'; folder: FolderEntity; errorMessage; - private route: string[] = []; + route: any[] = []; canNavigateParent(): boolean { - return this.currentFolderPath !== this.rootFolderPath; + return this.currentFolderPath !== this.rootFolder.path; } constructor ( @@ -61,8 +84,8 @@ export class DocumentList implements OnInit { ) {} ngOnInit() { - this.route.push(this.rootFolderPath); - this.displayFolderContent(this.rootFolderPath); + this.route.push(this.rootFolder); + this.displayFolderContent(this.rootFolder.path); } private displayFolderContent(path) { @@ -82,9 +105,9 @@ export class DocumentList implements OnInit { if (this.navigate) { this.route.pop(); - var parent = this.route.length > 0 ? this.route[this.route.length - 1] : this.rootFolderPath; + var parent = this.route.length > 0 ? this.route[this.route.length - 1] : this.rootFolder; if (parent) { - this.displayFolderContent(parent); + this.displayFolderContent(parent.path); } } } @@ -97,12 +120,27 @@ export class DocumentList implements OnInit { if (this.navigate && item) { if (item.isFolder) { var path = this.getItemPath(item); - this.route.push(path); + this.route.push({ + name: item.displayName, + path: path + }); this.displayFolderContent(path); } } } + goToRoute(r, $event) { + if ($event) { + $event.preventDefault(); + } + + var idx = this.route.indexOf(r); + if (idx > -1) { + this.route.splice(idx + 1); + this.displayFolderContent(r.path); + } + } + private getItemPath(item: DocumentEntity):string { var container = item.location.container; var path = item.location.path !== '/' ? (item.location.path + '/' ) : '/'; diff --git a/demo-shell-ng2/app/components/page1.view.ts b/demo-shell-ng2/app/components/page1.view.ts index b12bf26045..8843b96e53 100644 --- a/demo-shell-ng2/app/components/page1.view.ts +++ b/demo-shell-ng2/app/components/page1.view.ts @@ -5,12 +5,14 @@ import {DocumentList} from "./document-list.component"; template: `
- +
+
- + +
`, @@ -18,4 +20,5 @@ import {DocumentList} from "./document-list.component"; }) export class Page1View { thumbnails: boolean = true; + breadcrumb: boolean = false; }