Commit bfb5450d518077fb0011a3c01507c8dcf5144a13
1 parent
7db4f9dc
Exists in
profile_search
before submitting the search
Showing
2 changed files
with
22 additions
and
10 deletions
Show diff stats
src/app/components/noosfero-blocks/profile-contents-search/profile-contents-search.component.ts
1 | -import {Component, Input} from 'ng-forward' | |
1 | +import {StateConfig, Component, Inject, Input, provide} from 'ng-forward'; | |
2 | 2 | import {Block} from '../block.component'; |
3 | +import {Profile} from "../../../models/interfaces"; | |
3 | 4 | import {ArticleService} from "../../../../lib/ng-noosfero-api/http/article.service"; |
5 | +import {ProfileService} from "../../../../lib/ng-noosfero-api/http/profile.service"; | |
4 | 6 | |
5 | 7 | @Component({ |
6 | 8 | selector: 'noosfero-profile-contents-search-block', |
7 | - templateUrl: 'app/components/noosfero-blocks/profile-contents-search/profile-contents-search.html' | |
9 | + templateUrl: 'app/components/noosfero-blocks/profile-contents-search/profile-contents-search.html', | |
10 | + providers: [provide('profileService', { useClass: ProfileService }), provide('articleService', { useClass: ArticleService })] | |
8 | 11 | }) |
12 | +@Inject(ArticleService, ProfileService) | |
9 | 13 | export class ProfileContentsSearch { |
10 | 14 | |
11 | 15 | members: any = []; |
16 | + @Input('searchTerm') | |
17 | + searchTerm: String; | |
18 | + defaultParams: any = { per_page: 20 } | |
19 | + profile: any; | |
12 | 20 | |
13 | - constructor(private articleService: ArticleService) { | |
14 | - | |
21 | + constructor(private articleService: ArticleService, private profileService: ProfileService) { | |
22 | + profileService.getCurrentProfile().then((profile: Profile) => { | |
23 | + this.profile = profile; | |
24 | + }); | |
15 | 25 | } |
16 | 26 | |
17 | 27 | search() { |
18 | - console.log("Na busca"); | |
19 | - // this.articleService.getProfileMembers(this.owner.id, { per_page: 6 }).then((response: any) => { | |
20 | - // this.members = response.data.people; | |
21 | - // }); | |
28 | + console.log(this.profile.id); | |
29 | + var profileId = 53; //FIXME | |
30 | + var params = this.defaultParams; | |
31 | + this.articleService.getByProfile(profileId, params).then((response: any) => { | |
32 | + this.members = response.data.people; | |
33 | + }); | |
22 | 34 | } |
23 | 35 | |
24 | 36 | } | ... | ... |
src/app/components/noosfero-blocks/profile-contents-search/profile-contents-search.html
... | ... | @@ -17,8 +17,8 @@ |
17 | 17 | </div> |
18 | 18 | </div> --> |
19 | 19 | <div> |
20 | - <input type="text" name="search-term"> | |
21 | - <button ng-click="search"> | |
20 | + <input type="text" ng-model="ctrl.searchTerm"> | |
21 | + <button ng-click="ctrl.search();">pra diguliu ficar feliz</button> | |
22 | 22 | </div> |
23 | 23 | <div class="search-field" > |
24 | 24 | ... | ... |