diff options
Diffstat (limited to 'client/src/app/shared/video')
7 files changed, 104 insertions, 1 deletions
diff --git a/client/src/app/shared/video/abstract-video-list.html b/client/src/app/shared/video/abstract-video-list.html index 94a38019d..cb04e07b4 100644 --- a/client/src/app/shared/video/abstract-video-list.html +++ b/client/src/app/shared/video/abstract-video-list.html | |||
@@ -2,9 +2,9 @@ | |||
2 | <div class="title-page title-page-single"> | 2 | <div class="title-page title-page-single"> |
3 | {{ titlePage }} | 3 | {{ titlePage }} |
4 | </div> | 4 | </div> |
5 | <my-video-feed [syndicationItems]="syndicationItems"></my-video-feed> | ||
5 | 6 | ||
6 | <div *ngIf="pagination.totalItems === 0">No results.</div> | 7 | <div *ngIf="pagination.totalItems === 0">No results.</div> |
7 | |||
8 | <div | 8 | <div |
9 | myInfiniteScroller | 9 | myInfiniteScroller |
10 | [pageHeight]="pageHeight" | 10 | [pageHeight]="pageHeight" |
diff --git a/client/src/app/shared/video/abstract-video-list.scss b/client/src/app/shared/video/abstract-video-list.scss index 63538a089..b75907dc9 100644 --- a/client/src/app/shared/video/abstract-video-list.scss +++ b/client/src/app/shared/video/abstract-video-list.scss | |||
@@ -1,3 +1,5 @@ | |||
1 | @import '_mixins'; | ||
2 | |||
1 | .videos { | 3 | .videos { |
2 | text-align: center; | 4 | text-align: center; |
3 | 5 | ||
@@ -6,6 +8,11 @@ | |||
6 | } | 8 | } |
7 | } | 9 | } |
8 | 10 | ||
11 | my-video-feed { | ||
12 | display: inline-block; | ||
13 | margin-left: -45px; | ||
14 | } | ||
15 | |||
9 | @media screen and (max-width: 500px) { | 16 | @media screen and (max-width: 500px) { |
10 | .videos { | 17 | .videos { |
11 | text-align: center; | 18 | text-align: center; |
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 1b9a519bd..024834dfc 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts | |||
@@ -3,6 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
3 | import { isInMobileView } from '@app/shared/misc/utils' | 3 | import { isInMobileView } from '@app/shared/misc/utils' |
4 | import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' | 4 | import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' |
5 | import { NotificationsService } from 'angular2-notifications' | 5 | import { NotificationsService } from 'angular2-notifications' |
6 | import { PopoverModule } from 'ngx-bootstrap/popover' | ||
6 | import 'rxjs/add/operator/debounceTime' | 7 | import 'rxjs/add/operator/debounceTime' |
7 | import { Observable } from 'rxjs/Observable' | 8 | import { Observable } from 'rxjs/Observable' |
8 | import { fromEvent } from 'rxjs/observable/fromEvent' | 9 | import { fromEvent } from 'rxjs/observable/fromEvent' |
@@ -11,6 +12,8 @@ import { AuthService } from '../../core/auth' | |||
11 | import { ComponentPagination } from '../rest/component-pagination.model' | 12 | import { ComponentPagination } from '../rest/component-pagination.model' |
12 | import { SortField } from './sort-field.type' | 13 | import { SortField } from './sort-field.type' |
13 | import { Video } from './video.model' | 14 | import { Video } from './video.model' |
15 | import { FeedFormat } from '../../../../../shared' | ||
16 | import { VideoFeedComponent } from '@app/shared/video/video-feed.component' | ||
14 | 17 | ||
15 | export abstract class AbstractVideoList implements OnInit, OnDestroy { | 18 | export abstract class AbstractVideoList implements OnInit, OnDestroy { |
16 | private static LINES_PER_PAGE = 4 | 19 | private static LINES_PER_PAGE = 4 |
@@ -25,6 +28,8 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
25 | } | 28 | } |
26 | sort: SortField = '-createdAt' | 29 | sort: SortField = '-createdAt' |
27 | defaultSort: SortField = '-createdAt' | 30 | defaultSort: SortField = '-createdAt' |
31 | syndicationItems = {} | ||
32 | |||
28 | loadOnInit = true | 33 | loadOnInit = true |
29 | pageHeight: number | 34 | pageHeight: number |
30 | videoWidth: number | 35 | videoWidth: number |
@@ -47,6 +52,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
47 | private resizeSubscription: Subscription | 52 | private resizeSubscription: Subscription |
48 | 53 | ||
49 | abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> | 54 | abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> |
55 | abstract generateSyndicationList () | ||
50 | 56 | ||
51 | get user () { | 57 | get user () { |
52 | return this.authService.getUser() | 58 | return this.authService.getUser() |
diff --git a/client/src/app/shared/video/video-feed.component.html b/client/src/app/shared/video/video-feed.component.html new file mode 100644 index 000000000..7733ef221 --- /dev/null +++ b/client/src/app/shared/video/video-feed.component.html | |||
@@ -0,0 +1,14 @@ | |||
1 | <div class="video-feed"> | ||
2 | <span *ngIf="(syndicationItems | myObjectLength) >= 1" class="icon icon-syndication" | ||
3 | [popover]="feedsList" | ||
4 | placement="bottom" | ||
5 | [outsideClick]="true"> | ||
6 | </span> | ||
7 | |||
8 | <ng-template #feedsList> | ||
9 | <div *ngFor="let key of syndicationItems | keys"> | ||
10 | <a [href]="syndicationItems[key]">{{ key }}</a> | ||
11 | </div> | ||
12 | </ng-template> | ||
13 | </div> | ||
14 | \ No newline at end of file | ||
diff --git a/client/src/app/shared/video/video-feed.component.scss b/client/src/app/shared/video/video-feed.component.scss new file mode 100644 index 000000000..2efeb405e --- /dev/null +++ b/client/src/app/shared/video/video-feed.component.scss | |||
@@ -0,0 +1,19 @@ | |||
1 | @import '_mixins'; | ||
2 | |||
3 | .video-feed { | ||
4 | a { | ||
5 | @include disable-default-a-behaviour; | ||
6 | |||
7 | color: black; | ||
8 | } | ||
9 | |||
10 | .icon { | ||
11 | @include icon(12px); | ||
12 | |||
13 | &.icon-syndication { | ||
14 | position: relative; | ||
15 | top: -2px; | ||
16 | background-image: url('../../../assets/images/global/syndication.svg'); | ||
17 | } | ||
18 | } | ||
19 | } \ No newline at end of file | ||
diff --git a/client/src/app/shared/video/video-feed.component.ts b/client/src/app/shared/video/video-feed.component.ts new file mode 100644 index 000000000..41257ca99 --- /dev/null +++ b/client/src/app/shared/video/video-feed.component.ts | |||
@@ -0,0 +1,14 @@ | |||
1 | import { Component, Input, OnChanges, SimpleChanges } from '@angular/core' | ||
2 | |||
3 | @Component({ | ||
4 | selector: 'my-video-feed', | ||
5 | styleUrls: [ './video-feed.component.scss' ], | ||
6 | templateUrl: './video-feed.component.html' | ||
7 | }) | ||
8 | export class VideoFeedComponent implements OnChanges { | ||
9 | @Input() syndicationItems | ||
10 | |||
11 | ngOnChanges (changes: SimpleChanges) { | ||
12 | this.syndicationItems = changes.syndicationItems.currentValue | ||
13 | } | ||
14 | } | ||
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 0a8894fd9..009155410 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -8,6 +8,7 @@ import { ResultList } from '../../../../../shared/models/result-list.model' | |||
8 | import { UserVideoRateUpdate } from '../../../../../shared/models/videos/user-video-rate-update.model' | 8 | import { UserVideoRateUpdate } from '../../../../../shared/models/videos/user-video-rate-update.model' |
9 | import { UserVideoRate } from '../../../../../shared/models/videos/user-video-rate.model' | 9 | import { UserVideoRate } from '../../../../../shared/models/videos/user-video-rate.model' |
10 | import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' | 10 | import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' |
11 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' | ||
11 | import { VideoRateType } from '../../../../../shared/models/videos/video-rate.type' | 12 | import { VideoRateType } from '../../../../../shared/models/videos/video-rate.type' |
12 | import { VideoUpdate } from '../../../../../shared/models/videos/video-update.model' | 13 | import { VideoUpdate } from '../../../../../shared/models/videos/video-update.model' |
13 | import { environment } from '../../../environments/environment' | 14 | import { environment } from '../../../environments/environment' |
@@ -24,6 +25,7 @@ import { objectToFormData } from '@app/shared/misc/utils' | |||
24 | @Injectable() | 25 | @Injectable() |
25 | export class VideoService { | 26 | export class VideoService { |
26 | private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/' | 27 | private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/' |
28 | private static BASE_FEEDS_URL = environment.apiUrl + '/feeds/videos.' | ||
27 | 29 | ||
28 | constructor ( | 30 | constructor ( |
29 | private authHttp: HttpClient, | 31 | private authHttp: HttpClient, |
@@ -115,6 +117,47 @@ export class VideoService { | |||
115 | .catch((res) => this.restExtractor.handleError(res)) | 117 | .catch((res) => this.restExtractor.handleError(res)) |
116 | } | 118 | } |
117 | 119 | ||
120 | baseFeed () { | ||
121 | const feed = {} | ||
122 | |||
123 | for (let item in FeedFormat) { | ||
124 | feed[FeedFormat[item]] = VideoService.BASE_FEEDS_URL + item.toLowerCase() | ||
125 | } | ||
126 | |||
127 | return feed | ||
128 | } | ||
129 | |||
130 | getFeed ( | ||
131 | filter?: VideoFilter | ||
132 | ) { | ||
133 | let params = this.restService.addRestGetParams(new HttpParams()) | ||
134 | const feed = this.baseFeed() | ||
135 | |||
136 | if (filter) { | ||
137 | params = params.set('filter', filter) | ||
138 | } | ||
139 | for (let item in feed) { | ||
140 | feed[item] = feed[item] + ((params.toString().length === 0) ? '' : '?') + params.toString() | ||
141 | } | ||
142 | |||
143 | return feed | ||
144 | } | ||
145 | |||
146 | getAccountFeed ( | ||
147 | accountId: number, | ||
148 | host?: string | ||
149 | ) { | ||
150 | let params = this.restService.addRestGetParams(new HttpParams()) | ||
151 | const feed = this.baseFeed() | ||
152 | |||
153 | params = params.set('accountId', accountId.toString()) | ||
154 | for (let item in feed) { | ||
155 | feed[item] = feed[item] + ((params.toString().length === 0) ? '' : '?') + params.toString() | ||
156 | } | ||
157 | |||
158 | return feed | ||
159 | } | ||
160 | |||
118 | searchVideos ( | 161 | searchVideos ( |
119 | search: string, | 162 | search: string, |
120 | videoPagination: ComponentPagination, | 163 | videoPagination: ComponentPagination, |