mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
clean demo project
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import {Component} from 'angular2/core';
|
||||
import {DocumentList} from 'ng2-alfresco-documentlist/ng2-alfresco-documentlist';
|
||||
import {MDL} from './MaterialDesignLiteUpgradeElement';
|
||||
import {MDL} from '../common/MaterialDesignLiteUpgradeElement';
|
||||
|
||||
@Component({
|
||||
selector: 'home-view',
|
||||
selector: 'files-component',
|
||||
template: `
|
||||
<div class="container-fluid p-10">
|
||||
<div class="row">
|
||||
@@ -42,7 +42,7 @@ import {MDL} from './MaterialDesignLiteUpgradeElement';
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<alfresco-document-list #list
|
||||
<alfresco-document-list #list
|
||||
[thumbnails]="thumbnails"
|
||||
[breadcrumb]="breadcrumb"
|
||||
[navigate]="navigation"
|
||||
@@ -55,7 +55,7 @@ import {MDL} from './MaterialDesignLiteUpgradeElement';
|
||||
`,
|
||||
directives: [DocumentList, MDL]
|
||||
})
|
||||
export class HomeView {
|
||||
export class FilesComponent {
|
||||
thumbnails: boolean = true;
|
||||
breadcrumb: boolean = false;
|
||||
navigation: boolean = true;
|
@@ -5,13 +5,13 @@ import {Authentication} from '../../services/authentication';
|
||||
declare let componentHandler;
|
||||
|
||||
@Component({
|
||||
selector: 'login',
|
||||
selector: 'login-component',
|
||||
moduleId: 'app/components/login/login',
|
||||
directives: [ROUTER_DIRECTIVES, FORM_DIRECTIVES],
|
||||
templateUrl: 'login.component.html',
|
||||
styleUrls: ['login.component.css'],
|
||||
})
|
||||
export class Login {
|
||||
export class LoginComponent {
|
||||
form:ControlGroup;
|
||||
error:boolean = false;
|
||||
|
@@ -1,93 +0,0 @@
|
||||
import {Component, NgZone} from 'angular2/core';
|
||||
import {UPLOAD_DIRECTIVES} from 'ng2-uploader/ng2-uploader';
|
||||
|
||||
@Component({
|
||||
selector: 'page1-view',
|
||||
styles: [
|
||||
`
|
||||
:host .dropzone {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
background-color: #f5f5f5;
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
|
||||
text-align: center;
|
||||
}
|
||||
`
|
||||
],
|
||||
template: `
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<h2>Upload File</h2>
|
||||
<input type="file"
|
||||
[ng-file-select]="options"
|
||||
(onUpload)="handleUpload($event)">
|
||||
<div>
|
||||
Response: {{ uploadFile | json }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<h2>Drag and Drop file demo</h2>
|
||||
<div class="col-md-4 col-md-offset-3">
|
||||
<div [ng-file-drop]="options" (onUpload)="handleDropUpload($event)" class="dropzone">
|
||||
Drop file here...
|
||||
</div>
|
||||
<div class="progress">
|
||||
<div class="progress-bar" [style.width]="dropProgress + '%'"></div>
|
||||
<span class="percent">{{ dropProgress }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
directives: [UPLOAD_DIRECTIVES]
|
||||
})
|
||||
export class Page1View {
|
||||
uploadFile:any;
|
||||
options:Object = {
|
||||
url: 'http://192.168.99.100:8080/alfresco/service/api/upload',
|
||||
withCredentials: true,
|
||||
authToken: btoa('admin:admin'),
|
||||
authTokenPrefix: 'Basic',
|
||||
fieldName: 'filedata',
|
||||
formFields: {
|
||||
siteid: 'swsdp',
|
||||
containerid: 'documentLibrary'
|
||||
}
|
||||
};
|
||||
|
||||
zone:NgZone;
|
||||
dropProgress:number = 0;
|
||||
dropResp:any[] = [];
|
||||
|
||||
constructor() {
|
||||
this.zone = new NgZone({enableLongStackTrace: false});
|
||||
}
|
||||
|
||||
handleUpload(data):void {
|
||||
if (data && data.response) {
|
||||
data = JSON.parse(data.response);
|
||||
this.uploadFile = data;
|
||||
}
|
||||
}
|
||||
|
||||
handleDropUpload(data):void {
|
||||
let index = this.dropResp.findIndex(x => x.id === data.id);
|
||||
if (index === -1) {
|
||||
this.dropResp.push(data);
|
||||
} else {
|
||||
this.zone.run(() => {
|
||||
this.dropResp[index] = data;
|
||||
});
|
||||
}
|
||||
|
||||
let total = 0, uploaded = 0;
|
||||
this.dropResp.forEach(resp => {
|
||||
total += resp.progress.total;
|
||||
uploaded += resp.progress.loaded;
|
||||
});
|
||||
|
||||
this.dropProgress = Math.floor(uploaded / (total / 100));
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
import {Component} from 'angular2/core';
|
||||
import {MDL} from './MaterialDesignLiteUpgradeElement';
|
||||
|
||||
@Component({
|
||||
selector: 'page2-view',
|
||||
template: `
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<h2>Page 2</h2>
|
||||
<label mdl class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox-1">
|
||||
<input type="checkbox" id="checkbox-1" class="mdl-checkbox__input" checked>
|
||||
<span class="mdl-checkbox__label">Checkbox</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
directives: [MDL]
|
||||
})
|
||||
export class Page2View {
|
||||
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
import { ElementRef, DynamicComponentLoader, Directive, Attribute } from 'angular2/core';
|
||||
import { Router, RouterOutlet, ComponentInstruction } from 'angular2/router';
|
||||
import {Authentication} from '../services/authentication';
|
||||
import {Authentication} from '../../services/authentication';
|
||||
|
||||
@Directive({selector: 'auth-router-outlet'})
|
||||
export class AuthRouterOutlet extends RouterOutlet {
|
Reference in New Issue
Block a user