From deef855acf7d0ea2ec7ad2e60466b63927bdc641 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Mon, 7 Mar 2016 18:32:14 -0300 Subject: [PATCH] Refactor routes and not add router components as controllers --- src/app/index.ts | 17 ----------------- src/app/main/main.component.ts | 2 +- src/app/profile/profile.component.ts | 11 ++++++----- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/app/index.ts b/src/app/index.ts index 953ebcd..c994b11 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -1,17 +1,8 @@ - - import {NoosferoApp} from "./index.module"; import {noosferoModuleConfig} from "./index.config"; import {noosferoAngularRunBlock} from "./index.run"; import {routeConfig} from "./index.route"; -import {ContentViewer as noosferoContentViewer} from "./content-viewer/content-viewer.component"; -import {ContentViewerActions as noosferoContentViewerActions} from "./content-viewer/content-viewer-actions.component"; -import {Profile as noosferoProfile} from "./profile/profile.component"; -import {ProfileInfo as noosferoProfileInfo} from "./profile-info/profile-info.component"; -import {ProfileHome as noosferoProfileHome} from "./profile/profile-home.component"; -import {Cms as noosferoCms} from "./cms/cms.component"; - import {Main} from "./main/main.component"; import {bootstrap, bundle} from "ng-forward"; @@ -41,15 +32,7 @@ NoosferoApp.run(noosferoAngularRunBlock); // NoosferoApp.addService("AuthService", AuthService); NoosferoApp.addController("AuthController", AuthController); - require("./components/noosfero/noosfero.service.js"); require("./components/noosfero/profile-image/profile-image.component.js"); -NoosferoApp.addController("ContentViewerController", noosferoContentViewer); -NoosferoApp.addController("ContentViewerActionsController", noosferoContentViewerActions); -NoosferoApp.addController("ProfileController", noosferoProfile); -NoosferoApp.addController("ProfileHomeController", noosferoProfileHome); -NoosferoApp.addController("ProfileInfoController", noosferoProfileInfo); -NoosferoApp.addController("CmsController", noosferoCms); - NoosferoApp.addConfig(routeConfig); diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index 79312e2..abfbe7c 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -60,7 +60,7 @@ export class MainContent { views: { "content": { templateUrl: "app/profile/profile.html", - controller: "ProfileController", + controller: Profile, controllerAs: "vm" } } diff --git a/src/app/profile/profile.component.ts b/src/app/profile/profile.component.ts index 7cb33f4..de2866c 100644 --- a/src/app/profile/profile.component.ts +++ b/src/app/profile/profile.component.ts @@ -3,6 +3,7 @@ import {ProfileInfo} from '../profile-info/profile-info.component'; import {ProfileHome} from '../profile/profile-home.component'; import {Cms} from '../cms/cms.component'; import {ContentViewer} from "../content-viewer/content-viewer.component"; +import {ContentViewerActions} from "../content-viewer/content-viewer-actions.component"; import {NoosferoActivities} from "../components/noosfero-activities/activities.component"; import {ProfileService} from "../../lib/ng-noosfero-api/http/profile.service"; @@ -21,7 +22,7 @@ import * as noosferoModels from "./../models/interfaces"; views: { "mainBlockContent": { templateUrl: "app/profile-info/profile-info.html", - controller: "ProfileInfoController", + controller: ProfileInfo, controllerAs: "vm" } } @@ -33,7 +34,7 @@ import * as noosferoModels from "./../models/interfaces"; views: { "mainBlockContent": { templateUrl: "app/cms/cms.html", - controller: "CmsController", + controller: Cms, controllerAs: "vm" } } @@ -44,7 +45,7 @@ import * as noosferoModels from "./../models/interfaces"; component: ProfileHome, views: { "mainBlockContent": { - controller: "ProfileHomeController", + controller: ProfileHome, controllerAs: "vm" } } @@ -56,12 +57,12 @@ import * as noosferoModels from "./../models/interfaces"; views: { "mainBlockContent": { templateUrl: "app/content-viewer/page.html", - controller: "ContentViewerController", + controller: ContentViewer, controllerAs: "vm" }, "actions@main": { templateUrl: "app/content-viewer/navbar-actions.html", - controller: "ContentViewerActionsController", + controller: ContentViewerActions, controllerAs: "vm" } } -- libgit2 0.21.2