diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-12-05 17:46:33 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-12-05 18:25:29 +0100 |
commit | f3aaa9a95cc2b61f1f255472d7014d08faa66561 (patch) | |
tree | 95e70c8d0ed5b6f1c71c32a77cb7d6cf8478c9d4 /client/src/app/shared/search | |
parent | d235f6b0d1054a2a3451dacade927caefce8f30c (diff) | |
download | PeerTube-f3aaa9a95cc2b61f1f255472d7014d08faa66561.tar.gz PeerTube-f3aaa9a95cc2b61f1f255472d7014d08faa66561.tar.zst PeerTube-f3aaa9a95cc2b61f1f255472d7014d08faa66561.zip |
Fix client search
Diffstat (limited to 'client/src/app/shared/search')
-rw-r--r-- | client/src/app/shared/search/index.ts | 4 | ||||
-rw-r--r-- | client/src/app/shared/search/search-field.type.ts | 1 | ||||
-rw-r--r-- | client/src/app/shared/search/search.component.html | 10 | ||||
-rw-r--r-- | client/src/app/shared/search/search.component.scss | 39 | ||||
-rw-r--r-- | client/src/app/shared/search/search.component.ts | 42 | ||||
-rw-r--r-- | client/src/app/shared/search/search.model.ts | 6 | ||||
-rw-r--r-- | client/src/app/shared/search/search.service.ts | 18 |
7 files changed, 0 insertions, 120 deletions
diff --git a/client/src/app/shared/search/index.ts b/client/src/app/shared/search/index.ts deleted file mode 100644 index d4016cf89..000000000 --- a/client/src/app/shared/search/index.ts +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | export * from './search-field.type' | ||
2 | export * from './search.component' | ||
3 | export * from './search.model' | ||
4 | export * from './search.service' | ||
diff --git a/client/src/app/shared/search/search-field.type.ts b/client/src/app/shared/search/search-field.type.ts deleted file mode 100644 index 7323d6cc3..000000000 --- a/client/src/app/shared/search/search-field.type.ts +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | export type SearchField = 'name' | 'account' | 'host' | 'tags' | ||
diff --git a/client/src/app/shared/search/search.component.html b/client/src/app/shared/search/search.component.html deleted file mode 100644 index 9bc9bafe4..000000000 --- a/client/src/app/shared/search/search.component.html +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | <input | ||
2 | type="text" id="search-video" name="search-video" placeholder="Search..." | ||
3 | [(ngModel)]="searchCriteria.value" (keyup.enter)="doSearch()" | ||
4 | > | ||
5 | <span (click)="doSearch()" class="icon icon-search"></span> | ||
6 | |||
7 | <a class="upload-button" routerLink="/videos/upload"> | ||
8 | <span class="icon icon-upload"></span> | ||
9 | Upload | ||
10 | </a> | ||
diff --git a/client/src/app/shared/search/search.component.scss b/client/src/app/shared/search/search.component.scss deleted file mode 100644 index 7ba8ef26c..000000000 --- a/client/src/app/shared/search/search.component.scss +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | #search-video { | ||
2 | @include peertube-input-text($search-input-width); | ||
3 | margin-right: 15px; | ||
4 | padding-right: 25px; // For the search icon | ||
5 | |||
6 | &::placeholder { | ||
7 | color: #000; | ||
8 | } | ||
9 | } | ||
10 | |||
11 | .icon.icon-search { | ||
12 | display: inline-block; | ||
13 | background: url('../../../assets/images/header/search.svg') no-repeat; | ||
14 | background-size: contain; | ||
15 | width: 25px; | ||
16 | height: 21px; | ||
17 | vertical-align: middle; | ||
18 | cursor: pointer; | ||
19 | // yolo | ||
20 | position: absolute; | ||
21 | margin-left: -50px; | ||
22 | margin-top: 5px; | ||
23 | } | ||
24 | |||
25 | .upload-button { | ||
26 | @include peertube-button-link; | ||
27 | |||
28 | margin-right: 25px; | ||
29 | |||
30 | .icon.icon-upload { | ||
31 | display: inline-block; | ||
32 | background: url('../../../assets/images/header/upload.svg') no-repeat; | ||
33 | background-size: contain; | ||
34 | width: 22px; | ||
35 | height: 24px; | ||
36 | vertical-align: middle; | ||
37 | margin-right: 6px; | ||
38 | } | ||
39 | } | ||
diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts deleted file mode 100644 index f49ecc8ad..000000000 --- a/client/src/app/shared/search/search.component.ts +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { Router } from '@angular/router' | ||
3 | import { Search } from './search.model' | ||
4 | import { SearchService } from './search.service' | ||
5 | |||
6 | @Component({ | ||
7 | selector: 'my-search', | ||
8 | templateUrl: './search.component.html', | ||
9 | styleUrls: [ './search.component.scss' ] | ||
10 | }) | ||
11 | |||
12 | export class SearchComponent implements OnInit { | ||
13 | searchCriteria: Search = { | ||
14 | field: 'name', | ||
15 | value: '' | ||
16 | } | ||
17 | |||
18 | constructor (private searchService: SearchService, private router: Router) {} | ||
19 | |||
20 | ngOnInit () { | ||
21 | // Subscribe if the search changed | ||
22 | // Usually changed by videos list component | ||
23 | this.searchService.updateSearch.subscribe( | ||
24 | newSearchCriteria => { | ||
25 | // Put a field by default | ||
26 | if (!newSearchCriteria.field) { | ||
27 | newSearchCriteria.field = 'name' | ||
28 | } | ||
29 | |||
30 | this.searchCriteria = newSearchCriteria | ||
31 | } | ||
32 | ) | ||
33 | } | ||
34 | |||
35 | doSearch () { | ||
36 | // if (this.router.url.indexOf('/videos/list') === -1) { | ||
37 | // this.router.navigate([ '/videos/list' ]) | ||
38 | // } | ||
39 | |||
40 | this.searchService.searchUpdated.next(this.searchCriteria) | ||
41 | } | ||
42 | } | ||
diff --git a/client/src/app/shared/search/search.model.ts b/client/src/app/shared/search/search.model.ts deleted file mode 100644 index 174adf2c6..000000000 --- a/client/src/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 | } | ||
diff --git a/client/src/app/shared/search/search.service.ts b/client/src/app/shared/search/search.service.ts deleted file mode 100644 index 0480b46bd..000000000 --- a/client/src/app/shared/search/search.service.ts +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | import { Injectable } from '@angular/core' | ||
2 | import { Subject } from 'rxjs/Subject' | ||
3 | import { ReplaySubject } from 'rxjs/ReplaySubject' | ||
4 | |||
5 | import { Search } from './search.model' | ||
6 | |||
7 | // This class is needed to communicate between videos/ and search component | ||
8 | // Remove it when we'll be able to subscribe to router changes | ||
9 | @Injectable() | ||
10 | export class SearchService { | ||
11 | searchUpdated: Subject<Search> | ||
12 | updateSearch: Subject<Search> | ||
13 | |||
14 | constructor () { | ||
15 | this.updateSearch = new Subject<Search>() | ||
16 | this.searchUpdated = new ReplaySubject<Search>(1) | ||
17 | } | ||
18 | } | ||