Commit deef855acf7d0ea2ec7ad2e60466b63927bdc641
1 parent
b0b90c13
Exists in
master
and in
34 other branches
Refactor routes and not add router components as controllers
Showing
3 changed files
with
7 additions
and
23 deletions
Show diff stats
src/app/index.ts
1 | - | ||
2 | - | ||
3 | import {NoosferoApp} from "./index.module"; | 1 | import {NoosferoApp} from "./index.module"; |
4 | import {noosferoModuleConfig} from "./index.config"; | 2 | import {noosferoModuleConfig} from "./index.config"; |
5 | import {noosferoAngularRunBlock} from "./index.run"; | 3 | import {noosferoAngularRunBlock} from "./index.run"; |
6 | import {routeConfig} from "./index.route"; | 4 | import {routeConfig} from "./index.route"; |
7 | 5 | ||
8 | -import {ContentViewer as noosferoContentViewer} from "./content-viewer/content-viewer.component"; | ||
9 | -import {ContentViewerActions as noosferoContentViewerActions} from "./content-viewer/content-viewer-actions.component"; | ||
10 | -import {Profile as noosferoProfile} from "./profile/profile.component"; | ||
11 | -import {ProfileInfo as noosferoProfileInfo} from "./profile-info/profile-info.component"; | ||
12 | -import {ProfileHome as noosferoProfileHome} from "./profile/profile-home.component"; | ||
13 | -import {Cms as noosferoCms} from "./cms/cms.component"; | ||
14 | - | ||
15 | import {Main} from "./main/main.component"; | 6 | import {Main} from "./main/main.component"; |
16 | import {bootstrap, bundle} from "ng-forward"; | 7 | import {bootstrap, bundle} from "ng-forward"; |
17 | 8 | ||
@@ -41,15 +32,7 @@ NoosferoApp.run(noosferoAngularRunBlock); | @@ -41,15 +32,7 @@ NoosferoApp.run(noosferoAngularRunBlock); | ||
41 | // NoosferoApp.addService("AuthService", AuthService); | 32 | // NoosferoApp.addService("AuthService", AuthService); |
42 | NoosferoApp.addController("AuthController", AuthController); | 33 | NoosferoApp.addController("AuthController", AuthController); |
43 | 34 | ||
44 | - | ||
45 | require("./components/noosfero/noosfero.service.js"); | 35 | require("./components/noosfero/noosfero.service.js"); |
46 | require("./components/noosfero/profile-image/profile-image.component.js"); | 36 | require("./components/noosfero/profile-image/profile-image.component.js"); |
47 | 37 | ||
48 | -NoosferoApp.addController("ContentViewerController", noosferoContentViewer); | ||
49 | -NoosferoApp.addController("ContentViewerActionsController", noosferoContentViewerActions); | ||
50 | -NoosferoApp.addController("ProfileController", noosferoProfile); | ||
51 | -NoosferoApp.addController("ProfileHomeController", noosferoProfileHome); | ||
52 | -NoosferoApp.addController("ProfileInfoController", noosferoProfileInfo); | ||
53 | -NoosferoApp.addController("CmsController", noosferoCms); | ||
54 | - | ||
55 | NoosferoApp.addConfig(routeConfig); | 38 | NoosferoApp.addConfig(routeConfig); |
src/app/main/main.component.ts
@@ -60,7 +60,7 @@ export class MainContent { | @@ -60,7 +60,7 @@ export class MainContent { | ||
60 | views: { | 60 | views: { |
61 | "content": { | 61 | "content": { |
62 | templateUrl: "app/profile/profile.html", | 62 | templateUrl: "app/profile/profile.html", |
63 | - controller: "ProfileController", | 63 | + controller: Profile, |
64 | controllerAs: "vm" | 64 | controllerAs: "vm" |
65 | } | 65 | } |
66 | } | 66 | } |
src/app/profile/profile.component.ts
@@ -3,6 +3,7 @@ import {ProfileInfo} from '../profile-info/profile-info.component'; | @@ -3,6 +3,7 @@ import {ProfileInfo} from '../profile-info/profile-info.component'; | ||
3 | import {ProfileHome} from '../profile/profile-home.component'; | 3 | import {ProfileHome} from '../profile/profile-home.component'; |
4 | import {Cms} from '../cms/cms.component'; | 4 | import {Cms} from '../cms/cms.component'; |
5 | import {ContentViewer} from "../content-viewer/content-viewer.component"; | 5 | import {ContentViewer} from "../content-viewer/content-viewer.component"; |
6 | +import {ContentViewerActions} from "../content-viewer/content-viewer-actions.component"; | ||
6 | import {NoosferoActivities} from "../components/noosfero-activities/activities.component"; | 7 | import {NoosferoActivities} from "../components/noosfero-activities/activities.component"; |
7 | import {ProfileService} from "../../lib/ng-noosfero-api/http/profile.service"; | 8 | import {ProfileService} from "../../lib/ng-noosfero-api/http/profile.service"; |
8 | 9 | ||
@@ -21,7 +22,7 @@ import * as noosferoModels from "./../models/interfaces"; | @@ -21,7 +22,7 @@ import * as noosferoModels from "./../models/interfaces"; | ||
21 | views: { | 22 | views: { |
22 | "mainBlockContent": { | 23 | "mainBlockContent": { |
23 | templateUrl: "app/profile-info/profile-info.html", | 24 | templateUrl: "app/profile-info/profile-info.html", |
24 | - controller: "ProfileInfoController", | 25 | + controller: ProfileInfo, |
25 | controllerAs: "vm" | 26 | controllerAs: "vm" |
26 | } | 27 | } |
27 | } | 28 | } |
@@ -33,7 +34,7 @@ import * as noosferoModels from "./../models/interfaces"; | @@ -33,7 +34,7 @@ import * as noosferoModels from "./../models/interfaces"; | ||
33 | views: { | 34 | views: { |
34 | "mainBlockContent": { | 35 | "mainBlockContent": { |
35 | templateUrl: "app/cms/cms.html", | 36 | templateUrl: "app/cms/cms.html", |
36 | - controller: "CmsController", | 37 | + controller: Cms, |
37 | controllerAs: "vm" | 38 | controllerAs: "vm" |
38 | } | 39 | } |
39 | } | 40 | } |
@@ -44,7 +45,7 @@ import * as noosferoModels from "./../models/interfaces"; | @@ -44,7 +45,7 @@ import * as noosferoModels from "./../models/interfaces"; | ||
44 | component: ProfileHome, | 45 | component: ProfileHome, |
45 | views: { | 46 | views: { |
46 | "mainBlockContent": { | 47 | "mainBlockContent": { |
47 | - controller: "ProfileHomeController", | 48 | + controller: ProfileHome, |
48 | controllerAs: "vm" | 49 | controllerAs: "vm" |
49 | } | 50 | } |
50 | } | 51 | } |
@@ -56,12 +57,12 @@ import * as noosferoModels from "./../models/interfaces"; | @@ -56,12 +57,12 @@ import * as noosferoModels from "./../models/interfaces"; | ||
56 | views: { | 57 | views: { |
57 | "mainBlockContent": { | 58 | "mainBlockContent": { |
58 | templateUrl: "app/content-viewer/page.html", | 59 | templateUrl: "app/content-viewer/page.html", |
59 | - controller: "ContentViewerController", | 60 | + controller: ContentViewer, |
60 | controllerAs: "vm" | 61 | controllerAs: "vm" |
61 | }, | 62 | }, |
62 | "actions@main": { | 63 | "actions@main": { |
63 | templateUrl: "app/content-viewer/navbar-actions.html", | 64 | templateUrl: "app/content-viewer/navbar-actions.html", |
64 | - controller: "ContentViewerActionsController", | 65 | + controller: ContentViewerActions, |
65 | controllerAs: "vm" | 66 | controllerAs: "vm" |
66 | } | 67 | } |
67 | } | 68 | } |