Commit c55481d4f251fa4772479b1fe719af907e32aad2
1 parent
3645c953
Exists in
master
and in
34 other branches
Fix the name of profile and article services in components
Showing
7 changed files
with
31 additions
and
27 deletions
Show diff stats
src/app/cms/cms.component.ts
| 1 | -import {StateConfig, Component, Inject} from 'ng-forward'; | |
| 1 | +import {StateConfig, Component, Inject, provide} from 'ng-forward'; | |
| 2 | 2 | import {Profile} from "./../models/interfaces"; |
| 3 | 3 | import {ArticleService} from "../../lib/ng-noosfero-api/http/article.service"; |
| 4 | 4 | |
| 5 | 5 | @Component({ |
| 6 | 6 | selector: 'cms', |
| 7 | - templateUrl: "app/cms/cms.html" | |
| 7 | + templateUrl: "app/cms/cms.html", | |
| 8 | + providers: [provide('articleService', { useClass: ArticleService })] | |
| 8 | 9 | }) |
| 9 | 10 | @Inject(ArticleService, "noosfero", "$stateParams", "$httpParamSerializer", "$state", "SweetAlert") |
| 10 | 11 | export class Cms { |
| ... | ... | @@ -12,13 +13,13 @@ export class Cms { |
| 12 | 13 | article: any = {}; |
| 13 | 14 | profile: any; |
| 14 | 15 | |
| 15 | - constructor(private ArticleService: ArticleService, private noosfero: any/* TODO convert noosferoService */, private $stateParams: ng.ui.IStateParamsService, private $httpParamSerializer: any, private $state: ng.ui.IStateService, private SweetAlert: any) { | |
| 16 | + constructor(private articleService: ArticleService, private noosfero: any/* TODO convert noosferoService */, private $stateParams: ng.ui.IStateParamsService, private $httpParamSerializer: any, private $state: ng.ui.IStateService, private SweetAlert: any) { | |
| 16 | 17 | |
| 17 | 18 | } |
| 18 | 19 | |
| 19 | 20 | save() { |
| 20 | 21 | this.noosfero.currentProfile.then((profile: Profile) => { |
| 21 | - return this.ArticleService.create(profile.id, this.article); | |
| 22 | + return this.articleService.create(profile.id, this.article); | |
| 22 | 23 | }).then((response: restangular.IResponse) => { |
| 23 | 24 | this.$state.transitionTo('main.profile.page', { page: response.data.article.path, profile: response.data.article.profile.identifier }); |
| 24 | 25 | this.SweetAlert.swal({ | ... | ... |
src/app/components/noosfero-blocks/members-block/members-block.component.ts
| ... | ... | @@ -13,12 +13,12 @@ export class MembersBlock { |
| 13 | 13 | |
| 14 | 14 | members: any = []; |
| 15 | 15 | |
| 16 | - constructor(private ProfileService: ProfileService) { | |
| 16 | + constructor(private profileService: ProfileService) { | |
| 17 | 17 | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | ngOnInit() { |
| 21 | - this.ProfileService.getProfileMembers(this.owner.id, { per_page: 6 }).then((response: any) => { | |
| 21 | + this.profileService.getProfileMembers(this.owner.id, { per_page: 6 }).then((response: any) => { | |
| 22 | 22 | this.members = response.data.people; |
| 23 | 23 | }); |
| 24 | 24 | } | ... | ... |
src/app/components/noosfero-blocks/recent-documents/recent-documents.component.ts
| ... | ... | @@ -13,10 +13,10 @@ export class RecentDocumentsBlock { |
| 13 | 13 | |
| 14 | 14 | profile: any; |
| 15 | 15 | documents: any; |
| 16 | - | |
| 16 | + | |
| 17 | 17 | documentsLoaded: boolean = false; |
| 18 | 18 | |
| 19 | - constructor(private ArticleService: ArticleService, private $state: any) { | |
| 19 | + constructor(private articleService: ArticleService, private $state: any) { | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | ngOnInit() { |
| ... | ... | @@ -25,7 +25,7 @@ export class RecentDocumentsBlock { |
| 25 | 25 | |
| 26 | 26 | var limit = (this.block && this.block.settings) ? this.block.settings.limit : null || 5; |
| 27 | 27 | //FIXME get all text articles |
| 28 | - this.ArticleService.getByProfile(this.profile.id, { content_type: 'TinyMceArticle', per_page: limit }).then((response: any) => { | |
| 28 | + this.articleService.getByProfile(this.profile.id, { content_type: 'TinyMceArticle', per_page: limit }).then((response: any) => { | |
| 29 | 29 | this.documents = response.data.articles; |
| 30 | 30 | this.documentsLoaded = true; |
| 31 | 31 | }); |
| ... | ... | @@ -36,4 +36,3 @@ export class RecentDocumentsBlock { |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | } |
| 39 | - | ... | ... |
src/app/content-viewer/content-viewer.component.ts
| ... | ... | @@ -2,7 +2,7 @@ import * as noosfero from "../models/interfaces"; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | import {ArticleView} from "../components/noosfero-articles/article/article_view"; |
| 5 | -import {Input, Component, StateConfig, Inject} from "ng-forward"; | |
| 5 | +import {Input, Component, StateConfig, Inject, provide} from "ng-forward"; | |
| 6 | 6 | |
| 7 | 7 | import {ArticleBlog} from "./../components/noosfero-articles/blog/blog.component"; |
| 8 | 8 | import {ArticleService} from "../../lib/ng-noosfero-api/http/article.service"; |
| ... | ... | @@ -10,7 +10,8 @@ import {ArticleService} from "../../lib/ng-noosfero-api/http/article.service"; |
| 10 | 10 | @Component({ |
| 11 | 11 | selector: "content-viewer", |
| 12 | 12 | templateUrl: "app/content-viewer/page.html", |
| 13 | - directives: [ArticleBlog, ArticleView] | |
| 13 | + directives: [ArticleBlog, ArticleView], | |
| 14 | + providers: [provide('articleService', { useClass: ArticleService })] | |
| 14 | 15 | }) |
| 15 | 16 | @Inject(ArticleService, "noosfero", "$log", "$stateParams") |
| 16 | 17 | export class ContentViewer { |
| ... | ... | @@ -21,14 +22,14 @@ export class ContentViewer { |
| 21 | 22 | @Input() |
| 22 | 23 | profile: noosfero.Profile = null; |
| 23 | 24 | |
| 24 | - constructor(private ArticleService: ArticleService, private noosfero: any, private $log: ng.ILogService, private $stateParams: angular.ui.IStateParamsService) { | |
| 25 | + constructor(private articleService: ArticleService, private noosfero: any, private $log: ng.ILogService, private $stateParams: angular.ui.IStateParamsService) { | |
| 25 | 26 | this.activate(); |
| 26 | 27 | } |
| 27 | 28 | |
| 28 | 29 | activate() { |
| 29 | 30 | this.noosfero.currentProfile.then((profile: noosfero.Profile) => { |
| 30 | 31 | this.profile = profile; |
| 31 | - return this.ArticleService.getByProfile(this.profile.id, { path: this.$stateParams["page"] }); | |
| 32 | + return this.articleService.getByProfile(this.profile.id, { path: this.$stateParams["page"] }); | |
| 32 | 33 | }).then((response: restangular.IResponse) => { |
| 33 | 34 | this.article = response.data.article; |
| 34 | 35 | }); | ... | ... |
src/app/profile-info/profile-info.component.ts
| 1 | -import {StateConfig, Component, Inject} from 'ng-forward'; | |
| 1 | +import {StateConfig, Component, Inject, provide} from 'ng-forward'; | |
| 2 | 2 | |
| 3 | 3 | import {Profile} from "./../models/interfaces"; |
| 4 | 4 | import {ProfileService} from "../../lib/ng-noosfero-api/http/profile.service"; |
| 5 | 5 | |
| 6 | 6 | @Component({ |
| 7 | 7 | selector: 'profile', |
| 8 | - templateUrl: "app/profile-info/profile-info.html" | |
| 8 | + templateUrl: "app/profile-info/profile-info.html", | |
| 9 | + providers: [provide('profileService', { useClass: ProfileService })] | |
| 9 | 10 | }) |
| 10 | 11 | @Inject(ProfileService, "noosfero") |
| 11 | 12 | export class ProfileInfo { |
| ... | ... | @@ -13,14 +14,14 @@ export class ProfileInfo { |
| 13 | 14 | activities: any |
| 14 | 15 | profile: any |
| 15 | 16 | |
| 16 | - constructor(private ProfileService: ProfileService, private noosfero: any) { | |
| 17 | + constructor(private profileService: ProfileService, private noosfero: any) { | |
| 17 | 18 | this.activate(); |
| 18 | 19 | } |
| 19 | 20 | |
| 20 | 21 | activate() { |
| 21 | 22 | this.noosfero.currentProfile.then((profile: Profile) => { |
| 22 | 23 | this.profile = profile; |
| 23 | - return this.ProfileService.getActivities(this.profile.id); | |
| 24 | + return this.profileService.getActivities(this.profile.id); | |
| 24 | 25 | }).then((response: restangular.IResponse) => { |
| 25 | 26 | this.activities = response.data.activities; |
| 26 | 27 | }); | ... | ... |
src/app/profile/profile-home.component.ts
| 1 | -import {StateConfig, Component, Inject} from 'ng-forward'; | |
| 1 | +import {StateConfig, Component, Inject, provide} from 'ng-forward'; | |
| 2 | 2 | |
| 3 | 3 | import {Profile} from "./../models/interfaces"; |
| 4 | 4 | import {ProfileService} from "../../lib/ng-noosfero-api/http/profile.service"; |
| 5 | 5 | |
| 6 | 6 | @Component({ |
| 7 | 7 | selector: 'profile-home', |
| 8 | - template: "<div></div>" | |
| 8 | + template: "<div></div>", | |
| 9 | + providers: [provide('profileService', { useClass: ProfileService })] | |
| 9 | 10 | }) |
| 10 | 11 | @Inject(ProfileService, "noosfero", "$log", "$stateParams", "$scope", "$state") |
| 11 | 12 | export class ProfileHome { |
| 12 | 13 | |
| 13 | 14 | profile: Profile; |
| 14 | 15 | |
| 15 | - constructor(ProfileService: ProfileService, noosfero: any, $log: ng.ILogService, $stateParams: ng.ui.IStateParamsService, $scope: ng.IScope, $state: ng.ui.IStateService) { | |
| 16 | + constructor(profileService: ProfileService, noosfero: any, $log: ng.ILogService, $stateParams: ng.ui.IStateParamsService, $scope: ng.IScope, $state: ng.ui.IStateService) { | |
| 16 | 17 | noosfero.currentProfile.then((profile: Profile) => { |
| 17 | 18 | this.profile = profile; |
| 18 | - return ProfileService.get(this.profile.id).customGET('home_page', { fields: 'path' }); | |
| 19 | + return profileService.get(this.profile.id).customGET('home_page', { fields: 'path' }); | |
| 19 | 20 | }).then((response: restangular.IResponse) => { |
| 20 | 21 | if (response.data.article) { |
| 21 | 22 | $state.transitionTo('main.profile.page', { page: response.data.article.path, profile: this.profile.identifier }, { location: false }); | ... | ... |
src/app/profile/profile.component.ts
| 1 | -import {StateConfig, Component, Inject} from 'ng-forward'; | |
| 1 | +import {StateConfig, Component, Inject, provide} 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'; |
| ... | ... | @@ -12,7 +12,8 @@ import * as noosferoModels from "./../models/interfaces"; |
| 12 | 12 | @Component({ |
| 13 | 13 | selector: 'profile', |
| 14 | 14 | templateUrl: "app/profile/profile.html", |
| 15 | - directives: [NoosferoActivities] | |
| 15 | + directives: [NoosferoActivities], | |
| 16 | + providers: [provide('profileService', { useClass: ProfileService })] | |
| 16 | 17 | }) |
| 17 | 18 | @StateConfig([ |
| 18 | 19 | { |
| ... | ... | @@ -74,11 +75,11 @@ export class Profile { |
| 74 | 75 | boxes: noosferoModels.Box[]; |
| 75 | 76 | profile: noosferoModels.Profile; |
| 76 | 77 | |
| 77 | - constructor(ProfileService: ProfileService, noosfero: any, $log: ng.ILogService, $stateParams: ng.ui.IStateParamsService) { | |
| 78 | - ProfileService.getByIdentifier($stateParams["profile"]).then((response: restangular.IResponse) => { | |
| 78 | + constructor(profileService: ProfileService, noosfero: any, $log: ng.ILogService, $stateParams: ng.ui.IStateParamsService) { | |
| 79 | + profileService.getByIdentifier($stateParams["profile"]).then((response: restangular.IResponse) => { | |
| 79 | 80 | this.profile = response.data[0]; |
| 80 | 81 | noosfero.setCurrentProfile(this.profile); |
| 81 | - return ProfileService.getBoxes(this.profile.id); | |
| 82 | + return profileService.getBoxes(this.profile.id); | |
| 82 | 83 | }).then((response: restangular.IResponse) => { |
| 83 | 84 | this.boxes = response.data.boxes; |
| 84 | 85 | }); | ... | ... |