diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-12-01 16:17:32 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-12-01 16:17:32 +0100 |
commit | 2bbb34127fccd187ed690949b6791e49fdd77194 (patch) | |
tree | d9ebcc72ab5e1d439f08e73881dc62baecb3bc36 /client/src/app/shared/search | |
parent | 9bf9d2a5c223bf006496ae7adf0c0bd7a7975108 (diff) | |
download | PeerTube-2bbb34127fccd187ed690949b6791e49fdd77194.tar.gz PeerTube-2bbb34127fccd187ed690949b6791e49fdd77194.tar.zst PeerTube-2bbb34127fccd187ed690949b6791e49fdd77194.zip |
Add auto scroll to videos list
Diffstat (limited to 'client/src/app/shared/search')
-rw-r--r-- | client/src/app/shared/search/search.component.ts | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts index 6ef19c97a..f49ecc8ad 100644 --- a/client/src/app/shared/search/search.component.ts +++ b/client/src/app/shared/search/search.component.ts | |||
@@ -1,8 +1,6 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | |||
4 | import { Search } from './search.model' | 3 | import { Search } from './search.model' |
5 | import { SearchField } from './search-field.type' | ||
6 | import { SearchService } from './search.service' | 4 | import { SearchService } from './search.service' |
7 | 5 | ||
8 | @Component({ | 6 | @Component({ |
@@ -12,12 +10,6 @@ import { SearchService } from './search.service' | |||
12 | }) | 10 | }) |
13 | 11 | ||
14 | export class SearchComponent implements OnInit { | 12 | export class SearchComponent implements OnInit { |
15 | fieldChoices = { | ||
16 | name: 'Name', | ||
17 | account: 'Account', | ||
18 | host: 'Host', | ||
19 | tags: 'Tags' | ||
20 | } | ||
21 | searchCriteria: Search = { | 13 | searchCriteria: Search = { |
22 | field: 'name', | 14 | field: 'name', |
23 | value: '' | 15 | value: '' |
@@ -40,30 +32,11 @@ export class SearchComponent implements OnInit { | |||
40 | ) | 32 | ) |
41 | } | 33 | } |
42 | 34 | ||
43 | get choiceKeys () { | ||
44 | return Object.keys(this.fieldChoices) | ||
45 | } | ||
46 | |||
47 | choose ($event: MouseEvent, choice: SearchField) { | ||
48 | $event.preventDefault() | ||
49 | $event.stopPropagation() | ||
50 | |||
51 | this.searchCriteria.field = choice | ||
52 | |||
53 | if (this.searchCriteria.value) { | ||
54 | this.doSearch() | ||
55 | } | ||
56 | } | ||
57 | |||
58 | doSearch () { | 35 | doSearch () { |
59 | if (this.router.url.indexOf('/videos/list') === -1) { | 36 | // if (this.router.url.indexOf('/videos/list') === -1) { |
60 | this.router.navigate([ '/videos/list' ]) | 37 | // this.router.navigate([ '/videos/list' ]) |
61 | } | 38 | // } |
62 | 39 | ||
63 | this.searchService.searchUpdated.next(this.searchCriteria) | 40 | this.searchService.searchUpdated.next(this.searchCriteria) |
64 | } | 41 | } |
65 | |||
66 | getStringChoice (choiceKey: SearchField) { | ||
67 | return this.fieldChoices[choiceKey] | ||
68 | } | ||
69 | } | 42 | } |