From 26b7305a232e547709f433a6edf700bf495935d8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 13 Aug 2018 16:57:13 +0200 Subject: Add blacklist reason field --- .../video-abuse-list.component.html | 2 +- .../video-blacklist-list.component.html | 39 ++++++++++++++-------- .../video-blacklist-list.component.scss | 6 ++++ .../video-blacklist-list.component.ts | 18 +++++++--- 4 files changed, 47 insertions(+), 18 deletions(-) create mode 100644 client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html index 08501d872..aa0e18c70 100644 --- a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html +++ b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html @@ -9,7 +9,7 @@ - State + State Reason Reporter Created diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html index 04f0e3b5c..78989dc58 100644 --- a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html @@ -4,30 +4,43 @@ - Name - Description - Views + + Video name NSFW UUID - Created - + Date + - + - {{ videoBlacklist.name }} - {{ videoBlacklist.description }} - {{ videoBlacklist.views }} - {{ videoBlacklist.nsfw }} - {{ videoBlacklist.uuid }} + + + + + + + {{ videoBlacklist.video.name }} + {{ videoBlacklist.video.nsfw }} + {{ videoBlacklist.video.uuid }} {{ videoBlacklist.createdAt }} + - + + + + + + + + + Blacklist reason: + {{ videoBlacklist.reason }} diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss new file mode 100644 index 000000000..5265536ca --- /dev/null +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss @@ -0,0 +1,6 @@ +@import '_variables'; +@import '_mixins'; + +.blacklist-reason-label { + font-weight: $font-semibold; +} \ No newline at end of file diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts index 143ec8406..00b0ac57e 100644 --- a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts @@ -5,11 +5,12 @@ import { ConfirmService } from '../../../core' import { RestPagination, RestTable, VideoBlacklistService } from '../../../shared' import { BlacklistedVideo } from '../../../../../../shared' import { I18n } from '@ngx-translate/i18n-polyfill' +import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' @Component({ selector: 'my-video-blacklist-list', templateUrl: './video-blacklist-list.component.html', - styleUrls: [] + styleUrls: [ './video-blacklist-list.component.scss' ] }) export class VideoBlacklistListComponent extends RestTable implements OnInit { blacklist: BlacklistedVideo[] = [] @@ -18,6 +19,8 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { sort: SortMeta = { field: 'createdAt', order: 1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } + videoBlacklistActions: DropdownAction[] = [] + constructor ( private notificationsService: NotificationsService, private confirmService: ConfirmService, @@ -25,6 +28,13 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { private i18n: I18n ) { super() + + this.videoBlacklistActions = [ + { + label: this.i18n('Unblacklist'), + handler: videoBlacklist => this.removeVideoFromBlacklist(videoBlacklist) + } + ] } ngOnInit () { @@ -33,17 +43,17 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { async removeVideoFromBlacklist (entry: BlacklistedVideo) { const confirmMessage = this.i18n( - 'Do you really want to remove this video from the blacklist ? It will be available again in the videos list.' + 'Do you really want to remove this video from the blacklist? It will be available again in the videos list.' ) const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblacklist')) if (res === false) return - this.videoBlacklistService.removeVideoFromBlacklist(entry.videoId).subscribe( + this.videoBlacklistService.removeVideoFromBlacklist(entry.video.id).subscribe( () => { this.notificationsService.success( this.i18n('Success'), - this.i18n('Video {{name}} removed from the blacklist.', { name: entry.name }) + this.i18n('Video {{name}} removed from the blacklist.', { name: entry.video.name }) ) this.loadData() }, -- cgit v1.2.3