update code as per code review

- upgrade demo project
- extend readme
- remove commented out unit tests
This commit is contained in:
Denys Vuika
2017-01-04 14:20:15 +00:00
parent 7ecf9f2fc3
commit fefe4b6963
5 changed files with 18 additions and 72 deletions

View File

@@ -168,6 +168,7 @@ platformBrowserDynamic().bootstrapModule(AppModule);
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `currentFolderId` | string | null | Initial node ID of displayed folder. Can be `-root-`, `-shared-`, `-my-`, or a fixed node ID |
| `folderNode` | `MinimalNodeEntryEntity` | null | Currently displayed folder node |
| `navigate` | boolean | true | Toggles navigation to folder content or file preview |
| `navigationMode` | string (click\|dblclick) | dblclick | User interaction for folder navigation or file preview |
| `thumbnails` | boolean | false | Show document thumbnails rather than icons |

View File

@@ -37,7 +37,10 @@
"alfresco-js-api": "^1.0.0",
"ng2-alfresco-core": "1.0.0",
"ng2-alfresco-datatable": "1.0.0",
"ng2-alfresco-documentlist": "^1.0.0"
"ng2-alfresco-documentlist": "^1.0.0",
"material-design-icons": "2.2.3",
"material-design-lite": "1.2.1",
"intl": "^1.2.5"
},
"devDependencies": {
"@types/jasmine": "^2.2.33",

View File

@@ -19,13 +19,7 @@ import { NgModule, Component, OnInit, ViewChild } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { DocumentListModule, DocumentList, DocumentActionsService } from 'ng2-alfresco-documentlist';
import {
CoreModule,
StorageService,
AlfrescoSettingsService,
AlfrescoAuthenticationService,
AlfrescoTranslationService
} from 'ng2-alfresco-core';
import { CoreModule, StorageService, SettingsService, AuthService, AlfrescoTranslateService } from 'ng2-alfresco-core';
@Component({
selector: 'alfresco-app-demo',
@@ -39,24 +33,16 @@ import {
operations.
</div>
<hr>
<alfresco-document-list-breadcrumb
[currentFolderPath]="currentPath"
[target]="documentList">
<alfresco-document-list-breadcrumb
[target]="documentList"
[folderNode]="documentList.folderNode">
</alfresco-document-list-breadcrumb>
<alfresco-document-list
#documentList
[currentFolderPath]="currentPath"
[currentFolderId]="currentFolderId"
[contextMenuActions]="true"
[contentActions]="true"
[creationMenuActions]="true"
(folderChange)="onFolderChanged($event)">
<!--
<empty-folder-content>
<template>
<h1>Sorry, no content here</h1>
</template>
</empty-folder-content>
-->
[creationMenuActions]="true">
<content-columns>
<content-column key="$thumbnail" type="image"></content-column>
<content-column
@@ -65,12 +51,6 @@ import {
sortable="true"
class="full-width ellipsis-cell">
</content-column>
<!--
<content-column
title="Type"
source="content.mimeType">
</content-column>
-->
<content-column
title="{{'DOCUMENT_LIST.COLUMNS.CREATED_BY' | translate}}"
key="createdByUser.displayName"
@@ -138,20 +118,18 @@ import {
})
class DocumentListDemo implements OnInit {
currentPath: string = '/';
// The identifier of a node. You can also use one of these well-known aliases: -my- | -shared- | -root-
currentFolderId: string = '-my-';
authenticated: boolean = false;
ecmHost: string = 'http://localhost:8080';
ticket: string;
@ViewChild(DocumentList)
documentList: DocumentList;
constructor(private authService: AlfrescoAuthenticationService,
private settingsService: AlfrescoSettingsService,
private translation: AlfrescoTranslationService,
constructor(private authService: AuthService,
private settingsService: SettingsService,
private translateService: AlfrescoTranslateService,
private documentActions: DocumentActionsService,
private storage: StorageService) {
@@ -162,7 +140,7 @@ class DocumentListDemo implements OnInit {
this.ticket = this.authService.getTicketEcm();
}
translation.addTranslationFolder();
translateService.addTranslationFolder();
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
}
@@ -206,12 +184,6 @@ class DocumentListDemo implements OnInit {
this.authenticated = false;
});
}
onFolderChanged(event?: any) {
if (event) {
this.currentPath = event.path;
}
}
}
@NgModule({

View File

@@ -10,8 +10,7 @@
"class-name": true,
"comment-format": [
true,
"check-space",
"check-lowercase"
"check-space"
],
"curly": true,
"eofline": true,

View File

@@ -189,35 +189,6 @@ describe('DocumentList', () => {
expect(documentList.loadFolder).not.toHaveBeenCalled();
});
/*
it('should emit folder changed event', (done) => {
spyOn(documentList, 'loadFolderByPath').and.returnValue(Promise.resolve());
documentList.folderChange.subscribe(e => {
done();
});
let newPath = '/some/new/path';
documentList.currentFolderPath = newPath;
documentList.ngOnChanges({currentFolderPath: new SimpleChange(null, newPath)});
});
*/
/*
it('should emit folder changed event with folder details', (done) => {
spyOn(documentList, 'loadFolderByPath').and.returnValue(Promise.resolve());
let path = '/path';
documentList.folderChange.subscribe(e => {
expect(e.path).toBe(path);
done();
});
documentList.currentFolderPath = path;
documentList.ngOnChanges({currentFolderPath: new SimpleChange(null, path)});
});
*/
it('should execute context action on callback', () => {
let action = {
node: {},