diff options
Diffstat (limited to 'client/src/app/shared/video/abstract-video-list.ts')
-rw-r--r-- | client/src/app/shared/video/abstract-video-list.ts | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 763791165..b0633be4a 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts | |||
@@ -3,7 +3,6 @@ import { ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core' | |||
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { Location } from '@angular/common' | 4 | import { Location } from '@angular/common' |
5 | import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' | 5 | import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' |
6 | import { NotificationsService } from 'angular2-notifications' | ||
7 | import { fromEvent, Observable, Subscription } from 'rxjs' | 6 | import { fromEvent, Observable, Subscription } from 'rxjs' |
8 | import { AuthService } from '../../core/auth' | 7 | import { AuthService } from '../../core/auth' |
9 | import { ComponentPagination } from '../rest/component-pagination.model' | 8 | import { ComponentPagination } from '../rest/component-pagination.model' |
@@ -12,6 +11,8 @@ import { Video } from './video.model' | |||
12 | import { I18n } from '@ngx-translate/i18n-polyfill' | 11 | import { I18n } from '@ngx-translate/i18n-polyfill' |
13 | import { ScreenService } from '@app/shared/misc/screen.service' | 12 | import { ScreenService } from '@app/shared/misc/screen.service' |
14 | import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' | 13 | import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' |
14 | import { Syndication } from '@app/shared/video/syndication.model' | ||
15 | import { Notifier } from '@app/core' | ||
15 | 16 | ||
16 | export abstract class AbstractVideoList implements OnInit, OnDestroy { | 17 | export abstract class AbstractVideoList implements OnInit, OnDestroy { |
17 | private static LINES_PER_PAGE = 4 | 18 | private static LINES_PER_PAGE = 4 |
@@ -27,7 +28,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
27 | sort: VideoSortField = '-publishedAt' | 28 | sort: VideoSortField = '-publishedAt' |
28 | categoryOneOf?: number | 29 | categoryOneOf?: number |
29 | defaultSort: VideoSortField = '-publishedAt' | 30 | defaultSort: VideoSortField = '-publishedAt' |
30 | syndicationItems = [] | 31 | syndicationItems: Syndication[] = [] |
31 | 32 | ||
32 | loadOnInit = true | 33 | loadOnInit = true |
33 | marginContent = true | 34 | marginContent = true |
@@ -37,11 +38,13 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
37 | videoPages: Video[][] = [] | 38 | videoPages: Video[][] = [] |
38 | ownerDisplayType: OwnerDisplayType = 'account' | 39 | ownerDisplayType: OwnerDisplayType = 'account' |
39 | firstLoadedPage: number | 40 | firstLoadedPage: number |
41 | displayModerationBlock = false | ||
42 | titleTooltip: string | ||
40 | 43 | ||
41 | protected baseVideoWidth = 215 | 44 | protected baseVideoWidth = 215 |
42 | protected baseVideoHeight = 205 | 45 | protected baseVideoHeight = 205 |
43 | 46 | ||
44 | protected abstract notificationsService: NotificationsService | 47 | protected abstract notifier: Notifier |
45 | protected abstract authService: AuthService | 48 | protected abstract authService: AuthService |
46 | protected abstract router: Router | 49 | protected abstract router: Router |
47 | protected abstract route: ActivatedRoute | 50 | protected abstract route: ActivatedRoute |
@@ -58,7 +61,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
58 | private resizeSubscription: Subscription | 61 | private resizeSubscription: Subscription |
59 | 62 | ||
60 | abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> | 63 | abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> |
61 | abstract generateSyndicationList () | 64 | abstract generateSyndicationList (): void |
62 | 65 | ||
63 | get user () { | 66 | get user () { |
64 | return this.authService.getUser() | 67 | return this.authService.getUser() |
@@ -155,11 +158,15 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
155 | }, | 158 | }, |
156 | error => { | 159 | error => { |
157 | this.loadingPage[page] = false | 160 | this.loadingPage[page] = false |
158 | this.notificationsService.error(this.i18n('Error'), error.message) | 161 | this.notifier.error(error.message) |
159 | } | 162 | } |
160 | ) | 163 | ) |
161 | } | 164 | } |
162 | 165 | ||
166 | toggleModerationDisplay () { | ||
167 | throw new Error('toggleModerationDisplay is not implemented') | ||
168 | } | ||
169 | |||
163 | protected hasMoreVideos () { | 170 | protected hasMoreVideos () { |
164 | // No results | 171 | // No results |
165 | if (this.pagination.totalItems === 0) return false | 172 | if (this.pagination.totalItems === 0) return false |
@@ -206,7 +213,9 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
206 | protected setNewRouteParams () { | 213 | protected setNewRouteParams () { |
207 | const paramsObject = this.buildRouteParams() | 214 | const paramsObject = this.buildRouteParams() |
208 | 215 | ||
209 | const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&') | 216 | const queryParams = Object.keys(paramsObject) |
217 | .map(p => p + '=' + paramsObject[p]) | ||
218 | .join('&') | ||
210 | this.location.replaceState(this.currentRoute, queryParams) | 219 | this.location.replaceState(this.currentRoute, queryParams) |
211 | } | 220 | } |
212 | 221 | ||