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 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `currentFolderId` | string | null | Initial node ID of displayed folder. Can be `-root-`, `-shared-`, `-my-`, or a fixed node ID | | `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 | | `navigate` | boolean | true | Toggles navigation to folder content or file preview |
| `navigationMode` | string (click\|dblclick) | dblclick | User interaction for folder navigation 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 | | `thumbnails` | boolean | false | Show document thumbnails rather than icons |

View File

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

View File

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

View File

@@ -189,35 +189,6 @@ describe('DocumentList', () => {
expect(documentList.loadFolder).not.toHaveBeenCalled(); 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', () => { it('should execute context action on callback', () => {
let action = { let action = {
node: {}, node: {},