Commit d4b3d7e043fc46f196637d5112e594ef8b909ec6

Authored by ABNER SILVA DE OLIVEIRA
2 parents e6f9f67d 95ba9b52
Exists in master and in 1 other branch dev-fixes

merge

src/app/index.route.ts
@@ -3,17 +3,6 @@ @@ -3,17 +3,6 @@
3 /** @ngInject */ 3 /** @ngInject */
4 export function routeConfig($stateProvider, $urlRouterProvider) { 4 export function routeConfig($stateProvider, $urlRouterProvider) {
5 $stateProvider 5 $stateProvider
6 - /*.state("main", {  
7 - url: "/",  
8 - templateUrl: "app/main/main.html",  
9 - controller: "MainController",  
10 - controllerAs: "vm",  
11 - resolve: {  
12 - currentUser: function(AuthService) {  
13 - return AuthService.loginFromCookie();  
14 - }  
15 - }  
16 - })*/  
17 .state("main.profile.cms", { 6 .state("main.profile.cms", {
18 url: "^/myprofile/:profile/cms", 7 url: "^/myprofile/:profile/cms",
19 views: { 8 views: {
@@ -27,17 +16,6 @@ export function routeConfig($stateProvider, $urlRouterProvider) { @@ -27,17 +16,6 @@ export function routeConfig($stateProvider, $urlRouterProvider) {
27 .state("main.profile.settings", { 16 .state("main.profile.settings", {
28 url: "^/myprofile/:profile" 17 url: "^/myprofile/:profile"
29 }) 18 })
30 - .state("main.profile", {  
31 - url: "^/:profile",  
32 - abstract: true,  
33 - views: {  
34 - "content": {  
35 - templateUrl: "app/profile/profile.html",  
36 - controller: "ProfileController",  
37 - controllerAs: "vm"  
38 - }  
39 - }  
40 - })  
41 .state("main.profile.home", { 19 .state("main.profile.home", {
42 url: "", 20 url: "",
43 views: { 21 views: {
src/app/index.ts
@@ -26,16 +26,9 @@ NoosferoApp.addConstants("AUTH_EVENTS", { @@ -26,16 +26,9 @@ NoosferoApp.addConstants("AUTH_EVENTS", {
26 logoutSuccess: "auth-logout-success" 26 logoutSuccess: "auth-logout-success"
27 }); 27 });
28 28
29 -  
30 NoosferoApp.addConfig(noosferoModuleConfig); 29 NoosferoApp.addConfig(noosferoModuleConfig);
31 -  
32 NoosferoApp.run(noosferoAngularRunBlock); 30 NoosferoApp.run(noosferoAngularRunBlock);
33 31
34 -noosferoApp.run(() => {  
35 - console.log("RUN!");  
36 -});  
37 -  
38 -// require("./main/main.controller.js");  
39 require("./cms/cms.controller.js"); 32 require("./cms/cms.controller.js");
40 require("./components/auth/auth.controller.js"); 33 require("./components/auth/auth.controller.js");
41 require("./components/auth/auth.service.js"); 34 require("./components/auth/auth.service.js");
@@ -60,7 +53,6 @@ require("./content-viewer/content-viewer-actions.controller.js"); @@ -60,7 +53,6 @@ require("./content-viewer/content-viewer-actions.controller.js");
60 // require("./content-viewer/content-viewer.controller.js"); 53 // require("./content-viewer/content-viewer.controller.js");
61 require("./profile-info/profile-info.controller.js"); 54 require("./profile-info/profile-info.controller.js");
62 require("./profile/profile-home.controller.js"); 55 require("./profile/profile-home.controller.js");
63 -require("./profile/profile.controller.js");  
64 56
65 NoosferoApp.addController("ContentViewerController", noosferoContentViewer); 57 NoosferoApp.addController("ContentViewerController", noosferoContentViewer);
66 58
src/app/main/main.component.ts
1 -import {bundle, Component, StateConfig} from 'ng-forward'; 1 +import {bundle, Component, StateConfig} from "ng-forward";
2 import {NoosferoArticleBlog} from "./../components/noosfero-articles/blog/blog.component.ts"; 2 import {NoosferoArticleBlog} from "./../components/noosfero-articles/blog/blog.component.ts";
3 3
4 import {ArticleDirective} from "../components/noosfero-articles/article/article.directive.ts"; 4 import {ArticleDirective} from "../components/noosfero-articles/article/article.directive.ts";
5 5
  6 +import {Profile} from "../profile/profile.component";
  7 +
6 @Component({ 8 @Component({
7 selector: 'main-content', 9 selector: 'main-content',
8 templateUrl: "app/main/main.html", 10 templateUrl: "app/main/main.html",
9 }) 11 })
10 export class MainContent { 12 export class MainContent {
  13 + constructor() {
  14 + console.log("MAIN");
  15 + }
11 16
12 } 17 }
13 18
@@ -26,6 +31,17 @@ export class MainContent { @@ -26,6 +31,17 @@ export class MainContent {
26 return AuthService.loginFromCookie(); 31 return AuthService.loginFromCookie();
27 } 32 }
28 } 33 }
  34 + },
  35 + {
  36 + url: "^/:profile",
  37 + // abstract: true,
  38 + component: Profile,
  39 + name: 'main.profile',
  40 + views: {
  41 + "content": {
  42 + templateUrl: "app/profile/profile.html",
  43 + }
  44 + }
29 } 45 }
30 ]) 46 ])
31 export class Main { 47 export class Main {
src/app/profile/profile.component.ts 0 → 100644
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
  1 +import {Component, Inject} from 'ng-forward';
  2 +
  3 +@Component({
  4 + selector: 'profile',
  5 + templateUrl: "app/profile/profile.html"
  6 +})
  7 +
  8 +@Inject("noosfero", "$log", "$stateParams")
  9 +export class Profile {
  10 +
  11 + boxes: any
  12 + profile: any
  13 +
  14 + constructor(noosfero, $log, $stateParams) {
  15 + console.log("PROFILE");
  16 + noosfero.profiles.one().get({ identifier: $stateParams.profile }).then((response) => {
  17 + this.profile = response.data[0];
  18 + noosfero.setCurrentProfile(this.profile);
  19 + return noosfero.boxes(this.profile.id).one().get();
  20 + }).then((response) => {
  21 + this.boxes = response.data.boxes;
  22 + });
  23 + }
  24 +}
src/app/profile/profile.controller.js
@@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
1 -(function() {  
2 - 'use strict';  
3 -  
4 - angular  
5 - .module('noosferoApp')  
6 - .controller('ProfileController', ProfileController);  
7 -  
8 -  
9 - /** @ngInject */  
10 - function ProfileController(noosfero, $log, $stateParams) {  
11 - var vm = this;  
12 - vm.boxes = [];  
13 - activate();  
14 -  
15 - function activate() {  
16 - noosfero.profiles.one().get({identifier: $stateParams.profile}).then(function(response) {  
17 - vm.profile = response.data[0];  
18 - noosfero.setCurrentProfile(vm.profile);  
19 - return noosfero.boxes(vm.profile.id).one().get();  
20 - }).then(function(response) {  
21 - vm.boxes = response.data.boxes;  
22 - });  
23 - }  
24 - }  
25 -})();  
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="vm.boxes" owner="vm.profile"></noosfero-boxes> 3 + <noosfero-boxes boxes="ctrl.boxes" owner="ctrl.profile"></noosfero-boxes>
4 </div> 4 </div>
5 </div> 5 </div>