diff --git a/demo-shell-ng2/app/components/files/files.component.html b/demo-shell-ng2/app/components/files/files.component.html index f4374299bf..d654a5fd37 100644 --- a/demo-shell-ng2/app/components/files/files.component.html +++ b/demo-shell-ng2/app/components/files/files.component.html @@ -1,5 +1,6 @@ - - + + = new EventEmitter(); rootFolder = { - name: 'Document Library', - path: 'Sites/swsdp/documentLibrary' + name: '', + path: '' }; - currentFolderPath: string = 'swsdp/documentLibrary'; + + @Input() + currentFolderPath: string; + folder: NodePaging; errorMessage; @@ -81,11 +86,26 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit constructor(private _alfrescoService: AlfrescoService) { } + _createRootFolder(): Object { + let folderArray = this.currentFolderPath.split('/'); + let nameFolder = folderArray[folderArray.length -1] ; + return { + name: nameFolder, + path: this.currentFolderPath + }; + } + ngOnInit() { + this.currentFolderPath = this.currentFolderPath || this.DEFAULT_ROOT_FOLDER; + this.rootFolder = this._createRootFolder(); this.route.push(this.rootFolder); this.displayFolderContent(this.rootFolder.path); } + ngOnChanges(change) { + this.reload(this.currentFolderPath); + } + ngAfterContentInit() { if (!this.columns || this.columns.length === 0) { this.setupDefaultColumns(); @@ -132,6 +152,9 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit this.route.pop(); let parent = this.route.length > 0 ? this.route[this.route.length - 1] : this.rootFolder; if (parent) { + this.folderClick.emit({ + value: parent.path + }); this.displayFolderContent(parent.path); } }