diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-06-03 22:08:03 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-06-03 22:08:03 +0200 |
commit | 4a6995be18b15de1834a39c8921a0e4109671bb6 (patch) | |
tree | b659661cea33687fcc6bd8fc2251cb7a15ab9f9d /client/app/shared/search | |
parent | 468892541175f9662f8b1b977e819dc1a496f282 (diff) | |
download | PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.tar.gz PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.tar.zst PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.zip |
First draft to use webpack instead of systemjs
Diffstat (limited to 'client/app/shared/search')
-rw-r--r-- | client/app/shared/search/index.ts | 3 | ||||
-rw-r--r-- | client/app/shared/search/search-field.type.ts | 1 | ||||
-rw-r--r-- | client/app/shared/search/search.component.html | 17 | ||||
-rw-r--r-- | client/app/shared/search/search.component.ts | 46 | ||||
-rw-r--r-- | client/app/shared/search/search.model.ts | 6 |
5 files changed, 0 insertions, 73 deletions
diff --git a/client/app/shared/search/index.ts b/client/app/shared/search/index.ts deleted file mode 100644 index a49a4f1a9..000000000 --- a/client/app/shared/search/index.ts +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | export * from './search-field.type'; | ||
2 | export * from './search.component'; | ||
3 | export * from './search.model'; | ||
diff --git a/client/app/shared/search/search-field.type.ts b/client/app/shared/search/search-field.type.ts deleted file mode 100644 index 846236290..000000000 --- a/client/app/shared/search/search-field.type.ts +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | export type SearchField = "name" | "author" | "podUrl" | "magnetUri"; | ||
diff --git a/client/app/shared/search/search.component.html b/client/app/shared/search/search.component.html deleted file mode 100644 index fb13ac72e..000000000 --- a/client/app/shared/search/search.component.html +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | <div class="input-group"> | ||
2 | <div class="input-group-btn" dropdown> | ||
3 | <button id="simple-btn-keyboard-nav" type="button" class="btn btn-default" dropdownToggle> | ||
4 | {{ getStringChoice(searchCriterias.field) }} <span class="caret"></span> | ||
5 | </button> | ||
6 | <ul class="dropdown-menu" role="menu" aria-labelledby="simple-btn-keyboard-nav"> | ||
7 | <li *ngFor="let choice of choiceKeys" class="dropdown-item"> | ||
8 | <a class="dropdown-item" href="#" (click)="choose($event, choice)">{{ getStringChoice(choice) }}</a> | ||
9 | </li> | ||
10 | </ul> | ||
11 | </div> | ||
12 | |||
13 | <input | ||
14 | type="text" id="search-video" name="search-video" class="form-control" placeholder="Search a video..." class="form-control" | ||
15 | [(ngModel)]="searchCriterias.value" (keyup.enter)="doSearch()" | ||
16 | > | ||
17 | </div> | ||
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 | } | ||
diff --git a/client/app/shared/search/search.model.ts b/client/app/shared/search/search.model.ts deleted file mode 100644 index 932a6566c..000000000 --- a/client/app/shared/search/search.model.ts +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | import { SearchField } from './search-field.type'; | ||
2 | |||
3 | export interface Search { | ||
4 | field: SearchField; | ||
5 | value: string; | ||
6 | } | ||