2016-04-21 20:34:07 +03:00
|
|
|
import {Component, ViewEncapsulation} from 'angular2/core';
|
|
|
|
|
import {RouteConfig, Router} from 'angular2/router';
|
|
|
|
|
|
|
|
|
|
import {Dashboard} from './dashboard';
|
2016-04-29 20:07:25 +03:00
|
|
|
import {Ui} from './ui';
|
2016-04-27 13:17:51 +03:00
|
|
|
import {PageTop, Sidebar} from '../theme';
|
2016-04-21 20:34:07 +03:00
|
|
|
|
|
|
|
|
@Component({
|
2016-04-29 17:08:05 +03:00
|
|
|
selector: 'pages',
|
|
|
|
|
encapsulation: ViewEncapsulation.None,
|
|
|
|
|
styles: [],
|
|
|
|
|
directives: [PageTop, Sidebar],
|
|
|
|
|
template: `<sidebar [routes]="getRoutes()"></sidebar><page-top></page-top><router-outlet></router-outlet>`
|
2016-04-21 20:34:07 +03:00
|
|
|
})
|
|
|
|
|
@RouteConfig([
|
2016-04-29 17:08:05 +03:00
|
|
|
{
|
|
|
|
|
name: 'Dashboard',
|
|
|
|
|
component: Dashboard,
|
2016-04-29 20:07:25 +03:00
|
|
|
path: '/dashboard',
|
2016-04-29 17:08:05 +03:00
|
|
|
useAsDefault: true,
|
|
|
|
|
data: {
|
|
|
|
|
title: 'Dashboard',
|
2016-04-29 20:07:25 +03:00
|
|
|
selected: false,
|
|
|
|
|
expanded: false,
|
2016-04-29 17:08:05 +03:00
|
|
|
sidebarMeta: {
|
|
|
|
|
icon: 'ion-android-home',
|
|
|
|
|
order: 0,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2016-04-29 20:07:25 +03:00
|
|
|
{
|
|
|
|
|
name: 'Ui',
|
|
|
|
|
component: Ui,
|
|
|
|
|
path: '/ui/...',
|
|
|
|
|
data: {
|
|
|
|
|
title: 'UI Features',
|
|
|
|
|
selected: false,
|
|
|
|
|
expanded: false,
|
|
|
|
|
sidebarMeta: {
|
|
|
|
|
icon: 'ion-android-laptop',
|
|
|
|
|
order: 200,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2016-04-21 20:34:07 +03:00
|
|
|
])
|
|
|
|
|
export class Pages {
|
|
|
|
|
|
2016-04-29 17:08:05 +03:00
|
|
|
private _routeConfig;
|
|
|
|
|
|
2016-04-29 17:27:19 +03:00
|
|
|
constructor(private _router:Router) {
|
|
|
|
|
}
|
2016-04-29 17:08:05 +03:00
|
|
|
|
2016-04-29 17:27:19 +03:00
|
|
|
ngOnInit() {
|
|
|
|
|
}
|
2016-04-29 17:08:05 +03:00
|
|
|
|
|
|
|
|
getRoutes() {
|
|
|
|
|
|
|
|
|
|
if (!this._routeConfig) {
|
|
|
|
|
this._routeConfig = Reflect.getMetadata('annotations', this.constructor)
|
|
|
|
|
.filter(a => {
|
|
|
|
|
return a.constructor.name === 'RouteConfig';
|
|
|
|
|
})
|
|
|
|
|
.pop();
|
2016-04-21 20:34:07 +03:00
|
|
|
}
|
|
|
|
|
|
2016-04-29 17:08:05 +03:00
|
|
|
return this._routeConfig;
|
|
|
|
|
}
|
2016-04-27 13:17:51 +03:00
|
|
|
}
|