diff options
Diffstat (limited to 'client/src/app/search')
-rw-r--r-- | client/src/app/search/search-filters.component.ts | 6 | ||||
-rw-r--r-- | client/src/app/search/search.component.html | 2 | ||||
-rw-r--r-- | client/src/app/search/search.component.scss | 4 | ||||
-rw-r--r-- | client/src/app/search/search.component.ts | 22 |
4 files changed, 16 insertions, 18 deletions
diff --git a/client/src/app/search/search-filters.component.ts b/client/src/app/search/search-filters.component.ts index 8d7f84ac1..3fdc6df35 100644 --- a/client/src/app/search/search-filters.component.ts +++ b/client/src/app/search/search-filters.component.ts | |||
@@ -1,10 +1,6 @@ | |||
1 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | 2 | import { ServerService } from '@app/core' |
3 | import { RedirectService, ServerService } from '@app/core' | ||
4 | import { NotificationsService } from 'angular2-notifications' | ||
5 | import { SearchService } from '@app/search/search.service' | ||
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
7 | import { MetaService } from '@ngx-meta/core' | ||
8 | import { AdvancedSearch } from '@app/search/advanced-search.model' | 4 | import { AdvancedSearch } from '@app/search/advanced-search.model' |
9 | import { VideoConstant } from '../../../../shared' | 5 | import { VideoConstant } from '../../../../shared' |
10 | 6 | ||
diff --git a/client/src/app/search/search.component.html b/client/src/app/search/search.component.html index 3a87ea1de..82a5f0f26 100644 --- a/client/src/app/search/search.component.html +++ b/client/src/app/search/search.component.html | |||
@@ -48,7 +48,7 @@ | |||
48 | </div> | 48 | </div> |
49 | 49 | ||
50 | <div *ngIf="isVideo(result)" class="entry video"> | 50 | <div *ngIf="isVideo(result)" class="entry video"> |
51 | <my-video-thumbnail [video]="result"></my-video-thumbnail> | 51 | <my-video-thumbnail [video]="result" [nsfw]="isVideoBlur(result)"></my-video-thumbnail> |
52 | 52 | ||
53 | <div class="video-info"> | 53 | <div class="video-info"> |
54 | <a tabindex="-1" class="video-info-name" [routerLink]="['/videos/watch', result.uuid]" [attr.title]="result.name">{{ result.name }}</a> | 54 | <a tabindex="-1" class="video-info-name" [routerLink]="['/videos/watch', result.uuid]" [attr.title]="result.name">{{ result.name }}</a> |
diff --git a/client/src/app/search/search.component.scss b/client/src/app/search/search.component.scss index 3e074621b..6de13d276 100644 --- a/client/src/app/search/search.component.scss +++ b/client/src/app/search/search.component.scss | |||
@@ -87,10 +87,10 @@ | |||
87 | text-overflow: ellipsis; | 87 | text-overflow: ellipsis; |
88 | white-space: nowrap; | 88 | white-space: nowrap; |
89 | font-size: 14px; | 89 | font-size: 14px; |
90 | color: #585858; | 90 | color: $grey-foreground-color; |
91 | 91 | ||
92 | &:hover { | 92 | &:hover { |
93 | color: #303030; | 93 | color: $grey-foreground-hover-color; |
94 | } | 94 | } |
95 | } | 95 | } |
96 | } | 96 | } |
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts index 911d56843..c4a4b1fde 100644 --- a/client/src/app/search/search.component.ts +++ b/client/src/app/search/search.component.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { AuthService, RedirectService } from '@app/core' | 3 | import { AuthService, Notifier, ServerService } from '@app/core' |
4 | import { NotificationsService } from 'angular2-notifications' | ||
5 | import { forkJoin, Subscription } from 'rxjs' | 4 | import { forkJoin, Subscription } from 'rxjs' |
6 | import { SearchService } from '@app/search/search.service' | 5 | import { SearchService } from '@app/search/search.service' |
7 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 6 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' |
@@ -40,10 +39,10 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
40 | private route: ActivatedRoute, | 39 | private route: ActivatedRoute, |
41 | private router: Router, | 40 | private router: Router, |
42 | private metaService: MetaService, | 41 | private metaService: MetaService, |
43 | private redirectService: RedirectService, | 42 | private notifier: Notifier, |
44 | private notificationsService: NotificationsService, | ||
45 | private searchService: SearchService, | 43 | private searchService: SearchService, |
46 | private authService: AuthService | 44 | private authService: AuthService, |
45 | private serverService: ServerService | ||
47 | ) { } | 46 | ) { } |
48 | 47 | ||
49 | ngOnInit () { | 48 | ngOnInit () { |
@@ -69,7 +68,7 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
69 | this.search() | 68 | this.search() |
70 | }, | 69 | }, |
71 | 70 | ||
72 | err => this.notificationsService.error('Error', err.text) | 71 | err => this.notifier.error(err.text) |
73 | ) | 72 | ) |
74 | } | 73 | } |
75 | 74 | ||
@@ -77,6 +76,10 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
77 | if (this.subActivatedRoute) this.subActivatedRoute.unsubscribe() | 76 | if (this.subActivatedRoute) this.subActivatedRoute.unsubscribe() |
78 | } | 77 | } |
79 | 78 | ||
79 | isVideoBlur (video: Video) { | ||
80 | return video.isVideoNSFWForUser(this.authService.getUser(), this.serverService.getConfig()) | ||
81 | } | ||
82 | |||
80 | isVideoChannel (d: VideoChannel | Video): d is VideoChannel { | 83 | isVideoChannel (d: VideoChannel | Video): d is VideoChannel { |
81 | return d instanceof VideoChannel | 84 | return d instanceof VideoChannel |
82 | } | 85 | } |
@@ -113,9 +116,7 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
113 | this.firstSearch = false | 116 | this.firstSearch = false |
114 | }, | 117 | }, |
115 | 118 | ||
116 | error => { | 119 | err => this.notifier.error(err.message) |
117 | this.notificationsService.error(this.i18n('Error'), error.message) | ||
118 | } | ||
119 | ) | 120 | ) |
120 | 121 | ||
121 | } | 122 | } |
@@ -147,7 +148,8 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
147 | } | 148 | } |
148 | 149 | ||
149 | private updateTitle () { | 150 | private updateTitle () { |
150 | this.metaService.setTitle(this.i18n('Search') + ' ' + this.currentSearch) | 151 | const suffix = this.currentSearch ? ' ' + this.currentSearch : '' |
152 | this.metaService.setTitle(this.i18n('Search') + suffix) | ||
151 | } | 153 | } |
152 | 154 | ||
153 | private updateUrlFromAdvancedSearch () { | 155 | private updateUrlFromAdvancedSearch () { |