aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-19 16:17:54 +0200
committerChocobozzz <me@florianbigard.com>2018-07-24 14:04:05 +0200
commit57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6 (patch)
tree87ebcd623c06445b9b25a237addefc98a2d64afa /client/src/app/shared
parent7279b455811f4806dcb74a08d17b837bc22533c1 (diff)
downloadPeerTube-57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6.tar.gz
PeerTube-57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6.tar.zst
PeerTube-57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6.zip
Begin advanced search
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared.module.ts9
-rw-r--r--client/src/app/shared/video/video-miniature.component.html2
-rw-r--r--client/src/app/shared/video/video-thumbnail.component.html2
-rw-r--r--client/src/app/shared/video/video.service.ts51
4 files changed, 24 insertions, 40 deletions
diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts
index fdfb90600..99df61cdb 100644
--- a/client/src/app/shared/shared.module.ts
+++ b/client/src/app/shared/shared.module.ts
@@ -37,9 +37,14 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
37import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 37import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
38import { 38import {
39 CustomConfigValidatorsService, 39 CustomConfigValidatorsService,
40 LoginValidatorsService, ReactiveFileComponent, 40 LoginValidatorsService,
41 ReactiveFileComponent,
41 ResetPasswordValidatorsService, 42 ResetPasswordValidatorsService,
42 UserValidatorsService, VideoAbuseValidatorsService, VideoChannelValidatorsService, VideoCommentValidatorsService, VideoValidatorsService 43 UserValidatorsService,
44 VideoAbuseValidatorsService,
45 VideoChannelValidatorsService,
46 VideoCommentValidatorsService,
47 VideoValidatorsService
43} from '@app/shared/forms' 48} from '@app/shared/forms'
44import { I18nPrimengCalendarService } from '@app/shared/i18n/i18n-primeng-calendar' 49import { I18nPrimengCalendarService } from '@app/shared/i18n/i18n-primeng-calendar'
45import { ScreenService } from '@app/shared/misc/screen.service' 50import { ScreenService } from '@app/shared/misc/screen.service'
diff --git a/client/src/app/shared/video/video-miniature.component.html b/client/src/app/shared/video/video-miniature.component.html
index 20020e2a8..3010e5ccc 100644
--- a/client/src/app/shared/video/video-miniature.component.html
+++ b/client/src/app/shared/video/video-miniature.component.html
@@ -3,7 +3,7 @@
3 3
4 <div class="video-miniature-information"> 4 <div class="video-miniature-information">
5 <a 5 <a
6 class="video-miniature-name" alt="" 6 class="video-miniature-name"
7 [routerLink]="[ '/videos/watch', video.uuid ]" [attr.title]="video.name" [ngClass]="{ 'blur-filter': isVideoBlur() }" 7 [routerLink]="[ '/videos/watch', video.uuid ]" [attr.title]="video.name" [ngClass]="{ 'blur-filter': isVideoBlur() }"
8 > 8 >
9 {{ video.name }} 9 {{ video.name }}
diff --git a/client/src/app/shared/video/video-thumbnail.component.html b/client/src/app/shared/video/video-thumbnail.component.html
index 971f352ba..4909cf3f1 100644
--- a/client/src/app/shared/video/video-thumbnail.component.html
+++ b/client/src/app/shared/video/video-thumbnail.component.html
@@ -2,7 +2,7 @@
2 [routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name" 2 [routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name"
3 class="video-thumbnail" 3 class="video-thumbnail"
4> 4>
5<img [attr.src]="getImageUrl()" [ngClass]="{ 'blur-filter': nsfw }" /> 5<img alt="" [attr.src]="getImageUrl()" [ngClass]="{ 'blur-filter': nsfw }" />
6 6
7<div class="video-thumbnail-overlay"> 7<div class="video-thumbnail-overlay">
8 {{ video.durationLabel }} 8 {{ video.durationLabel }}
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index b4c1f10f9..f316d31ea 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -231,27 +231,6 @@ export class VideoService {
231 return this.buildBaseFeedUrls(params) 231 return this.buildBaseFeedUrls(params)
232 } 232 }
233 233
234 searchVideos (
235 search: string,
236 videoPagination: ComponentPagination,
237 sort: VideoSortField
238 ): Observable<{ videos: Video[], totalVideos: number }> {
239 const url = VideoService.BASE_VIDEO_URL + 'search'
240
241 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
242
243 let params = new HttpParams()
244 params = this.restService.addRestGetParams(params, pagination, sort)
245 params = params.append('search', search)
246
247 return this.authHttp
248 .get<ResultList<VideoServerModel>>(url, { params })
249 .pipe(
250 switchMap(res => this.extractVideos(res)),
251 catchError(err => this.restExtractor.handleError(err))
252 )
253 }
254
255 removeVideo (id: number) { 234 removeVideo (id: number) {
256 return this.authHttp 235 return this.authHttp
257 .delete(VideoService.BASE_VIDEO_URL + id) 236 .delete(VideoService.BASE_VIDEO_URL + id)
@@ -289,21 +268,7 @@ export class VideoService {
289 .pipe(catchError(err => this.restExtractor.handleError(err))) 268 .pipe(catchError(err => this.restExtractor.handleError(err)))
290 } 269 }
291 270
292 private setVideoRate (id: number, rateType: VideoRateType) { 271 extractVideos (result: ResultList<VideoServerModel>) {
293 const url = VideoService.BASE_VIDEO_URL + id + '/rate'
294 const body: UserVideoRateUpdate = {
295 rating: rateType
296 }
297
298 return this.authHttp
299 .put(url, body)
300 .pipe(
301 map(this.restExtractor.extractDataBool),
302 catchError(err => this.restExtractor.handleError(err))
303 )
304 }
305
306 private extractVideos (result: ResultList<VideoServerModel>) {
307 return this.serverService.localeObservable 272 return this.serverService.localeObservable
308 .pipe( 273 .pipe(
309 map(translations => { 274 map(translations => {
@@ -319,4 +284,18 @@ export class VideoService {
319 }) 284 })
320 ) 285 )
321 } 286 }
287
288 private setVideoRate (id: number, rateType: VideoRateType) {
289 const url = VideoService.BASE_VIDEO_URL + id + '/rate'
290 const body: UserVideoRateUpdate = {
291 rating: rateType
292 }
293
294 return this.authHttp
295 .put(url, body)
296 .pipe(
297 map(this.restExtractor.extractDataBool),
298 catchError(err => this.restExtractor.handleError(err))
299 )
300 }
322} 301}