refactor(router): code style changes

This commit is contained in:
nixa 2016-07-07 16:30:00 +03:00
parent f24546639c
commit 24de0070fa
15 changed files with 80 additions and 59 deletions

View file

@ -1,4 +1,4 @@
import "./app.loader.ts"; import './app.loader.ts';
import {Component, ViewEncapsulation} from "@angular/core"; import {Component, ViewEncapsulation} from "@angular/core";
import {AppState} from "./app.state"; import {AppState} from "./app.state";
import {BaThemeConfigProvider, BaThemeConfig} from "./theme"; import {BaThemeConfigProvider, BaThemeConfig} from "./theme";

View file

@ -2,15 +2,29 @@ export const menuItems = [
{ {
title: 'Dashboard', title: 'Dashboard',
path: '/pages/dashboard', path: '/pages/dashboard',
icon: 'fa fa-home', icon: 'ion-android-home',
selected: false, selected: false,
expanded: false, expanded: false,
order: 0 order: 0
}, },
{
title: 'Editors',
path: '/pages/editors',
icon: 'ion-edit',
selected: false,
expanded: false,
order: 100,
subMenu: [
{
title: 'CKEditor',
path: '/ckeditor',
}
]
},
{ {
title: 'Charts', title: 'Charts',
path: '/pages/charts', path: '/pages/charts',
icon: 'fa fa-bar-chart', icon: 'ion-stats-bars',
selected: false, selected: false,
expanded: false, expanded: false,
order: 200, order: 200,
@ -24,7 +38,7 @@ export const menuItems = [
{ {
title: 'UI Features', title: 'UI Features',
path: '/pages/ui', path: '/pages/ui',
icon: 'fa fa-laptop', icon: 'ion-android-laptop',
selected: false, selected: false,
expanded: false, expanded: false,
order: 300, order: 300,
@ -50,7 +64,7 @@ export const menuItems = [
{ {
title: 'Form Elements', title: 'Form Elements',
path: '/pages/forms', path: '/pages/forms',
icon: 'fa fa-pencil-square-o', icon: 'ion-compose',
selected: false, selected: false,
expanded: false, expanded: false,
order: 400, order: 400,
@ -68,7 +82,7 @@ export const menuItems = [
{ {
title: 'Tables', title: 'Tables',
path: '/pages/tables', path: '/pages/tables',
icon: 'fa fa-table', icon: 'ion-grid',
selected: false, selected: false,
expanded: false, expanded: false,
order: 500, order: 500,
@ -82,7 +96,7 @@ export const menuItems = [
{ {
title: 'Maps', title: 'Maps',
path: '/pages/maps', path: '/pages/maps',
icon: 'fa fa-map-marker', icon: 'ion-ios-location-outline',
selected: false, selected: false,
expanded: false, expanded: false,
order: 600, order: 600,
@ -107,7 +121,7 @@ export const menuItems = [
}, },
{ {
title: 'Pages', title: 'Pages',
icon: 'fa fa-sticky-note', icon: 'ion-document',
selected: false, selected: false,
expanded: false, expanded: false,
order: 650, order: 650,
@ -124,7 +138,7 @@ export const menuItems = [
}, },
{ {
title: 'Menu Level 1', title: 'Menu Level 1',
icon: 'fa fa-level-down', icon: 'ion-ios-more',
selected: false, selected: false,
expanded: false, expanded: false,
order: 700, order: 700,

View file

@ -1,7 +1,7 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {RouteConfig} from '@angular/router-deprecated'; import {RouteConfig} from '@angular/router-deprecated';
import {Ckeditor} from "./components/ckeditor"; import {Ckeditor} from './components/ckeditor';
@Component({ @Component({
selector: 'editors', selector: 'editors',

View file

@ -1,4 +1,4 @@
import {Component} from "@angular/core"; import {Component} from '@angular/core';
@Component({ @Component({
selector: 'forms', selector: 'forms',

View file

@ -1,7 +1,7 @@
<div class="auth-main"> <div class="auth-main">
<div class="auth-block"> <div class="auth-block">
<h1>Sign in to ng2-admin</h1> <h1>Sign in to ng2-admin</h1>
<a [routerLink]="['Register']" class="auth-link">New to ng2-admin? Sign up!</a> <a [routerLink]="['/register']" class="auth-link">New to ng2-admin? Sign up!</a>
<form [ngFormModel]="form" (ngSubmit)="onSubmit(form.value)" class="form-horizontal"> <form [ngFormModel]="form" (ngSubmit)="onSubmit(form.value)" class="form-horizontal">
<div class="form-group row" [ngClass]="{'has-error': (!email.valid && email.touched), 'has-success': (email.valid && email.touched)}"> <div class="form-group row" [ngClass]="{'has-error': (!email.valid && email.touched), 'has-success': (email.valid && email.touched)}">

View file

@ -1,5 +1,5 @@
import {RouterConfig} from "@angular/router"; import {RouterConfig} from '@angular/router';
import {Login} from "./login.component"; import {Login} from './login.component';
export const LoginRoutes: RouterConfig = [ export const LoginRoutes: RouterConfig = [
{ {

View file

@ -1,4 +1,4 @@
import {Component} from "@angular/core"; import {Component} from '@angular/core';
@Component({ @Component({
selector: 'maps', selector: 'maps',

View file

@ -1,25 +1,25 @@
import {RouterConfig} from '@angular/router'; import {RouterConfig} from '@angular/router';
import {Dashboard} from "./dashboard/dashboard.component"; import {Dashboard} from './dashboard/dashboard.component';
import {Charts} from "./charts/charts.component"; import {Charts} from './charts/charts.component';
import {ChartistJs} from "./charts/components/chartistJs/chartistJs.component"; import {ChartistJs} from './charts/components/chartistJs/chartistJs.component';
import {Pages} from "./pages.component"; import {Pages} from './pages.component';
import {Ui} from "./ui/ui.component"; import {Ui} from './ui/ui.component';
import {Typography} from "./ui/components/typography/typography.component"; import {Typography} from './ui/components/typography/typography.component';
import {Buttons} from "./ui/components/buttons/buttons.component"; import {Buttons} from './ui/components/buttons/buttons.component';
import {Icons} from "./ui/components/incons/icons.component"; import {Icons} from './ui/components/incons/icons.component';
import {Grid} from "./ui/components/grid/grid.component"; import {Grid} from './ui/components/grid/grid.component';
import {Forms} from "./forms/forms.component"; import {Forms} from './forms/forms.component';
import {Inputs} from "./forms/components/inputs/inputs.component"; import {Inputs} from './forms/components/inputs/inputs.component';
import {Layouts} from "./forms/components/layouts/layouts.component"; import {Layouts} from './forms/components/layouts/layouts.component';
import {BasicTables} from "./tables/components/basicTables/basicTables.component"; import {BasicTables} from './tables/components/basicTables/basicTables.component';
import {Tables} from "./tables/tables.component"; import {Tables} from './tables/tables.component';
import {Maps} from "./maps/maps.component"; import {Maps} from './maps/maps.component';
import {GoogleMaps} from "./maps/components/googleMaps/googleMaps.component"; import {GoogleMaps} from './maps/components/googleMaps/googleMaps.component';
import {LeafletMaps} from "./maps/components/leafletMaps/leafletMaps.component"; import {LeafletMaps} from './maps/components/leafletMaps/leafletMaps.component';
import {BubbleMaps} from "./maps/components/bubbleMaps/bubbleMaps.component"; import {BubbleMaps} from './maps/components/bubbleMaps/bubbleMaps.component';
import {LineMaps} from "./maps/components/lineMaps/lineMaps.component"; import {LineMaps} from './maps/components/lineMaps/lineMaps.component';
import {Login} from "./login/login.component"; import {Editors} from './editors/editors.component';
import {Register} from "./register/register.component"; import {Ckeditor} from './editors/components/ckeditor/ckeditor.component';
//noinspection TypeScriptValidateTypes //noinspection TypeScriptValidateTypes
export const PagesRoutes:RouterConfig = [ export const PagesRoutes:RouterConfig = [
@ -31,6 +31,16 @@ export const PagesRoutes:RouterConfig = [
path: 'dashboard', path: 'dashboard',
component: Dashboard component: Dashboard
}, },
{
path: 'editors',
component: Editors,
children: [
{
path: 'ckeditor',
component: Ckeditor
}
]
},
{ {
path: 'charts', path: 'charts',
component: Charts, component: Charts,

View file

@ -1,7 +1,7 @@
<div class="auth-main"> <div class="auth-main">
<div class="auth-block"> <div class="auth-block">
<h1>Sign up to ng2-admin</h1> <h1>Sign up to ng2-admin</h1>
<a [routerLink]="['Login']" class="auth-link">Already have an ng2-admin account? Sign in!</a> <a [routerLink]="['/login']" class="auth-link">Already have an ng2-admin account? Sign in!</a>
<form [ngFormModel]="form" (ngSubmit)="onSubmit(form.value)" class="form-horizontal"> <form [ngFormModel]="form" (ngSubmit)="onSubmit(form.value)" class="form-horizontal">
<div class="form-group row" [ngClass]="{'has-error': (!name.valid && name.touched), 'has-success': (name.valid && name.touched)}"> <div class="form-group row" [ngClass]="{'has-error': (!name.valid && name.touched), 'has-success': (name.valid && name.touched)}">

View file

@ -1,5 +1,5 @@
import {RouterConfig} from "@angular/router"; import {RouterConfig} from '@angular/router';
import {Register} from "./register.component"; import {Register} from './register.component';
export const RegisterRoutes: RouterConfig = [ export const RegisterRoutes: RouterConfig = [
{ {

View file

@ -1,4 +1,4 @@
import {Component} from "@angular/core"; import {Component} from '@angular/core';
@Component({ @Component({
selector: 'forms', selector: 'forms',

View file

@ -1,4 +1,4 @@
import {Component} from "@angular/core"; import {Component} from '@angular/core';
@Component({ @Component({
selector: 'ui', selector: 'ui',

View file

@ -1,9 +1,9 @@
import {Component, ElementRef, HostListener, ViewEncapsulation} from "@angular/core"; import {Component, ElementRef, HostListener, ViewEncapsulation} from '@angular/core';
import {Router} from "@angular/router"; import {Router} from '@angular/router';
import {AppState} from "../../../app.state"; import {AppState} from '../../../app.state';
import {layoutSizes} from "../../../theme"; import {layoutSizes} from '../../../theme';
import {BaSlimScroll} from "../../../theme/directives"; import {BaSlimScroll} from '../../../theme/directives';
import {BaSidebarService} from "./baSidebar.service"; import {BaSidebarService} from './baSidebar.service';
@Component({ @Component({
selector: 'ba-sidebar', selector: 'ba-sidebar',

View file

@ -45,21 +45,18 @@ export class BaSidebarService {
} }
private _isCurrent(route:UrlTree):boolean { private _isCurrent(route:UrlTree):boolean {
if (!route) if (route) {
return false; return this._router.url === this._router.serializeUrl(route);
}
return this._router.url === this._router.serializeUrl(route); return false;
} }
private _generateRoute(instructions:any[]):UrlTree { private _generateRoute(instructions:any[]):UrlTree {
if (!instructions)
return null;
instructions = instructions.filter(item => !!item); instructions = instructions.filter(item => !!item);
if (instructions.length === 0) if (instructions.length != 0) {
return null; return this._router.createUrlTree(instructions);
}
return this._router.createUrlTree(instructions); return null;
} }
} }

View file

@ -7,7 +7,7 @@ import {FORM_PROVIDERS, LocationStrategy, HashLocationStrategy} from '@angular/c
// Angular 2 Http // Angular 2 Http
import {HTTP_PROVIDERS} from '@angular/http'; import {HTTP_PROVIDERS} from '@angular/http';
import {APP_ROUTER_PROVIDERS} from "../../app/app.routes"; import {APP_ROUTER_PROVIDERS} from '../../app/app.routes';
/* /*