From bfb5450d518077fb0011a3c01507c8dcf5144a13 Mon Sep 17 00:00:00 2001 From: Evandro Junior Date: Fri, 11 Mar 2016 17:47:46 -0300 Subject: [PATCH] before submitting the search --- src/app/components/noosfero-blocks/profile-contents-search/profile-contents-search.component.ts | 28 ++++++++++++++++++++-------- src/app/components/noosfero-blocks/profile-contents-search/profile-contents-search.html | 4 ++-- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/app/components/noosfero-blocks/profile-contents-search/profile-contents-search.component.ts b/src/app/components/noosfero-blocks/profile-contents-search/profile-contents-search.component.ts index 844a81f..81cfbe8 100644 --- a/src/app/components/noosfero-blocks/profile-contents-search/profile-contents-search.component.ts +++ b/src/app/components/noosfero-blocks/profile-contents-search/profile-contents-search.component.ts @@ -1,24 +1,36 @@ -import {Component, Input} from 'ng-forward' +import {StateConfig, Component, Inject, Input, provide} from 'ng-forward'; import {Block} from '../block.component'; +import {Profile} from "../../../models/interfaces"; import {ArticleService} from "../../../../lib/ng-noosfero-api/http/article.service"; +import {ProfileService} from "../../../../lib/ng-noosfero-api/http/profile.service"; @Component({ selector: 'noosfero-profile-contents-search-block', - templateUrl: 'app/components/noosfero-blocks/profile-contents-search/profile-contents-search.html' + templateUrl: 'app/components/noosfero-blocks/profile-contents-search/profile-contents-search.html', + providers: [provide('profileService', { useClass: ProfileService }), provide('articleService', { useClass: ArticleService })] }) +@Inject(ArticleService, ProfileService) export class ProfileContentsSearch { members: any = []; + @Input('searchTerm') + searchTerm: String; + defaultParams: any = { per_page: 20 } + profile: any; - constructor(private articleService: ArticleService) { - + constructor(private articleService: ArticleService, private profileService: ProfileService) { + profileService.getCurrentProfile().then((profile: Profile) => { + this.profile = profile; + }); } search() { - console.log("Na busca"); - // this.articleService.getProfileMembers(this.owner.id, { per_page: 6 }).then((response: any) => { - // this.members = response.data.people; - // }); + console.log(this.profile.id); + var profileId = 53; //FIXME + var params = this.defaultParams; + this.articleService.getByProfile(profileId, params).then((response: any) => { + this.members = response.data.people; + }); } } diff --git a/src/app/components/noosfero-blocks/profile-contents-search/profile-contents-search.html b/src/app/components/noosfero-blocks/profile-contents-search/profile-contents-search.html index 1e0a459..8c944ad 100644 --- a/src/app/components/noosfero-blocks/profile-contents-search/profile-contents-search.html +++ b/src/app/components/noosfero-blocks/profile-contents-search/profile-contents-search.html @@ -17,8 +17,8 @@ -->
- -
-- libgit2 0.21.2