Add checkbox to bulk update videos support field
This commit is contained in:
parent
7d14d4d2ca
commit
1e66b987cd
|
@ -61,5 +61,12 @@ When you will upload a video in this channel, the video support field will be au
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group" *ngIf="isBulkUpdateVideosDisplayed()">
|
||||||
|
<my-peertube-checkbox
|
||||||
|
inputName="bulkVideosSupportUpdate" formControlName="bulkVideosSupportUpdate"
|
||||||
|
i18n-labelText labelText="Overwrite support field of all videos of this channel"
|
||||||
|
></my-peertube-checkbox>
|
||||||
|
</div>
|
||||||
|
|
||||||
<input type="submit" value="{{ getFormButtonTitle() }}" [disabled]="!form.valid">
|
<input type="submit" value="{{ getFormButtonTitle() }}" [disabled]="!form.valid">
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -11,4 +11,9 @@ export abstract class MyAccountVideoChannelEdit extends FormReactive {
|
||||||
|
|
||||||
// FIXME: We need this method so angular does not complain in the child template
|
// FIXME: We need this method so angular does not complain in the child template
|
||||||
onAvatarChange (formData: FormData) { /* empty */ }
|
onAvatarChange (formData: FormData) { /* empty */ }
|
||||||
|
|
||||||
|
// Should be implemented by the child
|
||||||
|
isBulkUpdateVideosDisplayed () {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE
|
||||||
videoChannelToUpdate: VideoChannel
|
videoChannelToUpdate: VideoChannel
|
||||||
|
|
||||||
private paramsSub: Subscription
|
private paramsSub: Subscription
|
||||||
|
private oldSupportField: string
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
protected formValidatorService: FormValidatorService,
|
protected formValidatorService: FormValidatorService,
|
||||||
|
@ -39,7 +40,8 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE
|
||||||
this.buildForm({
|
this.buildForm({
|
||||||
'display-name': this.videoChannelValidatorsService.VIDEO_CHANNEL_DISPLAY_NAME,
|
'display-name': this.videoChannelValidatorsService.VIDEO_CHANNEL_DISPLAY_NAME,
|
||||||
description: this.videoChannelValidatorsService.VIDEO_CHANNEL_DESCRIPTION,
|
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 => {
|
this.paramsSub = this.route.params.subscribe(routeParams => {
|
||||||
|
@ -49,6 +51,8 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE
|
||||||
videoChannelToUpdate => {
|
videoChannelToUpdate => {
|
||||||
this.videoChannelToUpdate = videoChannelToUpdate
|
this.videoChannelToUpdate = videoChannelToUpdate
|
||||||
|
|
||||||
|
this.oldSupportField = videoChannelToUpdate.support
|
||||||
|
|
||||||
this.form.patchValue({
|
this.form.patchValue({
|
||||||
'display-name': videoChannelToUpdate.displayName,
|
'display-name': videoChannelToUpdate.displayName,
|
||||||
description: videoChannelToUpdate.description,
|
description: videoChannelToUpdate.description,
|
||||||
|
@ -72,7 +76,8 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE
|
||||||
const videoChannelUpdate: VideoChannelUpdate = {
|
const videoChannelUpdate: VideoChannelUpdate = {
|
||||||
displayName: body['display-name'],
|
displayName: body['display-name'],
|
||||||
description: body.description || null,
|
description: body.description || null,
|
||||||
support: body.support || null
|
support: body.support || null,
|
||||||
|
bulkVideosSupportUpdate: body.bulkVideosSupportUpdate || false
|
||||||
}
|
}
|
||||||
|
|
||||||
this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.name, videoChannelUpdate).subscribe(
|
this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.name, videoChannelUpdate).subscribe(
|
||||||
|
@ -118,4 +123,10 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE
|
||||||
getFormButtonTitle () {
|
getFormButtonTitle () {
|
||||||
return this.i18n('Update')
|
return this.i18n('Update')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isBulkUpdateVideosDisplayed () {
|
||||||
|
if (this.oldSupportField === undefined) return false
|
||||||
|
|
||||||
|
return this.oldSupportField !== this.form.value['support']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue