diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-12-11 11:06:32 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-12-11 11:06:32 +0100 |
commit | fada8d75550dc7365f7e18ee1569b9406251d660 (patch) | |
tree | db9dc01c18693824f83fce5020f4c1f3ae7c0865 /client/src/app/header/header.component.ts | |
parent | 492fd28167f770d79a430fc57451b5a9e075d8e7 (diff) | |
parent | c2830fa8f84f61462098bf36add824f89436dfa9 (diff) | |
download | PeerTube-fada8d75550dc7365f7e18ee1569b9406251d660.tar.gz PeerTube-fada8d75550dc7365f7e18ee1569b9406251d660.tar.zst PeerTube-fada8d75550dc7365f7e18ee1569b9406251d660.zip |
Merge branch 'feature/design' into develop
Diffstat (limited to 'client/src/app/header/header.component.ts')
-rw-r--r-- | client/src/app/header/header.component.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/client/src/app/header/header.component.ts b/client/src/app/header/header.component.ts new file mode 100644 index 000000000..a903048f2 --- /dev/null +++ b/client/src/app/header/header.component.ts | |||
@@ -0,0 +1,28 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { Router } from '@angular/router' | ||
3 | import { getParameterByName } from '../shared/misc/utils' | ||
4 | |||
5 | @Component({ | ||
6 | selector: 'my-header', | ||
7 | templateUrl: './header.component.html', | ||
8 | styleUrls: [ './header.component.scss' ] | ||
9 | }) | ||
10 | |||
11 | export class HeaderComponent implements OnInit { | ||
12 | searchValue = '' | ||
13 | |||
14 | constructor (private router: Router) {} | ||
15 | |||
16 | ngOnInit () { | ||
17 | const searchQuery = getParameterByName('search', window.location.href) | ||
18 | if (searchQuery) this.searchValue = searchQuery | ||
19 | } | ||
20 | |||
21 | doSearch () { | ||
22 | if (!this.searchValue) return | ||
23 | |||
24 | this.router.navigate([ '/videos', 'search' ], { | ||
25 | queryParams: { search: this.searchValue } | ||
26 | }) | ||
27 | } | ||
28 | } | ||