From 1e66b987cd578fc97471cc429199af453a5daba6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 31 May 2019 16:57:01 +0200 Subject: Add checkbox to bulk update videos support field --- .../my-account-video-channel-edit.component.html | 7 +++++++ .../my-account-video-channel-edit.ts | 5 +++++ .../my-account-video-channel-update.component.ts | 15 +++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) (limited to 'client/src') diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.component.html b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.component.html index 81fb11f45..f87df87df 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.component.html +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.component.html @@ -61,5 +61,12 @@ When you will upload a video in this channel, the video support field will be au +
+ +
+ diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.ts index 4dc65dd99..7479442d1 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.ts +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.ts @@ -11,4 +11,9 @@ export abstract class MyAccountVideoChannelEdit extends FormReactive { // FIXME: We need this method so angular does not complain in the child template onAvatarChange (formData: FormData) { /* empty */ } + + // Should be implemented by the child + isBulkUpdateVideosDisplayed () { + return false + } } diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts index da4fb645a..081e956d2 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts @@ -20,6 +20,7 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE videoChannelToUpdate: VideoChannel private paramsSub: Subscription + private oldSupportField: string constructor ( protected formValidatorService: FormValidatorService, @@ -39,7 +40,8 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE this.buildForm({ 'display-name': this.videoChannelValidatorsService.VIDEO_CHANNEL_DISPLAY_NAME, description: this.videoChannelValidatorsService.VIDEO_CHANNEL_DESCRIPTION, - support: this.videoChannelValidatorsService.VIDEO_CHANNEL_SUPPORT + support: this.videoChannelValidatorsService.VIDEO_CHANNEL_SUPPORT, + bulkVideosSupportUpdate: null }) this.paramsSub = this.route.params.subscribe(routeParams => { @@ -49,6 +51,8 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE videoChannelToUpdate => { this.videoChannelToUpdate = videoChannelToUpdate + this.oldSupportField = videoChannelToUpdate.support + this.form.patchValue({ 'display-name': videoChannelToUpdate.displayName, description: videoChannelToUpdate.description, @@ -72,7 +76,8 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE const videoChannelUpdate: VideoChannelUpdate = { displayName: body['display-name'], description: body.description || null, - support: body.support || null + support: body.support || null, + bulkVideosSupportUpdate: body.bulkVideosSupportUpdate || false } this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.name, videoChannelUpdate).subscribe( @@ -118,4 +123,10 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE getFormButtonTitle () { return this.i18n('Update') } + + isBulkUpdateVideosDisplayed () { + if (this.oldSupportField === undefined) return false + + return this.oldSupportField !== this.form.value['support'] + } } -- cgit v1.2.3