diff options
Diffstat (limited to 'client/app/shared/search/search.component.ts')
-rw-r--r-- | client/app/shared/search/search.component.ts | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/client/app/shared/search/search.component.ts b/client/app/shared/search/search.component.ts deleted file mode 100644 index d541cd0d6..000000000 --- a/client/app/shared/search/search.component.ts +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | import { Component, EventEmitter, Output } from '@angular/core'; | ||
2 | |||
3 | import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown'; | ||
4 | |||
5 | import { Search } from './search.model'; | ||
6 | import { SearchField } from './search-field.type'; | ||
7 | |||
8 | @Component({ | ||
9 | selector: 'my-search', | ||
10 | templateUrl: 'client/app/shared/search/search.component.html', | ||
11 | directives: [ DROPDOWN_DIRECTIVES ] | ||
12 | }) | ||
13 | |||
14 | export class SearchComponent { | ||
15 | @Output() search = new EventEmitter<Search>(); | ||
16 | |||
17 | fieldChoices = { | ||
18 | name: 'Name', | ||
19 | author: 'Author', | ||
20 | podUrl: 'Pod Url', | ||
21 | magnetUri: 'Magnet Uri' | ||
22 | }; | ||
23 | searchCriterias: Search = { | ||
24 | field: 'name', | ||
25 | value: '' | ||
26 | }; | ||
27 | |||
28 | get choiceKeys() { | ||
29 | return Object.keys(this.fieldChoices); | ||
30 | } | ||
31 | |||
32 | choose($event: MouseEvent, choice: SearchField) { | ||
33 | $event.preventDefault(); | ||
34 | $event.stopPropagation(); | ||
35 | |||
36 | this.searchCriterias.field = choice; | ||
37 | } | ||
38 | |||
39 | doSearch() { | ||
40 | this.search.emit(this.searchCriterias); | ||
41 | } | ||
42 | |||
43 | getStringChoice(choiceKey: SearchField) { | ||
44 | return this.fieldChoices[choiceKey]; | ||
45 | } | ||
46 | } | ||