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