mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-30 18:15:11 +00:00
clean demo project
This commit is contained in:
parent
32722dfd95
commit
d524274d82
@ -56,9 +56,8 @@
|
||||
<div class="mdl-layout-spacer"></div>
|
||||
<!-- Navigation. We hide it in small screens. -->
|
||||
<nav class="mdl-navigation mdl-layout--large-screen-only">
|
||||
<a class="mdl-navigation__link" href="" [routerLink]="['Home']">Home</a>
|
||||
<a class="mdl-navigation__link" href="" [routerLink]="['Page1']">Uploader</a>
|
||||
<a class="mdl-navigation__link" href="" [routerLink]="['Page2']">Page 2</a>
|
||||
<a class="mdl-navigation__link" href="" [routerLink]="['Files']">Files</a>
|
||||
<a class="mdl-navigation__link" href="" [routerLink]="['Login']">Login</a>
|
||||
</nav>
|
||||
<!-- Right aligned menu below button -->
|
||||
<button id="demo-menu-lower-right"
|
||||
@ -80,9 +79,8 @@
|
||||
<div class="mdl-layout__drawer">
|
||||
<span class="mdl-layout-title">Alfresco</span>
|
||||
<nav class="mdl-navigation">
|
||||
<a class="mdl-navigation__link" href="" [routerLink]="['Home']" (click)="hideDrawer()">Home</a>
|
||||
<a class="mdl-navigation__link" href="" [routerLink]="['Page1']" (click)="hideDrawer()">Uploader</a>
|
||||
<a class="mdl-navigation__link" href="" [routerLink]="['Page2']" (click)="hideDrawer()">Page 2</a>
|
||||
<a class="mdl-navigation__link" href="" [routerLink]="['Files']" (click)="hideDrawer()">Files</a>
|
||||
<a class="mdl-navigation__link" href="" [routerLink]="['Login']" (click)="hideDrawer()">Login</a>
|
||||
</nav>
|
||||
</div>
|
||||
<main class="mdl-layout__content">
|
||||
|
@ -1,13 +1,11 @@
|
||||
import {Component} from 'angular2/core';
|
||||
import {Router, RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
|
||||
import {Login} from './components/login/login';
|
||||
import {Authentication} from './services/authentication';
|
||||
import {AuthRouterOutlet} from './components/AuthRouterOutlet';
|
||||
import {HomeView} from './components/home.view';
|
||||
import {Page1View} from './components/page1.view';
|
||||
import {Page2View} from './components/page2.view';
|
||||
import {AlfrescoService} from 'ng2-alfresco-documentlist/ng2-alfresco-documentlist';
|
||||
import {MDL} from './components/MaterialDesignLiteUpgradeElement';
|
||||
import {MDL} from './components/common/MaterialDesignLiteUpgradeElement';
|
||||
import {FilesComponent} from './components/files/files.component';
|
||||
import {LoginComponent} from './components/login/login.component';
|
||||
import {AuthRouterOutlet} from './components/router/AuthRouterOutlet';
|
||||
|
||||
declare var document: any;
|
||||
|
||||
@ -17,10 +15,8 @@ declare var document: any;
|
||||
directives: [ROUTER_DIRECTIVES, AuthRouterOutlet, MDL]
|
||||
})
|
||||
@RouteConfig([
|
||||
{path: '/', name: 'Home', component: HomeView, useAsDefault: true},
|
||||
{path: '/login', name: 'Login', component: Login},
|
||||
{path: '/page1', name: 'Page1', component: Page1View},
|
||||
{path: '/page2', name: 'Page2', component: Page2View}
|
||||
{path: '/', name: 'Files', component: FilesComponent, useAsDefault: true},
|
||||
{path: '/login', name: 'Login', component: LoginComponent}
|
||||
])
|
||||
export class AppComponent {
|
||||
|
||||
|
@ -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">
|
||||
@ -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 {
|
@ -28,9 +28,6 @@
|
||||
|
||||
<!--<script src="node_modules/ng2-uploader/bundles/ng2-uploader.js"></script>-->
|
||||
|
||||
<script src="node_modules/jquery/dist/jquery.min.js"></script>
|
||||
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
|
||||
<script src="/app/js/xml2json.js"></script>
|
||||
|
||||
<!-- 2. Configure SystemJS -->
|
||||
|
@ -11,6 +11,7 @@
|
||||
"noImplicitAny": false
|
||||
},
|
||||
"files": [
|
||||
"node_modules/angular2/typings/browser.d.ts",
|
||||
"typings/browser/ambient/jasmine/index.d.ts",
|
||||
"app/**/*.ts"
|
||||
],
|
||||
|
Loading…
x
Reference in New Issue
Block a user