From 017c3dcadf71aef4c1a854e4867b77931747f06e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 10 Oct 2018 14:35:55 +0200 Subject: Add ability to list all local videos on client --- client/src/app/videos/video-list/video-local.component.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'client/src/app/videos/video-list') diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts index c91c639ca..9d000cf2e 100644 --- a/client/src/app/videos/video-list/video-local.component.ts +++ b/client/src/app/videos/video-list/video-local.component.ts @@ -10,6 +10,7 @@ import { VideoService } from '../../shared/video/video.service' import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' import { I18n } from '@ngx-translate/i18n-polyfill' import { ScreenService } from '@app/shared/misc/screen.service' +import { UserRight } from '../../../../../shared/models/users' @Component({ selector: 'my-videos-local', @@ -40,6 +41,11 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On ngOnInit () { super.ngOnInit() + if (this.authService.isLoggedIn()) { + const user = this.authService.getUser() + this.displayModerationBlock = user.hasRight(UserRight.SEE_ALL_VIDEOS) + } + this.generateSyndicationList() } @@ -56,4 +62,10 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On generateSyndicationList () { this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter, this.categoryOneOf) } + + toggleModerationDisplay () { + this.filter = this.filter === 'local' ? 'all-local' as 'all-local' : 'local' as 'local' + + this.reloadVideos() + } } -- cgit v1.2.3 From f8b2c1b4f509c037b9650cca2c5befd21f056df3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 19 Dec 2018 16:04:34 +0100 Subject: Refractor notification service Shorter name and use primeng component --- client/src/app/videos/video-list/video-local.component.ts | 4 ++-- client/src/app/videos/video-list/video-overview.component.ts | 10 +++------- .../app/videos/video-list/video-recently-added.component.ts | 4 ++-- client/src/app/videos/video-list/video-trending.component.ts | 4 ++-- .../videos/video-list/video-user-subscriptions.component.ts | 4 ++-- 5 files changed, 11 insertions(+), 15 deletions(-) (limited to 'client/src/app/videos/video-list') diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts index 9d000cf2e..c0be4b885 100644 --- a/client/src/app/videos/video-list/video-local.component.ts +++ b/client/src/app/videos/video-list/video-local.component.ts @@ -2,7 +2,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { immutableAssign } from '@app/shared/misc/utils' import { Location } from '@angular/common' -import { NotificationsService } from 'angular2-notifications' import { AuthService } from '../../core/auth' import { AbstractVideoList } from '../../shared/video/abstract-video-list' import { VideoSortField } from '../../shared/video/sort-field.type' @@ -11,6 +10,7 @@ import { VideoFilter } from '../../../../../shared/models/videos/video-query.typ import { I18n } from '@ngx-translate/i18n-polyfill' import { ScreenService } from '@app/shared/misc/screen.service' import { UserRight } from '../../../../../shared/models/users' +import { Notifier } from '@app/core' @Component({ selector: 'my-videos-local', @@ -26,7 +26,7 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On constructor ( protected router: Router, protected route: ActivatedRoute, - protected notificationsService: NotificationsService, + protected notifier: Notifier, protected authService: AuthService, protected location: Location, protected i18n: I18n, diff --git a/client/src/app/videos/video-list/video-overview.component.ts b/client/src/app/videos/video-list/video-overview.component.ts index 2c6054721..7ff52b259 100644 --- a/client/src/app/videos/video-list/video-overview.component.ts +++ b/client/src/app/videos/video-list/video-overview.component.ts @@ -1,6 +1,5 @@ import { Component, OnInit } from '@angular/core' -import { AuthService } from '@app/core' -import { NotificationsService } from 'angular2-notifications' +import { AuthService, Notifier } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' import { VideosOverview } from '@app/shared/overview/videos-overview.model' import { OverviewService } from '@app/shared/overview' @@ -21,7 +20,7 @@ export class VideoOverviewComponent implements OnInit { constructor ( private i18n: I18n, - private notificationsService: NotificationsService, + private notifier: Notifier, private authService: AuthService, private overviewService: OverviewService ) { } @@ -43,10 +42,7 @@ export class VideoOverviewComponent implements OnInit { ) this.notResults = true }, - err => { - console.log(err) - this.notificationsService.error('Error', err.text) - } + err => this.notifier.error(err.message) ) } diff --git a/client/src/app/videos/video-list/video-recently-added.component.ts b/client/src/app/videos/video-list/video-recently-added.component.ts index ac1fcfff3..f99c8abb6 100644 --- a/client/src/app/videos/video-list/video-recently-added.component.ts +++ b/client/src/app/videos/video-list/video-recently-added.component.ts @@ -2,13 +2,13 @@ import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { Location } from '@angular/common' import { immutableAssign } from '@app/shared/misc/utils' -import { NotificationsService } from 'angular2-notifications' import { AuthService } from '../../core/auth' import { AbstractVideoList } from '../../shared/video/abstract-video-list' import { VideoSortField } from '../../shared/video/sort-field.type' import { VideoService } from '../../shared/video/video.service' import { I18n } from '@ngx-translate/i18n-polyfill' import { ScreenService } from '@app/shared/misc/screen.service' +import { Notifier } from '@app/core' @Component({ selector: 'my-videos-recently-added', @@ -24,7 +24,7 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On protected router: Router, protected route: ActivatedRoute, protected location: Location, - protected notificationsService: NotificationsService, + protected notifier: Notifier, protected authService: AuthService, protected i18n: I18n, protected screenService: ScreenService, diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts index 8f3d3842b..accc5bfe5 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts @@ -2,13 +2,13 @@ import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { Location } from '@angular/common' import { immutableAssign } from '@app/shared/misc/utils' -import { NotificationsService } from 'angular2-notifications' import { AuthService } from '../../core/auth' import { AbstractVideoList } from '../../shared/video/abstract-video-list' import { VideoSortField } from '../../shared/video/sort-field.type' import { VideoService } from '../../shared/video/video.service' import { I18n } from '@ngx-translate/i18n-polyfill' import { ScreenService } from '@app/shared/misc/screen.service' +import { Notifier } from '@app/core' @Component({ selector: 'my-videos-trending', @@ -23,7 +23,7 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, constructor ( protected router: Router, protected route: ActivatedRoute, - protected notificationsService: NotificationsService, + protected notifier: Notifier, protected authService: AuthService, protected location: Location, protected screenService: ScreenService, diff --git a/client/src/app/videos/video-list/video-user-subscriptions.component.ts b/client/src/app/videos/video-list/video-user-subscriptions.component.ts index 6e8959c54..bee828e12 100644 --- a/client/src/app/videos/video-list/video-user-subscriptions.component.ts +++ b/client/src/app/videos/video-list/video-user-subscriptions.component.ts @@ -2,7 +2,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { immutableAssign } from '@app/shared/misc/utils' import { Location } from '@angular/common' -import { NotificationsService } from 'angular2-notifications' import { AuthService } from '../../core/auth' import { AbstractVideoList } from '../../shared/video/abstract-video-list' import { VideoSortField } from '../../shared/video/sort-field.type' @@ -10,6 +9,7 @@ import { VideoService } from '../../shared/video/video.service' import { I18n } from '@ngx-translate/i18n-polyfill' import { ScreenService } from '@app/shared/misc/screen.service' import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' +import { Notifier } from '@app/core' @Component({ selector: 'my-videos-user-subscriptions', @@ -25,7 +25,7 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement constructor ( protected router: Router, protected route: ActivatedRoute, - protected notificationsService: NotificationsService, + protected notifier: Notifier, protected authService: AuthService, protected location: Location, protected i18n: I18n, -- cgit v1.2.3 From 9b4b15f91c485f9a7fe2ed314b4101f4b7506b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20B=C3=A9ranger?= <43744761+auberanger@users.noreply.github.com> Date: Mon, 14 Jan 2019 09:06:48 +0100 Subject: WIP : Indicate to users how "trending" works (#1458) * Get the INTERVAL_DAYS const in the video-trending component * Change Trending section title * Add a tooltip to explain how trending section works * Minor CSS fix for the my-feed popover next to the titlepage --- client/src/app/videos/video-list/video-trending.component.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'client/src/app/videos/video-list') diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts index accc5bfe5..d3c0f5316 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts @@ -8,7 +8,7 @@ import { VideoSortField } from '../../shared/video/sort-field.type' import { VideoService } from '../../shared/video/video.service' import { I18n } from '@ngx-translate/i18n-polyfill' import { ScreenService } from '@app/shared/misc/screen.service' -import { Notifier } from '@app/core' +import { Notifier, ServerService } from '@app/core' @Component({ selector: 'my-videos-trending', @@ -19,6 +19,7 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, titlePage: string currentRoute = '/videos/trending' defaultSort: VideoSortField = '-trending' + trendingDays: number constructor ( protected router: Router, @@ -27,12 +28,19 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, protected authService: AuthService, protected location: Location, protected screenService: ScreenService, + private serverService: ServerService, protected i18n: I18n, private videoService: VideoService ) { super() - this.titlePage = i18n('Trending') + this.trendingDays = this.serverService.getConfig().trending.videos.intervalDays + + this.titlePage = this.i18n('Trending for the last ') + this.trendingDays === 1 ? this.titlePage += '24 hours' : this.titlePage += this.trendingDays + ' days' + + this.titleTooltip = this.i18n('trending videos are those totalizing the greatest number of views during the last ') + this.trendingDays === 1 ? this.titleTooltip += '24 hours.' : this.titleTooltip += this.trendingDays + ' days.' } ngOnInit () { -- cgit v1.2.3 From 7b95f31385eca59ac18197539de30268acc18986 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Jan 2019 09:11:28 +0100 Subject: Help translators to translate trending title/tooltip --- .../videos/video-list/video-trending.component.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'client/src/app/videos/video-list') diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts index d3c0f5316..881ab2174 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts @@ -19,7 +19,6 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, titlePage: string currentRoute = '/videos/trending' defaultSort: VideoSortField = '-trending' - trendingDays: number constructor ( protected router: Router, @@ -33,20 +32,25 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, private videoService: VideoService ) { super() - - this.trendingDays = this.serverService.getConfig().trending.videos.intervalDays - - this.titlePage = this.i18n('Trending for the last ') - this.trendingDays === 1 ? this.titlePage += '24 hours' : this.titlePage += this.trendingDays + ' days' - - this.titleTooltip = this.i18n('trending videos are those totalizing the greatest number of views during the last ') - this.trendingDays === 1 ? this.titleTooltip += '24 hours.' : this.titleTooltip += this.trendingDays + ' days.' } ngOnInit () { super.ngOnInit() this.generateSyndicationList() + + const trendingDays = this.serverService.getConfig().trending.videos.intervalDays + + if (trendingDays === 1) { + this.titlePage = this.i18n('Trending for the last 24 hours') + this.titleTooltip = this.i18n('Trending videos are those totalizing the greatest number of views during the last 24 hours.') + } else { + this.titlePage = this.i18n('Trending for the last {{days}} days', { days: trendingDays }) + this.titleTooltip = this.i18n( + 'Trending videos are those totalizing the greatest number of views during the last {{days}} days.', + { days: trendingDays } + ) + } } ngOnDestroy () { -- cgit v1.2.3 From 572b8e02e258bfa921032dee593d3c2f129852b6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 21 Jan 2019 17:11:21 +0100 Subject: Fix trending days display on first load --- .../videos/video-list/video-trending.component.ts | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'client/src/app/videos/video-list') diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts index 881ab2174..6fd74e67a 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts @@ -39,18 +39,21 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, this.generateSyndicationList() - const trendingDays = this.serverService.getConfig().trending.videos.intervalDays + this.serverService.configLoaded.subscribe( + () => { + const trendingDays = this.serverService.getConfig().trending.videos.intervalDays - if (trendingDays === 1) { - this.titlePage = this.i18n('Trending for the last 24 hours') - this.titleTooltip = this.i18n('Trending videos are those totalizing the greatest number of views during the last 24 hours.') - } else { - this.titlePage = this.i18n('Trending for the last {{days}} days', { days: trendingDays }) - this.titleTooltip = this.i18n( - 'Trending videos are those totalizing the greatest number of views during the last {{days}} days.', - { days: trendingDays } - ) - } + if (trendingDays === 1) { + this.titlePage = this.i18n('Trending for the last 24 hours') + this.titleTooltip = this.i18n('Trending videos are those totalizing the greatest number of views during the last 24 hours.') + } else { + this.titlePage = this.i18n('Trending for the last {{days}} days', { days: trendingDays }) + this.titleTooltip = this.i18n( + 'Trending videos are those totalizing the greatest number of views during the last {{days}} days.', + { days: trendingDays } + ) + } + }) } ngOnDestroy () { -- cgit v1.2.3