Commit 328a7a826bc4085754dd0dd2adeb278b81183e81
Committed by
Victor Costa
1 parent
332c24ec
Exists in
master
and in
7 other branches
some small refactoring on class naming and changed to allow EVENTS_HUB_KNOW_EVEN…
…T_NAMES to be an array of strings
Showing
3 changed files
with
62 additions
and
57 deletions
Show diff stats
src/app/known-events.ts
@@ -2,7 +2,7 @@ import { EventsHubKnownEventNames } from './shared/services/events-hub.service'; | @@ -2,7 +2,7 @@ import { EventsHubKnownEventNames } from './shared/services/events-hub.service'; | ||
2 | 2 | ||
3 | export class NoosferoKnownEvents implements EventsHubKnownEventNames { | 3 | export class NoosferoKnownEvents implements EventsHubKnownEventNames { |
4 | IMAGE_PROFILE_UPDATED: string = 'IMAGE_PROFILE_UPDATED'; | 4 | IMAGE_PROFILE_UPDATED: string = 'IMAGE_PROFILE_UPDATED'; |
5 | - PROFILE_INFO_UPDATED: string = 'IMAGE_PROFILE_UPDATED'; | 5 | + PROFILE_INFO_UPDATED: string = 'PROFILE_INFO_UPDATED'; |
6 | ARTICLE_UPDATED: string = 'ARTICLE_UPDATED'; | 6 | ARTICLE_UPDATED: string = 'ARTICLE_UPDATED'; |
7 | 7 | ||
8 | constructor() { | 8 | constructor() { |
src/app/main/main.component.spec.ts
@@ -4,8 +4,9 @@ import {TestComponentBuilder, ComponentFixture} from "ng-forward/cjs/testing/tes | @@ -4,8 +4,9 @@ import {TestComponentBuilder, ComponentFixture} from "ng-forward/cjs/testing/tes | ||
4 | 4 | ||
5 | import {quickCreateComponent} from "../../spec/helpers"; | 5 | import {quickCreateComponent} from "../../spec/helpers"; |
6 | import {getAngularServiceFactory} from "../../spec/helpers"; | 6 | import {getAngularServiceFactory} from "../../spec/helpers"; |
7 | +import { EVENTS_HUB_KNOW_EVENT_NAMES } from "../shared/services/events-hub.service"; | ||
7 | 8 | ||
8 | -describe("MainComponent", function() { | 9 | +describe("MainComponent", function () { |
9 | 10 | ||
10 | let localFixture: ComponentFixture; | 11 | let localFixture: ComponentFixture; |
11 | let $state: angular.ui.IStateService; | 12 | let $state: angular.ui.IStateService; |
@@ -34,6 +35,14 @@ describe("MainComponent", function() { | @@ -34,6 +35,14 @@ describe("MainComponent", function() { | ||
34 | { | 35 | { |
35 | useValue: environmentService | 36 | useValue: environmentService |
36 | }), | 37 | }), |
38 | + provide(EVENTS_HUB_KNOW_EVENT_NAMES, | ||
39 | + { | ||
40 | + useValue: [ | ||
41 | + 'IMAGE_PROFILE_UPDATED', | ||
42 | + 'PROFILE_INFO_UPDATED', | ||
43 | + 'ARTICLE_UPDATED' | ||
44 | + ] | ||
45 | + }), | ||
37 | ] | 46 | ] |
38 | }) | 47 | }) |
39 | class MainComponentParent { | 48 | class MainComponentParent { |
@@ -57,7 +66,7 @@ describe("MainComponent", function() { | @@ -57,7 +66,7 @@ describe("MainComponent", function() { | ||
57 | // navigates to the environment home | 66 | // navigates to the environment home |
58 | $state.go("main.environment.home"); | 67 | $state.go("main.environment.home"); |
59 | localFixture.detectChanges(); | 68 | localFixture.detectChanges(); |
60 | - // after changes were detected it checks the current $state route | 69 | + // after changes were detected it checks the current $state route |
61 | expect($state.current.name).toEqual("main.environment.home"); | 70 | expect($state.current.name).toEqual("main.environment.home"); |
62 | done(); | 71 | done(); |
63 | }); | 72 | }); |
src/app/main/main.component.ts
1 | import * as plugins from "../../plugins"; | 1 | import * as plugins from "../../plugins"; |
2 | -import {bundle, Component, StateConfig, Inject} from "ng-forward"; | ||
3 | -import {ArticleBlogComponent} from "./../article/types/blog/blog.component"; | ||
4 | - | ||
5 | -import {ArticleViewComponent} from "./../article/article-default-view.component"; | ||
6 | - | ||
7 | -import {ProfileComponent} from "../profile/profile.component"; | ||
8 | -import {BoxesComponent} from "../layout/boxes/boxes.component"; | ||
9 | -import {BlockContentComponent} from "../layout/blocks/block-content.component"; | ||
10 | -import {BlockComponent} from "../layout/blocks/block.component"; | ||
11 | -import {EnvironmentComponent} from "../environment/environment.component"; | ||
12 | -import {EnvironmentHomeComponent} from "../environment/environment-home.component"; | ||
13 | -import {PeopleBlockComponent} from "../layout/blocks/people/people-block.component"; | ||
14 | -import {DisplayContentBlockComponent} from "../layout/blocks/display-content/display-content-block.component"; | ||
15 | -import {LinkListBlockComponent} from "../layout/blocks/link-list/link-list-block.component"; | ||
16 | -import {RecentDocumentsBlockComponent} from "../layout/blocks/recent-documents/recent-documents-block.component"; | ||
17 | -import {ProfileImageBlockComponent} from "../layout/blocks/profile-image/profile-image-block.component"; | ||
18 | -import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html-block.component"; | ||
19 | -import {StatisticsBlockComponent} from "../layout/blocks/statistics/statistics-block.component"; | ||
20 | -import {PersonTagsPluginInterestsBlockComponent} from "../layout/blocks/person-tags-plugin-interests/person-tags-plugin-interests-block.component"; | ||
21 | -import {TagsBlockComponent} from "../layout/blocks/tags/tags-block.component"; | ||
22 | -import {CustomContentComponent} from "../profile/custom-content/custom-content.component"; | ||
23 | -import {RecentActivitiesPluginActivitiesBlockComponent} from "../layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component"; | ||
24 | - | ||
25 | -import {MembersBlockComponent} from "../layout/blocks/members/members-block.component"; | ||
26 | -import {CommunitiesBlockComponent} from "../layout/blocks/communities/communities-block.component"; | ||
27 | - | ||
28 | -import {LoginBlockComponent} from "../layout/blocks/login-block/login-block.component"; | ||
29 | - | ||
30 | -import {NoosferoTemplate} from "../shared/pipes/noosfero-template.filter"; | ||
31 | -import {DateFormat} from "../shared/pipes/date-format.filter"; | ||
32 | - | ||
33 | -import {AuthService} from "../login/auth.service"; | ||
34 | -import {SessionService} from "../login/session.service"; | ||
35 | -import {EnvironmentService} from "./../../lib/ng-noosfero-api/http/environment.service"; | ||
36 | -import {NotificationService} from "../shared/services/notification.service"; | ||
37 | - | ||
38 | -import {BodyStateClassesService} from "./../layout/services/body-state-classes.service"; | ||
39 | - | ||
40 | -import {Navbar} from "../layout/navbar/navbar"; | ||
41 | - | ||
42 | -import {SidebarComponent} from "../layout/sidebar/sidebar.component"; | ||
43 | - | ||
44 | -import {MainBlockComponent} from "../layout/blocks/main/main-block.component"; | ||
45 | -import {HtmlEditorComponent} from "../shared/components/html-editor/html-editor.component"; | ||
46 | -import {PermissionDirective} from "../shared/components/permission/permission.directive"; | ||
47 | -import {SearchComponent} from "../search/search.component"; | ||
48 | -import {SearchFormComponent} from "../search/search-form/search-form.component"; | 2 | +import { bundle, Component, StateConfig, Inject } from "ng-forward"; |
3 | +import { ArticleBlogComponent } from "./../article/types/blog/blog.component"; | ||
4 | + | ||
5 | +import { ArticleViewComponent } from "./../article/article-default-view.component"; | ||
6 | + | ||
7 | +import { ProfileComponent } from "../profile/profile.component"; | ||
8 | +import { BoxesComponent } from "../layout/boxes/boxes.component"; | ||
9 | +import { BlockContentComponent } from "../layout/blocks/block-content.component"; | ||
10 | +import { BlockComponent } from "../layout/blocks/block.component"; | ||
11 | +import { EnvironmentComponent } from "../environment/environment.component"; | ||
12 | +import { EnvironmentHomeComponent } from "../environment/environment-home.component"; | ||
13 | +import { PeopleBlockComponent } from "../layout/blocks/people/people-block.component"; | ||
14 | +import { DisplayContentBlockComponent } from "../layout/blocks/display-content/display-content-block.component"; | ||
15 | +import { LinkListBlockComponent } from "../layout/blocks/link-list/link-list-block.component"; | ||
16 | +import { RecentDocumentsBlockComponent } from "../layout/blocks/recent-documents/recent-documents-block.component"; | ||
17 | +import { ProfileImageBlockComponent } from "../layout/blocks/profile-image/profile-image-block.component"; | ||
18 | +import { RawHTMLBlockComponent } from "../layout/blocks/raw-html/raw-html-block.component"; | ||
19 | +import { StatisticsBlockComponent } from "../layout/blocks/statistics/statistics-block.component"; | ||
20 | +import { PersonTagsPluginInterestsBlockComponent } from "../layout/blocks/person-tags-plugin-interests/person-tags-plugin-interests-block.component"; | ||
21 | +import { TagsBlockComponent } from "../layout/blocks/tags/tags-block.component"; | ||
22 | +import { CustomContentComponent } from "../profile/custom-content/custom-content.component"; | ||
23 | +import { RecentActivitiesPluginActivitiesBlockComponent } from "../layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component"; | ||
24 | + | ||
25 | +import { MembersBlockComponent } from "../layout/blocks/members/members-block.component"; | ||
26 | +import { CommunitiesBlockComponent } from "../layout/blocks/communities/communities-block.component"; | ||
27 | + | ||
28 | +import { LoginBlockComponent } from "../layout/blocks/login-block/login-block.component"; | ||
29 | + | ||
30 | +import { NoosferoTemplate } from "../shared/pipes/noosfero-template.filter"; | ||
31 | +import { DateFormat } from "../shared/pipes/date-format.filter"; | ||
32 | + | ||
33 | +import { AuthService } from "../login/auth.service"; | ||
34 | +import { SessionService } from "../login/session.service"; | ||
35 | +import { EnvironmentService } from "./../../lib/ng-noosfero-api/http/environment.service"; | ||
36 | +import { NotificationService } from "../shared/services/notification.service"; | ||
37 | + | ||
38 | +import { BodyStateClassesService } from "./../layout/services/body-state-classes.service"; | ||
39 | + | ||
40 | +import { Navbar } from "../layout/navbar/navbar"; | ||
41 | + | ||
42 | +import { SidebarComponent } from "../layout/sidebar/sidebar.component"; | ||
43 | + | ||
44 | +import { MainBlockComponent } from "../layout/blocks/main/main-block.component"; | ||
45 | +import { HtmlEditorComponent } from "../shared/components/html-editor/html-editor.component"; | ||
46 | +import { PermissionDirective } from "../shared/components/permission/permission.directive"; | ||
47 | +import { SearchComponent } from "../search/search.component"; | ||
48 | +import { SearchFormComponent } from "../search/search-form/search-form.component"; | ||
49 | 49 | ||
50 | import { EVENTS_HUB_KNOW_EVENT_NAMES, EventsHubService } from "../shared/services/events-hub.service"; | 50 | import { EVENTS_HUB_KNOW_EVENT_NAMES, EventsHubService } from "../shared/services/events-hub.service"; |
51 | -import { NoosferoEventsHubKnownEventNames } from "../events-hub-known-events"; | 51 | +import { NoosferoKnownEvents } from "../known-events"; |
52 | /** | 52 | /** |
53 | * @ngdoc controller | 53 | * @ngdoc controller |
54 | * @name main.MainContentComponent | 54 | * @name main.MainContentComponent |
@@ -71,13 +71,9 @@ export class MainContentComponent { | @@ -71,13 +71,9 @@ export class MainContentComponent { | ||
71 | 71 | ||
72 | constructor( | 72 | constructor( |
73 | private bodyStateClassesService: BodyStateClassesService, | 73 | private bodyStateClassesService: BodyStateClassesService, |
74 | - eventsNames: NoosferoEventsHubKnownEventNames, | 74 | + eventsNames: NoosferoKnownEvents, |
75 | eventsHubService: EventsHubService | 75 | eventsHubService: EventsHubService |
76 | - ) { | ||
77 | - try { | ||
78 | - console.log('Events Names', eventsNames); | ||
79 | - eventsHubService.subscribeToEvent(eventsNames.IMAGE_PROFILE_UPDATED, () => console.log('Event ImageProfileUpdate emitted!')); | ||
80 | - } catch (e) { } | 76 | + ) { |
81 | bodyStateClassesService.start({ | 77 | bodyStateClassesService.start({ |
82 | skin: this.themeSkin | 78 | skin: this.themeSkin |
83 | }); | 79 | }); |