mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 23:40:14 +01:00
refactor(router): code style changes
This commit is contained in:
parent
f24546639c
commit
24de0070fa
15 changed files with 80 additions and 59 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import "./app.loader.ts";
|
||||
import './app.loader.ts';
|
||||
import {Component, ViewEncapsulation} from "@angular/core";
|
||||
import {AppState} from "./app.state";
|
||||
import {BaThemeConfigProvider, BaThemeConfig} from "./theme";
|
||||
|
|
|
|||
|
|
@ -2,15 +2,29 @@ export const menuItems = [
|
|||
{
|
||||
title: 'Dashboard',
|
||||
path: '/pages/dashboard',
|
||||
icon: 'fa fa-home',
|
||||
icon: 'ion-android-home',
|
||||
selected: false,
|
||||
expanded: false,
|
||||
order: 0
|
||||
},
|
||||
{
|
||||
title: 'Editors',
|
||||
path: '/pages/editors',
|
||||
icon: 'ion-edit',
|
||||
selected: false,
|
||||
expanded: false,
|
||||
order: 100,
|
||||
subMenu: [
|
||||
{
|
||||
title: 'CKEditor',
|
||||
path: '/ckeditor',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Charts',
|
||||
path: '/pages/charts',
|
||||
icon: 'fa fa-bar-chart',
|
||||
icon: 'ion-stats-bars',
|
||||
selected: false,
|
||||
expanded: false,
|
||||
order: 200,
|
||||
|
|
@ -24,7 +38,7 @@ export const menuItems = [
|
|||
{
|
||||
title: 'UI Features',
|
||||
path: '/pages/ui',
|
||||
icon: 'fa fa-laptop',
|
||||
icon: 'ion-android-laptop',
|
||||
selected: false,
|
||||
expanded: false,
|
||||
order: 300,
|
||||
|
|
@ -50,7 +64,7 @@ export const menuItems = [
|
|||
{
|
||||
title: 'Form Elements',
|
||||
path: '/pages/forms',
|
||||
icon: 'fa fa-pencil-square-o',
|
||||
icon: 'ion-compose',
|
||||
selected: false,
|
||||
expanded: false,
|
||||
order: 400,
|
||||
|
|
@ -68,7 +82,7 @@ export const menuItems = [
|
|||
{
|
||||
title: 'Tables',
|
||||
path: '/pages/tables',
|
||||
icon: 'fa fa-table',
|
||||
icon: 'ion-grid',
|
||||
selected: false,
|
||||
expanded: false,
|
||||
order: 500,
|
||||
|
|
@ -82,7 +96,7 @@ export const menuItems = [
|
|||
{
|
||||
title: 'Maps',
|
||||
path: '/pages/maps',
|
||||
icon: 'fa fa-map-marker',
|
||||
icon: 'ion-ios-location-outline',
|
||||
selected: false,
|
||||
expanded: false,
|
||||
order: 600,
|
||||
|
|
@ -107,7 +121,7 @@ export const menuItems = [
|
|||
},
|
||||
{
|
||||
title: 'Pages',
|
||||
icon: 'fa fa-sticky-note',
|
||||
icon: 'ion-document',
|
||||
selected: false,
|
||||
expanded: false,
|
||||
order: 650,
|
||||
|
|
@ -124,7 +138,7 @@ export const menuItems = [
|
|||
},
|
||||
{
|
||||
title: 'Menu Level 1',
|
||||
icon: 'fa fa-level-down',
|
||||
icon: 'ion-ios-more',
|
||||
selected: false,
|
||||
expanded: false,
|
||||
order: 700,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {RouteConfig} from '@angular/router-deprecated';
|
||||
|
||||
import {Ckeditor} from "./components/ckeditor";
|
||||
import {Ckeditor} from './components/ckeditor';
|
||||
|
||||
@Component({
|
||||
selector: 'editors',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {Component} from "@angular/core";
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'forms',
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div class="auth-main">
|
||||
<div class="auth-block">
|
||||
<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">
|
||||
<div class="form-group row" [ngClass]="{'has-error': (!email.valid && email.touched), 'has-success': (email.valid && email.touched)}">
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import {RouterConfig} from "@angular/router";
|
||||
import {Login} from "./login.component";
|
||||
import {RouterConfig} from '@angular/router';
|
||||
import {Login} from './login.component';
|
||||
|
||||
export const LoginRoutes: RouterConfig = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {Component} from "@angular/core";
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'maps',
|
||||
|
|
|
|||
|
|
@ -1,25 +1,25 @@
|
|||
import {RouterConfig} from '@angular/router';
|
||||
import {Dashboard} from "./dashboard/dashboard.component";
|
||||
import {Charts} from "./charts/charts.component";
|
||||
import {ChartistJs} from "./charts/components/chartistJs/chartistJs.component";
|
||||
import {Pages} from "./pages.component";
|
||||
import {Ui} from "./ui/ui.component";
|
||||
import {Typography} from "./ui/components/typography/typography.component";
|
||||
import {Buttons} from "./ui/components/buttons/buttons.component";
|
||||
import {Icons} from "./ui/components/incons/icons.component";
|
||||
import {Grid} from "./ui/components/grid/grid.component";
|
||||
import {Forms} from "./forms/forms.component";
|
||||
import {Inputs} from "./forms/components/inputs/inputs.component";
|
||||
import {Layouts} from "./forms/components/layouts/layouts.component";
|
||||
import {BasicTables} from "./tables/components/basicTables/basicTables.component";
|
||||
import {Tables} from "./tables/tables.component";
|
||||
import {Maps} from "./maps/maps.component";
|
||||
import {GoogleMaps} from "./maps/components/googleMaps/googleMaps.component";
|
||||
import {LeafletMaps} from "./maps/components/leafletMaps/leafletMaps.component";
|
||||
import {BubbleMaps} from "./maps/components/bubbleMaps/bubbleMaps.component";
|
||||
import {LineMaps} from "./maps/components/lineMaps/lineMaps.component";
|
||||
import {Login} from "./login/login.component";
|
||||
import {Register} from "./register/register.component";
|
||||
import {Dashboard} from './dashboard/dashboard.component';
|
||||
import {Charts} from './charts/charts.component';
|
||||
import {ChartistJs} from './charts/components/chartistJs/chartistJs.component';
|
||||
import {Pages} from './pages.component';
|
||||
import {Ui} from './ui/ui.component';
|
||||
import {Typography} from './ui/components/typography/typography.component';
|
||||
import {Buttons} from './ui/components/buttons/buttons.component';
|
||||
import {Icons} from './ui/components/incons/icons.component';
|
||||
import {Grid} from './ui/components/grid/grid.component';
|
||||
import {Forms} from './forms/forms.component';
|
||||
import {Inputs} from './forms/components/inputs/inputs.component';
|
||||
import {Layouts} from './forms/components/layouts/layouts.component';
|
||||
import {BasicTables} from './tables/components/basicTables/basicTables.component';
|
||||
import {Tables} from './tables/tables.component';
|
||||
import {Maps} from './maps/maps.component';
|
||||
import {GoogleMaps} from './maps/components/googleMaps/googleMaps.component';
|
||||
import {LeafletMaps} from './maps/components/leafletMaps/leafletMaps.component';
|
||||
import {BubbleMaps} from './maps/components/bubbleMaps/bubbleMaps.component';
|
||||
import {LineMaps} from './maps/components/lineMaps/lineMaps.component';
|
||||
import {Editors} from './editors/editors.component';
|
||||
import {Ckeditor} from './editors/components/ckeditor/ckeditor.component';
|
||||
|
||||
//noinspection TypeScriptValidateTypes
|
||||
export const PagesRoutes:RouterConfig = [
|
||||
|
|
@ -31,6 +31,16 @@ export const PagesRoutes:RouterConfig = [
|
|||
path: 'dashboard',
|
||||
component: Dashboard
|
||||
},
|
||||
{
|
||||
path: 'editors',
|
||||
component: Editors,
|
||||
children: [
|
||||
{
|
||||
path: 'ckeditor',
|
||||
component: Ckeditor
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'charts',
|
||||
component: Charts,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div class="auth-main">
|
||||
<div class="auth-block">
|
||||
<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">
|
||||
<div class="form-group row" [ngClass]="{'has-error': (!name.valid && name.touched), 'has-success': (name.valid && name.touched)}">
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import {RouterConfig} from "@angular/router";
|
||||
import {Register} from "./register.component";
|
||||
import {RouterConfig} from '@angular/router';
|
||||
import {Register} from './register.component';
|
||||
|
||||
export const RegisterRoutes: RouterConfig = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {Component} from "@angular/core";
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'forms',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {Component} from "@angular/core";
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'ui',
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import {Component, ElementRef, HostListener, ViewEncapsulation} from "@angular/core";
|
||||
import {Router} from "@angular/router";
|
||||
import {AppState} from "../../../app.state";
|
||||
import {layoutSizes} from "../../../theme";
|
||||
import {BaSlimScroll} from "../../../theme/directives";
|
||||
import {BaSidebarService} from "./baSidebar.service";
|
||||
import {Component, ElementRef, HostListener, ViewEncapsulation} from '@angular/core';
|
||||
import {Router} from '@angular/router';
|
||||
import {AppState} from '../../../app.state';
|
||||
import {layoutSizes} from '../../../theme';
|
||||
import {BaSlimScroll} from '../../../theme/directives';
|
||||
import {BaSidebarService} from './baSidebar.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ba-sidebar',
|
||||
|
|
|
|||
|
|
@ -45,21 +45,18 @@ export class BaSidebarService {
|
|||
}
|
||||
|
||||
private _isCurrent(route:UrlTree):boolean {
|
||||
if (!route)
|
||||
return false;
|
||||
|
||||
return this._router.url === this._router.serializeUrl(route);
|
||||
if (route) {
|
||||
return this._router.url === this._router.serializeUrl(route);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private _generateRoute(instructions:any[]):UrlTree {
|
||||
if (!instructions)
|
||||
return null;
|
||||
|
||||
instructions = instructions.filter(item => !!item);
|
||||
|
||||
if (instructions.length === 0)
|
||||
return null;
|
||||
|
||||
return this._router.createUrlTree(instructions);
|
||||
if (instructions.length != 0) {
|
||||
return this._router.createUrlTree(instructions);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import {FORM_PROVIDERS, LocationStrategy, HashLocationStrategy} from '@angular/c
|
|||
|
||||
// Angular 2 Http
|
||||
import {HTTP_PROVIDERS} from '@angular/http';
|
||||
import {APP_ROUTER_PROVIDERS} from "../../app/app.routes";
|
||||
import {APP_ROUTER_PROVIDERS} from '../../app/app.routes';
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue