diff --git a/src/app/index.route.ts b/src/app/index.route.ts index a4db2e7..869e3d3 100644 --- a/src/app/index.route.ts +++ b/src/app/index.route.ts @@ -3,17 +3,6 @@ /** @ngInject */ export function routeConfig($stateProvider, $urlRouterProvider) { $stateProvider - /*.state("main", { - url: "/", - templateUrl: "app/main/main.html", - controller: "MainController", - controllerAs: "vm", - resolve: { - currentUser: function(AuthService) { - return AuthService.loginFromCookie(); - } - } - })*/ .state("main.profile.cms", { url: "^/myprofile/:profile/cms", views: { @@ -27,17 +16,6 @@ export function routeConfig($stateProvider, $urlRouterProvider) { .state("main.profile.settings", { url: "^/myprofile/:profile" }) - .state("main.profile", { - url: "^/:profile", - abstract: true, - views: { - "content": { - templateUrl: "app/profile/profile.html", - controller: "ProfileController", - controllerAs: "vm" - } - } - }) .state("main.profile.home", { url: "", views: { diff --git a/src/app/index.ts b/src/app/index.ts index d209427..61785c0 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -24,16 +24,9 @@ NoosferoApp.addConstants("AUTH_EVENTS", { logoutSuccess: "auth-logout-success" }); - NoosferoApp.addConfig(noosferoModuleConfig); - NoosferoApp.run(noosferoAngularRunBlock); -noosferoApp.run(() => { - console.log("RUN!"); -}); - -// require("./main/main.controller.js"); require("./cms/cms.controller.js"); require("./components/auth/auth.controller.js"); require("./components/auth/auth.service.js"); @@ -55,7 +48,6 @@ require("./content-viewer/content-viewer-actions.controller.js"); // require("./content-viewer/content-viewer.controller.js"); require("./profile-info/profile-info.controller.js"); require("./profile/profile-home.controller.js"); -require("./profile/profile.controller.js"); // NoosferoApp.addController("ContentViewerController", ContentViewerController); diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index 47a5cb6..8e8b18f 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -1,10 +1,14 @@ -import {bundle, Component, StateConfig} from 'ng-forward'; +import {Component, StateConfig} from 'ng-forward'; +import {Profile} from '../profile/profile.component'; @Component({ selector: 'main-content', templateUrl: "app/main/main.html", }) export class MainContent { + constructor() { + console.log("MAIN"); + } } @@ -22,6 +26,17 @@ export class MainContent { return AuthService.loginFromCookie(); } } + }, + { + url: "^/:profile", + // abstract: true, + component: Profile, + name: 'main.profile', + views: { + "content": { + templateUrl: "app/profile/profile.html", + } + } } ]) export class Main { diff --git a/src/app/profile/profile.component.ts b/src/app/profile/profile.component.ts new file mode 100644 index 0000000..346df8e --- /dev/null +++ b/src/app/profile/profile.component.ts @@ -0,0 +1,24 @@ +import {Component, Inject} from 'ng-forward'; + +@Component({ + selector: 'profile', + templateUrl: "app/profile/profile.html" +}) + +@Inject("noosfero", "$log", "$stateParams") +export class Profile { + + boxes: any + profile: any + + constructor(noosfero, $log, $stateParams) { + console.log("PROFILE"); + noosfero.profiles.one().get({ identifier: $stateParams.profile }).then((response) => { + this.profile = response.data[0]; + noosfero.setCurrentProfile(this.profile); + return noosfero.boxes(this.profile.id).one().get(); + }).then((response) => { + this.boxes = response.data.boxes; + }); + } +} diff --git a/src/app/profile/profile.controller.js b/src/app/profile/profile.controller.js deleted file mode 100644 index afc8f5a..0000000 --- a/src/app/profile/profile.controller.js +++ /dev/null @@ -1,25 +0,0 @@ -(function() { - 'use strict'; - - angular - .module('noosferoApp') - .controller('ProfileController', ProfileController); - - - /** @ngInject */ - function ProfileController(noosfero, $log, $stateParams) { - var vm = this; - vm.boxes = []; - activate(); - - function activate() { - noosfero.profiles.one().get({identifier: $stateParams.profile}).then(function(response) { - vm.profile = response.data[0]; - noosfero.setCurrentProfile(vm.profile); - return noosfero.boxes(vm.profile.id).one().get(); - }).then(function(response) { - vm.boxes = response.data.boxes; - }); - } - } -})(); diff --git a/src/app/profile/profile.html b/src/app/profile/profile.html index e69c9c0..1f22d9b 100644 --- a/src/app/profile/profile.html +++ b/src/app/profile/profile.html @@ -1,5 +1,5 @@
- +
-- libgit2 0.21.2