Commit 0e9faadcc0a246a66ff7f3793767ab2417a69eb9
1 parent
dd3ef4b8
Exists in
master
and in
35 other branches
Migrate content viewer actions
Showing
6 changed files
with
40 additions
and
43 deletions
Show diff stats
src/app/content-viewer/content-viewer-actions.component.ts
0 → 100644
... | ... | @@ -0,0 +1,18 @@ |
1 | +import {Component, Inject} from "ng-forward"; | |
2 | + | |
3 | +@Component({ | |
4 | + selector: "content-viewer-actions", | |
5 | + templateUrl: "app/content-viewer/navbar-actions.html", | |
6 | +}) | |
7 | +@Inject("noosfero") | |
8 | +export class ContentViewerActions { | |
9 | + | |
10 | + article: any; | |
11 | + profile: any; | |
12 | + | |
13 | + constructor(noosfero) { | |
14 | + noosfero.currentProfile.then((profile) => { | |
15 | + this.profile = profile; | |
16 | + }); | |
17 | + } | |
18 | +} | ... | ... |
src/app/content-viewer/content-viewer-actions.controller.js
... | ... | @@ -1,22 +0,0 @@ |
1 | -(function() { | |
2 | - 'use strict'; | |
3 | - | |
4 | - angular | |
5 | - .module('noosferoApp') | |
6 | - .controller('ContentViewerActionsController', ContentViewerActionsController); | |
7 | - | |
8 | - | |
9 | - /** @ngInject */ | |
10 | - function ContentViewerActionsController(noosfero) { | |
11 | - var vm = this; | |
12 | - vm.article = null; | |
13 | - vm.profile = null; | |
14 | - activate(); | |
15 | - | |
16 | - function activate() { | |
17 | - noosfero.currentProfile.then(function(profile) { | |
18 | - vm.profile = profile; | |
19 | - }); | |
20 | - } | |
21 | - } | |
22 | -})(); |
src/app/content-viewer/content-viewer.component.ts
1 | - | |
2 | 1 | import * as noosfero from "../models/interfaces"; |
3 | 2 | |
4 | 3 | import {ArticleDirective, ArticleView} from "../components/noosfero-articles/article/article.directive"; |
5 | -import {Input, Component, StateConfig} from "ng-forward"; | |
4 | +import {Input, Component, StateConfig, Inject} from "ng-forward"; | |
6 | 5 | |
7 | 6 | import {NoosferoArticleBlog} from "./../components/noosfero-articles/blog/blog.component"; |
8 | 7 | |
9 | 8 | @Component({ |
10 | 9 | selector: "content-viewer", |
11 | 10 | templateUrl: "app/content-viewer/page.html", |
12 | - providers: [ | |
13 | - "noosferoService", "$log", "$stateParams" | |
14 | - ], | |
15 | 11 | directives: [NoosferoArticleBlog, ArticleView, ArticleDirective] |
16 | 12 | }) |
13 | +@Inject("noosfero", "$log", "$stateParams") | |
17 | 14 | export class ContentViewer { |
18 | 15 | |
19 | 16 | @Input() | ... | ... |
src/app/index.route.ts
... | ... | @@ -5,21 +5,6 @@ export function routeConfig($stateProvider, $urlRouterProvider) { |
5 | 5 | $stateProvider |
6 | 6 | .state("main.profile.settings", { |
7 | 7 | url: "^/myprofile/:profile" |
8 | - }) | |
9 | - .state("main.profile.page", { | |
10 | - url: "/{page:any}", | |
11 | - views: { | |
12 | - "mainBlockContent": { | |
13 | - templateUrl: "app/content-viewer/page.html", | |
14 | - controller: "ContentViewerController", | |
15 | - controllerAs: "vm" | |
16 | - }, | |
17 | - "actions@main": { | |
18 | - templateUrl: "app/content-viewer/navbar-actions.html", | |
19 | - controller: "ContentViewerActionsController", | |
20 | - controllerAs: "vm" | |
21 | - } | |
22 | - } | |
23 | 8 | }); |
24 | 9 | |
25 | 10 | $urlRouterProvider.otherwise("/"); | ... | ... |
src/app/index.ts
... | ... | @@ -7,6 +7,7 @@ import {noosferoAngularRunBlock} from "./index.run"; |
7 | 7 | import {routeConfig} from "./index.route"; |
8 | 8 | |
9 | 9 | import {ContentViewer as noosferoContentViewer} from "./content-viewer/content-viewer.component"; |
10 | +import {ContentViewerActions as noosferoContentViewerActions} from "./content-viewer/content-viewer-actions.component"; | |
10 | 11 | import {Profile as noosferoProfile} from "./profile/profile.component"; |
11 | 12 | import {ProfileInfo as noosferoProfileInfo} from "./profile-info/profile-info.component"; |
12 | 13 | import {ProfileHome as noosferoProfileHome} from "./profile/profile-home.component"; |
... | ... | @@ -52,9 +53,9 @@ require("./components/noosfero-boxes/boxes.component.js"); |
52 | 53 | require("./components/noosfero/noosfero-template.filter.js"); |
53 | 54 | require("./components/noosfero/noosfero.service.js"); |
54 | 55 | require("./components/noosfero/profile-image/profile-image.component.js"); |
55 | -require("./content-viewer/content-viewer-actions.controller.js"); | |
56 | 56 | |
57 | 57 | NoosferoApp.addController("ContentViewerController", noosferoContentViewer); |
58 | +NoosferoApp.addController("ContentViewerActionsController", noosferoContentViewerActions); | |
58 | 59 | NoosferoApp.addController("ProfileController", noosferoProfile); |
59 | 60 | NoosferoApp.addController("ProfileHomeController", noosferoProfileHome); |
60 | 61 | NoosferoApp.addController("ProfileInfoController", noosferoProfileInfo); | ... | ... |
src/app/profile/profile.component.ts
... | ... | @@ -2,6 +2,7 @@ import {StateConfig, Component, Inject} from 'ng-forward'; |
2 | 2 | import {ProfileInfo} from '../profile-info/profile-info.component' |
3 | 3 | import {ProfileHome} from '../profile/profile-home.component' |
4 | 4 | import {Cms} from '../cms/cms.component' |
5 | +import {ContentViewer} from "../content-viewer/content-viewer.component"; | |
5 | 6 | |
6 | 7 | @Component({ |
7 | 8 | selector: 'profile', |
... | ... | @@ -43,6 +44,23 @@ import {Cms} from '../cms/cms.component' |
43 | 44 | } |
44 | 45 | } |
45 | 46 | }, |
47 | + { | |
48 | + name: 'main.profile.page', | |
49 | + url: "/{page:any}", | |
50 | + component: ContentViewer, | |
51 | + views: { | |
52 | + "mainBlockContent": { | |
53 | + templateUrl: "app/content-viewer/page.html", | |
54 | + controller: "ContentViewerController", | |
55 | + controllerAs: "vm" | |
56 | + }, | |
57 | + "actions@main": { | |
58 | + templateUrl: "app/content-viewer/navbar-actions.html", | |
59 | + controller: "ContentViewerActionsController", | |
60 | + controllerAs: "vm" | |
61 | + } | |
62 | + } | |
63 | + } | |
46 | 64 | ]) |
47 | 65 | @Inject("noosfero", "$log", "$stateParams") |
48 | 66 | export class Profile { | ... | ... |