Commit 36a0b0c28ec152b878260acfe67761badcf74f6b

Authored by Victor Costa
1 parent d4b3d7e0

Fix profile controller

src/app/index.ts
... ... @@ -5,6 +5,7 @@ import {noosferoAngularRunBlock} from "./index.run";
5 5 import {routeConfig} from "./index.route";
6 6  
7 7 import {ContentViewer as noosferoContentViewer} from "./content-viewer/content-viewer.component";
  8 +import {Profile as noosferoProfile} from "./profile/profile.component";
8 9  
9 10 import {Main} from "./main/main.component";
10 11 import {bootstrap, bundle} from "ng-forward";
... ... @@ -55,5 +56,6 @@ require("./profile-info/profile-info.controller.js");
55 56 require("./profile/profile-home.controller.js");
56 57  
57 58 NoosferoApp.addController("ContentViewerController", noosferoContentViewer);
  59 +NoosferoApp.addController("ProfileController", noosferoProfile);
58 60  
59 61 NoosferoApp.addConfig(routeConfig);
... ...
src/app/main/main.component.ts
... ... @@ -10,9 +10,6 @@ import {Profile} from "../profile/profile.component";
10 10 templateUrl: "app/main/main.html",
11 11 })
12 12 export class MainContent {
13   - constructor() {
14   - console.log("MAIN");
15   - }
16 13  
17 14 }
18 15  
... ... @@ -40,6 +37,8 @@ export class MainContent {
40 37 views: {
41 38 "content": {
42 39 templateUrl: "app/profile/profile.html",
  40 + controller: "ProfileController",
  41 + controllerAs: "vm"
43 42 }
44 43 }
45 44 }
... ...
src/app/profile/profile.component.ts
... ... @@ -4,7 +4,6 @@ import {Component, Inject} from 'ng-forward';
4 4 selector: 'profile',
5 5 templateUrl: "app/profile/profile.html"
6 6 })
7   -
8 7 @Inject("noosfero", "$log", "$stateParams")
9 8 export class Profile {
10 9  
... ... @@ -12,7 +11,6 @@ export class Profile {
12 11 profile: any
13 12  
14 13 constructor(noosfero, $log, $stateParams) {
15   - console.log("PROFILE");
16 14 noosfero.profiles.one().get({ identifier: $stateParams.profile }).then((response) => {
17 15 this.profile = response.data[0];
18 16 noosfero.setCurrentProfile(this.profile);
... ...
src/app/profile/profile.html
1 1 <div class="profile-container">
2 2 <div class="row">
3   - <noosfero-boxes boxes="ctrl.boxes" owner="ctrl.profile"></noosfero-boxes>
  3 + <noosfero-boxes boxes="vm.boxes" owner="vm.profile"></noosfero-boxes>
4 4 </div>
5 5 </div>
... ...