diff --git a/ng2-components/ng2-alfresco-search/demo/index.html b/ng2-components/ng2-alfresco-search/demo/index.html index a4180c26a3..d7fe291524 100644 --- a/ng2-components/ng2-alfresco-search/demo/index.html +++ b/ng2-components/ng2-alfresco-search/demo/index.html @@ -10,9 +10,21 @@ - + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-tag/README.md b/ng2-components/ng2-alfresco-tag/README.md index a7519e00ea..944a1721a6 100644 --- a/ng2-components/ng2-alfresco-tag/README.md +++ b/ng2-components/ng2-alfresco-tag/README.md @@ -31,52 +31,64 @@

-### Node -To correctly use this component check that on your machine is running Node version 5.0.0 or higher. +## Prerequisites + +Before you start using this development framework, make sure you have installed all required software and done all the +necessary configuration [prerequisites](https://github.com/Alfresco/alfresco-ng2-components/blob/master/PREREQUISITES.md). ## Install -```sh -npm install --save ng2-alfresco-tag -``` +Follow the 3 steps below: -Components included: +1. Npm -* Alfresco Tag Component + ```sh + npm install ng2-alfresco-tag --save + ``` -#### Dependencies +2. Html -Add the following dependency to your index.html: + Include these dependencies in your index.html page: -```html - -``` + ```html -The following component needs to be added to your systemjs.config: + + + + -- ng2-translate -- ng2-alfresco-core + + + -Please refer to the following example to have an idea of how your systemjs.config should look like : + + + + -https://github.com/Alfresco/alfresco-ng2-components/blob/master/ng2-components/ng2-alfresco-tag/demo/systemjs.config.js + + + + -#### Style -The style of this component is based on material design, so if you want to visualize it correctly you have to add the material -design dependency to your project: + + + + -```sh -npm install --save material-design-icons material-design-lite -``` + ``` -Also make sure you include these dependencies in your .html page: +3. SystemJs -```html - - - - -``` + Add the following components to your systemjs.config.js file: + + - ng2-translate + - alfresco-js-api + - ng2-alfresco-core + - ng2-alfresco-tag + + Please refer to the following example file: [systemjs.config.js](demo/systemjs + .config.js) . #### Basic usage @@ -93,70 +105,45 @@ In this component are present three different tags : ``` ```ts -import { Component, OnInit, Input } from '@angular/core'; -import { bootstrap } from '@angular/platform-browser-dynamic'; -import { HTTP_PROVIDERS } from '@angular/http'; -import { - ALFRESCO_CORE_PROVIDERS, - AlfrescoSettingsService, - AlfrescoAuthenticationService -} from 'ng2-alfresco-core'; -import { TAGCOMPONENT, TAGSERVICES } from 'ng2-alfresco-tag'; +import { NgModule, Component, Input } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { CoreModule, AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core'; +import { TagModule } from 'ng2-alfresco-tag'; @Component({ - selector: 'alfresco-tag-demo', - template: ` -
- -
- `, - directives: [TAGCOMPONENT], - providers: [TAGSERVICES] + selector: 'alfresco-app-demo', + template: ` + ` }) -class TagDemo implements OnInit { +class TagDemo { - @Input() - nodeId: string = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d'; + constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) { + settingsService.ecmHost = 'http://localhost:8080'; - authenticated: boolean; - - ecmHost: string = 'http://127.0.0.1:8080'; - - ticket: string; - - constructor(private authService: AlfrescoAuthenticationService, - private settingsService: AlfrescoSettingsService) { - settingsService.ecmHost = this.ecmHost; - settingsService.setProviders('ECM'); - } - - ngOnInit() { - this.login(); - } - - login() { this.authService.login('admin', 'admin').subscribe( ticket => { - this.authenticated = true; + console.log(ticket); }, error => { - this.authenticated = false; + console.log(error); }); } - - public updateHost(): void { - this.settingsService.ecmHost = this.ecmHost; - this.login(); - } - - logData(data) { - console.log(data); - } } -bootstrap(TagDemo, [ - HTTP_PROVIDERS, - ALFRESCO_CORE_PROVIDERS -]); + +@NgModule({ + imports: [ + BrowserModule, + CoreModule.forRoot(), + TagModule + ], + declarations: [ TagDemo ], + bootstrap: [ TagDemo ] +}) +export class AppModule { } + +platformBrowserDynamic().bootstrapModule(AppModule); ``` ### Options @@ -174,71 +161,45 @@ Attribute | Options | Default | Description | Mandatory ``` ```ts -import { Component, OnInit, Input } from '@angular/core'; -import { bootstrap } from '@angular/platform-browser-dynamic'; -import { HTTP_PROVIDERS } from '@angular/http'; -import { - ALFRESCO_CORE_PROVIDERS, - AlfrescoSettingsService, - AlfrescoAuthenticationService -} from 'ng2-alfresco-core'; +import { NgModule, Component } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { TAGCOMPONENT, TAGSERVICES } from 'ng2-alfresco-tag'; +import { CoreModule, AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core'; +import { TagModule } from 'ng2-alfresco-tag'; @Component({ - selector: 'alfresco-tag-demo', - template: ` -
- -
- `, - directives: [TAGCOMPONENT], - providers: [TAGSERVICES] + selector: 'alfresco-app-demo', + template: ` + ` }) -class TagDemo implements OnInit { +class TagDemo { - @Input() - nodeId: string = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d'; + constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) { + settingsService.ecmHost = 'http://localhost:8080'; - authenticated: boolean; - - ecmHost: string = 'http://127.0.0.1:8080'; - - ticket: string; - - constructor(private authService: AlfrescoAuthenticationService, - private settingsService: AlfrescoSettingsService) { - settingsService.ecmHost = this.ecmHost; - settingsService.setProviders('ECM'); - } - - ngOnInit() { - this.login(); - } - - login() { this.authService.login('admin', 'admin').subscribe( ticket => { - this.authenticated = true; + console.log(ticket); }, error => { - this.authenticated = false; + console.log(error); }); } - - public updateHost(): void { - this.settingsService.ecmHost = this.ecmHost; - this.login(); - } - - logData(data) { - console.log(data); - } } -bootstrap(TagDemo, [ - HTTP_PROVIDERS, - ALFRESCO_CORE_PROVIDERS -]); + +@NgModule({ + imports: [ + BrowserModule, + CoreModule.forRoot(), + TagModule + ], + declarations: [ TagDemo ], + bootstrap: [ TagDemo ] +}) +export class AppModule { } + +platformBrowserDynamic().bootstrapModule(AppModule); ``` ### Options @@ -256,102 +217,81 @@ Attribute | Options | Default | Description | Mandatory ``` ```ts -import { Component, OnInit, Input } from '@angular/core'; -import { bootstrap } from '@angular/platform-browser-dynamic'; -import { HTTP_PROVIDERS } from '@angular/http'; -import { - ALFRESCO_CORE_PROVIDERS, - AlfrescoSettingsService, - AlfrescoAuthenticationService -} from 'ng2-alfresco-core'; +import { NgModule, Component } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { TAGCOMPONENT, TAGSERVICES } from 'ng2-alfresco-tag'; +import { CoreModule, AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core'; +import { TagModule } from 'ng2-alfresco-tag'; @Component({ - selector: 'alfresco-tag-demo', - template: ` -
- -
- `, - directives: [TAGCOMPONENT], - providers: [TAGSERVICES] + selector: 'alfresco-app-demo', + template: `` }) -class TagDemo implements OnInit { +class TagDemo { - authenticated: boolean; + constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) { + settingsService.ecmHost = 'http://localhost:8080'; - ecmHost: string = 'http://127.0.0.1:8080'; - - constructor(private authService: AlfrescoAuthenticationService, - private settingsService: AlfrescoSettingsService) { - settingsService.ecmHost = this.ecmHost; - settingsService.setProviders('ECM'); - } - - ngOnInit() { - this.login(); - } - - login() { this.authService.login('admin', 'admin').subscribe( ticket => { - this.authenticated = true; + console.log(ticket); }, error => { - this.authenticated = false; + console.log(error); }); } - - public updateHost(): void { - this.settingsService.ecmHost = this.ecmHost; - this.login(); - } - - logData(data) { - console.log(data); - } } -bootstrap(TagDemo, [ - HTTP_PROVIDERS, - ALFRESCO_CORE_PROVIDERS -]); + +@NgModule({ + imports: [ + BrowserModule, + CoreModule.forRoot(), + TagModule + ], + declarations: [ TagDemo ], + bootstrap: [ TagDemo ] +}) +export class AppModule { } + +platformBrowserDynamic().bootstrapModule(AppModule); ``` ![Custom columns](docs/assets/tag2.png) ## Build from sources + Alternatively you can build component from sources with the following commands: - - + + ```sh npm install npm run build ``` -##Build the files and keep watching for changes +### Build the files and keep watching for changes ```sh -npm run build:w +$ npm run build:w ``` - + ## Running unit tests ```sh npm test ``` -## Running unit tests in browser +### Running unit tests in browser ```sh npm test-browser ``` -This task rebuilds all the code, runs tslint, license checks and other quality check tools -before performing unit testing. +This task rebuilds all the code, runs tslint, license checks and other quality check tools +before performing unit testing. -## Code coverage +### Code coverage ```sh npm run coverage @@ -367,3 +307,6 @@ npm install npm start ``` +## License + +[Apache Version 2.0](https://github.com/Alfresco/alfresco-ng2-components/blob/master/LICENSE) diff --git a/ng2-components/ng2-alfresco-tag/demo/index.html b/ng2-components/ng2-alfresco-tag/demo/index.html index 0d4cf98d82..c32e19e790 100644 --- a/ng2-components/ng2-alfresco-tag/demo/index.html +++ b/ng2-components/ng2-alfresco-tag/demo/index.html @@ -11,10 +11,21 @@ - + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-tag/demo/package.json b/ng2-components/ng2-alfresco-tag/demo/package.json index b0d28b7a37..505bbcbd37 100644 --- a/ng2-components/ng2-alfresco-tag/demo/package.json +++ b/ng2-components/ng2-alfresco-tag/demo/package.json @@ -7,38 +7,15 @@ "scripts": { "clean": "npm install rimraf && rimraf dist node_modules typings dist", "postinstall": "npm run build", - "start": "concurrently \"npm run build:w\" \"npm run server\" ", + "start": "npm run build && concurrently \"npm run tsc:w\" \"npm run server\" ", "server": "wsrv -o -s -l", - "build": "npm run tslint && rimraf dist && tsc", - "build:w": "npm run tslint && rimraf dist && tsc -w", - "tslint": "npm run tslint-src && npm run tslint-root", - "tslint-src": "tslint -c tslint.json 'src/{,**/}**.ts'", - "tslint-root": "tslint -c tslint.json *.ts" + "build": "npm run tslint && rimraf dist && npm run tsc", + "tsc": "tsc", + "tsc:w": "tsc -w", + "tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json src/{,**/}**.ts" }, "license": "Apache-2.0", "dependencies": { - "@angular/common": "2.0.0", - "@angular/compiler": "2.0.0", - "@angular/core": "2.0.0", - "@angular/forms": "2.0.0", - "@angular/http": "2.0.0", - "@angular/platform-browser": "2.0.0", - "@angular/platform-browser-dynamic": "2.0.0", - "@angular/router": "3.0.0", - "@angular/upgrade": "2.0.0", - "@types/node": "^6.0.42", - "core-js": "^2.4.1", - "reflect-metadata": "^0.1.3", - "rxjs": "5.0.0-beta.12", - "systemjs": "0.19.27", - "zone.js": "^0.6.23", - - "material-design-icons": "2.2.3", - "material-design-lite": "1.2.1", - "ng2-translate": "2.5.0", - - "alfresco-js-api": "^0.3.0", - "ng2-alfresco-core": "^0.3.0", "ng2-alfresco-tag": "0.3.2" }, "devDependencies": { diff --git a/ng2-components/ng2-alfresco-tag/package.json b/ng2-components/ng2-alfresco-tag/package.json index 2ce0aa24be..0ebc54cebf 100644 --- a/ng2-components/ng2-alfresco-tag/package.json +++ b/ng2-components/ng2-alfresco-tag/package.json @@ -31,24 +31,7 @@ "url": "https://github.com/Alfresco/alfresco-ng2-components/issues" }, "dependencies": { - "@angular/common": "2.0.0", - "@angular/compiler": "2.0.0", - "@angular/core": "2.0.0", - "@angular/forms": "2.0.0", - "@angular/http": "2.0.0", - "@angular/platform-browser": "2.0.0", - "@angular/platform-browser-dynamic": "2.0.0", - "@angular/router": "3.0.0", - "@angular/upgrade": "2.0.0", - "@types/node": "^6.0.42", - "alfresco-js-api": "^0.3.0", - "core-js": "^2.4.1", - "ng2-alfresco-core": "0.3.2", - "ng2-translate": "2.5.0", - "reflect-metadata": "^0.1.3", - "rxjs": "5.0.0-beta.12", - "systemjs": "0.19.27", - "zone.js": "^0.6.23" + "ng2-alfresco-core": "0.3.2" }, "devDependencies": { "@types/core-js": "^0.9.32", diff --git a/ng2-components/ng2-alfresco-upload/demo/index.html b/ng2-components/ng2-alfresco-upload/demo/index.html index 9637c2b781..d788c42269 100644 --- a/ng2-components/ng2-alfresco-upload/demo/index.html +++ b/ng2-components/ng2-alfresco-upload/demo/index.html @@ -8,14 +8,25 @@ - + - + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-userinfo/demo/index.html b/ng2-components/ng2-alfresco-userinfo/demo/index.html index 6d0b272ba6..837414bba8 100644 --- a/ng2-components/ng2-alfresco-userinfo/demo/index.html +++ b/ng2-components/ng2-alfresco-userinfo/demo/index.html @@ -8,12 +8,22 @@ - - - + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-viewer/demo/index.html b/ng2-components/ng2-alfresco-viewer/demo/index.html index 322b3edc35..86aea902df 100644 --- a/ng2-components/ng2-alfresco-viewer/demo/index.html +++ b/ng2-components/ng2-alfresco-viewer/demo/index.html @@ -10,14 +10,28 @@ - + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-webscript/demo/index.html b/ng2-components/ng2-alfresco-webscript/demo/index.html index 90435737db..e274c4debe 100644 --- a/ng2-components/ng2-alfresco-webscript/demo/index.html +++ b/ng2-components/ng2-alfresco-webscript/demo/index.html @@ -11,17 +11,25 @@ - + + + + + + + + + + + + - - -