mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
#46 refresh documentList after file uploaded
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<alfresco-upload-drag-area [showUploadDialog]="true" uploaddirectory="{{relativePath}}" >
|
||||
<alfresco-document-list (folderClick)="refreshDirectyory($event)">
|
||||
<alfresco-upload-drag-area [showUploadDialog]="true" uploaddirectory="{{relativePath}}"
|
||||
(onSuccess)="refreshDocumentList($event)">
|
||||
<alfresco-document-list (folderClick)="refreshDirectyory($event)" currentFolderPath="{{absolutePath}}">
|
||||
<content-columns>
|
||||
<content-column source="$thumbnail"></content-column>
|
||||
<content-column
|
||||
|
@@ -39,7 +39,7 @@ export class FilesComponent {
|
||||
breadcrumb: boolean = false;
|
||||
navigation: boolean = true;
|
||||
events: any[] = [];
|
||||
absolutePath: string = '';
|
||||
absolutePath: string = '/Sites/swsdp/documentLibrary';
|
||||
relativePath: string = '';
|
||||
|
||||
constructor(documentActions: DocumentActionsService) {
|
||||
@@ -63,11 +63,15 @@ export class FilesComponent {
|
||||
this.relativePath = this.getRelativeDirectory(this.absolutePath);
|
||||
}
|
||||
|
||||
refreshDocumentList(event: Object) {
|
||||
this.absolutePath += '/';
|
||||
}
|
||||
|
||||
getRelativeDirectory(currentFolderPath: string): string {
|
||||
if(currentFolderPath.indexOf('swsdp/documentLibrary/') !=-1) {
|
||||
return currentFolderPath.replace('swsdp/documentLibrary/', '')
|
||||
if(currentFolderPath.indexOf('/Sites/swsdp/documentLibrary/') !=-1) {
|
||||
return currentFolderPath.replace('/Sites/swsdp/documentLibrary/', '')
|
||||
} else {
|
||||
return currentFolderPath.replace('swsdp/documentLibrary', '')
|
||||
return currentFolderPath.replace('/Sites/swsdp/documentLibrary', '')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -41,6 +41,8 @@ declare let __moduleName: string;
|
||||
})
|
||||
export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit {
|
||||
|
||||
const DEFAULT_ROOT_FOLDER: string = "/Sites/swsdp/documentLibrary";
|
||||
|
||||
@Input()
|
||||
navigate: boolean = true;
|
||||
|
||||
@@ -57,10 +59,13 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
|
||||
folderClick: EventEmitter<any> = 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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user