removed unnecessary factory classes, simplified existing services

This commit is contained in:
alecmerdler 2017-01-23 01:57:00 -08:00
parent 2a59014f0b
commit 64a4b68216
15 changed files with 69 additions and 158 deletions

View file

@ -1,18 +1,20 @@
import { RouteBuilder } from './route-builder.service';
export function routeBuilderFactory() {
return (routeProvider, pages, profiles, currentProfile): RouteBuilder => {
return new RouteBuilderImpl(routeProvider, pages, profiles, currentProfile);
}
}
export class RouteBuilderImpl implements RouteBuilder {
constructor(private routeProvider, private pages, public profiles, currentProfile) {
public currentProfile: string = 'layout';
public profiles: any[] = [
// Start with the old pages (if we asked for it).
{id: 'old-layout', templatePath: '/static/partials/'},
// Fallback back combined new/existing pages.
{id: 'layout', templatePath: '/static/partials/'}
];
constructor(private routeProvider: ng.route.IRouteProvider, private pages: any) {
for (let i = 0; i < this.profiles.length; ++i) {
if (this.profiles[i].id == currentProfile) {
if (this.profiles[i].id == this.currentProfile) {
this.profiles = this.profiles.slice(i);
break;
}