aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/forms/form-validators/video.ts7
-rw-r--r--client/src/app/shared/search/search-field.type.ts2
-rw-r--r--client/src/app/shared/search/search.component.html4
-rw-r--r--client/src/app/shared/search/search.component.ts17
4 files changed, 18 insertions, 12 deletions
diff --git a/client/src/app/shared/forms/form-validators/video.ts b/client/src/app/shared/forms/form-validators/video.ts
index 434773501..65f11f5da 100644
--- a/client/src/app/shared/forms/form-validators/video.ts
+++ b/client/src/app/shared/forms/form-validators/video.ts
@@ -9,6 +9,13 @@ export const VIDEO_NAME = {
9 } 9 }
10} 10}
11 11
12export const VIDEO_PRIVACY = {
13 VALIDATORS: [ Validators.required ],
14 MESSAGES: {
15 'required': 'Video privacy is required.'
16 }
17}
18
12export const VIDEO_CATEGORY = { 19export const VIDEO_CATEGORY = {
13 VALIDATORS: [ Validators.required ], 20 VALIDATORS: [ Validators.required ],
14 MESSAGES: { 21 MESSAGES: {
diff --git a/client/src/app/shared/search/search-field.type.ts b/client/src/app/shared/search/search-field.type.ts
index 63557898a..ff0bb8de1 100644
--- a/client/src/app/shared/search/search-field.type.ts
+++ b/client/src/app/shared/search/search-field.type.ts
@@ -1 +1 @@
export type SearchField = 'name' | 'author' | 'host' | 'magnetUri' | 'tags' export type SearchField = 'name' | 'author' | 'host' | 'tags'
diff --git a/client/src/app/shared/search/search.component.html b/client/src/app/shared/search/search.component.html
index c6c6ff6a8..0302447d0 100644
--- a/client/src/app/shared/search/search.component.html
+++ b/client/src/app/shared/search/search.component.html
@@ -6,12 +6,12 @@
6 6
7 <input 7 <input
8 type="text" id="search-video" name="search-video" class="form-control" placeholder="Search" class="form-control" 8 type="text" id="search-video" name="search-video" class="form-control" placeholder="Search" class="form-control"
9 [(ngModel)]="searchCriterias.value" (keyup.enter)="doSearch()" 9 [(ngModel)]="searchCriteria.value" (keyup.enter)="doSearch()"
10 > 10 >
11 11
12 <div class="input-group-btn" dropdown placement="bottom right"> 12 <div class="input-group-btn" dropdown placement="bottom right">
13 <button id="simple-btn-keyboard-nav" type="button" class="btn btn-default" dropdownToggle> 13 <button id="simple-btn-keyboard-nav" type="button" class="btn btn-default" dropdownToggle>
14 {{ getStringChoice(searchCriterias.field) }} <span class="caret"></span> 14 {{ getStringChoice(searchCriteria.field) }} <span class="caret"></span>
15 </button> 15 </button>
16 <ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="simple-btn-keyboard-nav" *dropdownMenu> 16 <ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="simple-btn-keyboard-nav" *dropdownMenu>
17 <li *ngFor="let choice of choiceKeys" class="dropdown-item" role="menu-item"> 17 <li *ngFor="let choice of choiceKeys" class="dropdown-item" role="menu-item">
diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts
index ecce20666..6e2827fe3 100644
--- a/client/src/app/shared/search/search.component.ts
+++ b/client/src/app/shared/search/search.component.ts
@@ -16,10 +16,9 @@ export class SearchComponent implements OnInit {
16 name: 'Name', 16 name: 'Name',
17 author: 'Author', 17 author: 'Author',
18 host: 'Pod Host', 18 host: 'Pod Host',
19 magnetUri: 'Magnet URI',
20 tags: 'Tags' 19 tags: 'Tags'
21 } 20 }
22 searchCriterias: Search = { 21 searchCriteria: Search = {
23 field: 'name', 22 field: 'name',
24 value: '' 23 value: ''
25 } 24 }
@@ -30,13 +29,13 @@ export class SearchComponent implements OnInit {
30 // Subscribe if the search changed 29 // Subscribe if the search changed
31 // Usually changed by videos list component 30 // Usually changed by videos list component
32 this.searchService.updateSearch.subscribe( 31 this.searchService.updateSearch.subscribe(
33 newSearchCriterias => { 32 newSearchCriteria => {
34 // Put a field by default 33 // Put a field by default
35 if (!newSearchCriterias.field) { 34 if (!newSearchCriteria.field) {
36 newSearchCriterias.field = 'name' 35 newSearchCriteria.field = 'name'
37 } 36 }
38 37
39 this.searchCriterias = newSearchCriterias 38 this.searchCriteria = newSearchCriteria
40 } 39 }
41 ) 40 )
42 } 41 }
@@ -49,9 +48,9 @@ export class SearchComponent implements OnInit {
49 $event.preventDefault() 48 $event.preventDefault()
50 $event.stopPropagation() 49 $event.stopPropagation()
51 50
52 this.searchCriterias.field = choice 51 this.searchCriteria.field = choice
53 52
54 if (this.searchCriterias.value) { 53 if (this.searchCriteria.value) {
55 this.doSearch() 54 this.doSearch()
56 } 55 }
57 } 56 }
@@ -61,7 +60,7 @@ export class SearchComponent implements OnInit {
61 this.router.navigate([ '/videos/list' ]) 60 this.router.navigate([ '/videos/list' ])
62 } 61 }
63 62
64 this.searchService.searchUpdated.next(this.searchCriterias) 63 this.searchService.searchUpdated.next(this.searchCriteria)
65 } 64 }
66 65
67 getStringChoice (choiceKey: SearchField) { 66 getStringChoice (choiceKey: SearchField) {