aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/app/app.component.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-23 09:30:18 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-23 09:38:38 +0200
commit471bc22f19767c1cb1e7ba7ad0ddf0ff5f0e88f4 (patch)
tree606ccf517d76baf08539be7501d07dfd065884a9 /client/angular/app/app.component.ts
parent322940742b4dca168de6dfed0d1ebf5926dab528 (diff)
downloadPeerTube-471bc22f19767c1cb1e7ba7ad0ddf0ff5f0e88f4.tar.gz
PeerTube-471bc22f19767c1cb1e7ba7ad0ddf0ff5f0e88f4.tar.zst
PeerTube-471bc22f19767c1cb1e7ba7ad0ddf0ff5f0e88f4.zip
Add search with field choose support in client
Diffstat (limited to 'client/angular/app/app.component.ts')
-rw-r--r--client/angular/app/app.component.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/client/angular/app/app.component.ts b/client/angular/app/app.component.ts
index a105ed26a..513830d6b 100644
--- a/client/angular/app/app.component.ts
+++ b/client/angular/app/app.component.ts
@@ -2,6 +2,8 @@ import { Component } from '@angular/core';
2import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated'; 2import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated';
3import { HTTP_PROVIDERS } from '@angular/http'; 3import { HTTP_PROVIDERS } from '@angular/http';
4 4
5import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
6
5import { VideosAddComponent } from '../videos/components/add/videos-add.component'; 7import { VideosAddComponent } from '../videos/components/add/videos-add.component';
6import { VideosListComponent } from '../videos/components/list/videos-list.component'; 8import { VideosListComponent } from '../videos/components/list/videos-list.component';
7import { VideosWatchComponent } from '../videos/components/watch/videos-watch.component'; 9import { VideosWatchComponent } from '../videos/components/watch/videos-watch.component';
@@ -10,6 +12,8 @@ import { FriendsService } from '../friends/services/friends.service';
10import { UserLoginComponent } from '../users/components/login/login.component'; 12import { UserLoginComponent } from '../users/components/login/login.component';
11import { AuthService } from '../users/services/auth.service'; 13import { AuthService } from '../users/services/auth.service';
12import { AuthStatus } from '../users/models/authStatus'; 14import { AuthStatus } from '../users/models/authStatus';
15import { SearchComponent } from './search.component';
16import { Search } from './search';
13 17
14@RouteConfig([ 18@RouteConfig([
15 { 19 {
@@ -39,12 +43,14 @@ import { AuthStatus } from '../users/models/authStatus';
39 selector: 'my-app', 43 selector: 'my-app',
40 templateUrl: 'app/angular/app/app.component.html', 44 templateUrl: 'app/angular/app/app.component.html',
41 styleUrls: [ 'app/angular/app/app.component.css' ], 45 styleUrls: [ 'app/angular/app/app.component.css' ],
42 directives: [ ROUTER_DIRECTIVES ], 46 directives: [ ROUTER_DIRECTIVES, SearchComponent ],
43 providers: [ ROUTER_PROVIDERS, HTTP_PROVIDERS, VideosService, FriendsService, AuthService ] 47 providers: [ ROUTER_PROVIDERS, HTTP_PROVIDERS, VideosService, FriendsService, AuthService ]
44}) 48})
45 49
46export class AppComponent { 50export class AppComponent {
47 isLoggedIn: boolean; 51 isLoggedIn: boolean;
52 search_field: string = name;
53 choices = [ ];
48 54
49 constructor(private _friendsService: FriendsService, 55 constructor(private _friendsService: FriendsService,
50 private _authService: AuthService, 56 private _authService: AuthService,
@@ -61,9 +67,10 @@ export class AppComponent {
61 ); 67 );
62 } 68 }
63 69
64 doSearch(search: string) { 70 onSearch(search: Search) {
65 if (search !== '') { 71 console.log(search);
66 this._router.navigate(['VideosList', { search: search }]); 72 if (search.value !== '') {
73 this._router.navigate(['VideosList', { search: search.value, field: search.field }]);
67 } else { 74 } else {
68 this._router.navigate(['VideosList']); 75 this._router.navigate(['VideosList']);
69 } 76 }