<div class="form-group">
<my-reactive-file
formControlName="file" inputName="addIntroFile" i18n-inputLabel inputLabel="Select the intro video file"
- [extensions]="videoExtensions" [displayFilename]="true"
- [ngbTooltip]="getIntroOutroTooltip()"
+ [extensions]="videoExtensions" [displayFilename]="true" [displayReset]="true"
+ [buttonTooltip]="getIntroOutroTooltip()"
></my-reactive-file>
</div>
</div>
<div class="form-group">
<my-reactive-file
formControlName="file" inputName="addOutroFile" i18n-inputLabel inputLabel="Select the outro video file"
- [extensions]="videoExtensions" [displayFilename]="true"
- [ngbTooltip]="getIntroOutroTooltip()"
+ [extensions]="videoExtensions" [displayFilename]="true" [displayReset]="true"
+ [buttonTooltip]="getIntroOutroTooltip()"
></my-reactive-file>
</div>
</div>
<div class="form-group">
<my-reactive-file
formControlName="file" inputName="addWatermarkFile" i18n-inputLabel inputLabel="Select watermark image file"
- [extensions]="imageExtensions" [displayFilename]="true"
- [ngbTooltip]="getWatermarkTooltip()"
+ [extensions]="imageExtensions" [displayFilename]="true" [displayReset]="true"
+ [buttonTooltip]="getWatermarkTooltip()"
></my-reactive-file>
</div>
</div>
<my-reactive-file
formControlName="captionfile" inputName="captionfile" i18n-inputLabel inputLabel="Select the caption file"
[extensions]="videoCaptionExtensions" [maxFileSize]="videoCaptionMaxSize" [displayFilename]="true"
- i18n-ngbTooltip [ngbTooltip]="'(extensions: ' + videoCaptionExtensions.join(', ') + ')'"
+ [buttonTooltip]="getReactiveFileButtonTooltip()"
></my-reactive-file>
</div>
return this.serverConfig.videoCaption.file.size.max
}
+ getReactiveFileButtonTooltip () {
+ return `(extensions: ${this.videoCaptionExtensions.join(', ')})`
+ }
+
ngOnInit () {
this.serverService.getVideoLanguages()
.subscribe(languages => this.videoCaptionLanguages = languages)
<div class="preview-container">
<my-reactive-file
[inputName]="inputName" [inputLabel]="inputLabel" [extensions]="videoImageExtensions" [maxFileSize]="maxVideoImageSize" placement="right"
- icon="edit" (fileChanged)="onFileChanged($event)" [ngbTooltip]="'(extensions: '+ videoImageExtensions +', '+ maxSizeText +': '+ maxVideoImageSizeInBytes +')'"
+ icon="edit" (fileChanged)="onFileChanged($event)" [buttonTooltip]="getReactiveFileButtonTooltip()"
></my-reactive-file>
<img *ngIf="imageSrc" [ngStyle]="{ width: previewWidth, height: previewHeight }" [src]="imageSrc" class="preview" />
return this.bytesPipe.transform(this.maxVideoImageSize)
}
+ getReactiveFileButtonTooltip () {
+ return $localize`(extensions: ${this.videoImageExtensions}, ${this.maxSizeText}: ${this.maxVideoImageSizeInBytes})`
+ }
+
ngOnInit () {
this.serverConfig = this.serverService.getHTMLConfig()
<div class="root">
- <div class="button-file" [ngClass]="{ 'with-icon': !!icon }">
+ <div class="button-file" [ngClass]="{ 'with-icon': !!icon }" [ngbTooltip]="buttonTooltip">
<my-global-icon *ngIf="icon" [iconName]="icon"></my-global-icon>
<span>{{ inputLabel }}</span>
</div>
<div class="filename" *ngIf="displayFilename === true && filename">{{ filename }}</div>
+
+ <button *ngIf="displayReset && filename" i18n class="reset-button" (click)="reset()">
+ Reset
+ </button>
</div>
font-weight: $font-semibold;
}
+
+ .reset-button {
+ @include peertube-button;
+ @include grey-button;
+
+ font-size: 80%;
+ margin-left: 5px;
+ line-height: initial;
+ padding: 2px 5px;
+ height: auto;
+ }
}
@Input() inputName: string
@Input() extensions: string[] = []
@Input() maxFileSize: number
+
@Input() displayFilename = false
+ @Input() displayReset = false
+
@Input() icon: GlobalIconName
+ @Input() buttonTooltip: string
@Output() fileChanged = new EventEmitter<Blob>()
this.file = file
this.propagateChange(this.file)
- this.fileChanged.emit(this.file)
}
+ this.fileChanged.emit(this.file)
+ }
+
+ reset () {
+ this.writeValue(undefined)
+ this.propagateChange(undefined)
+ this.fileChanged.emit(undefined)
}
propagateChange = (_: any) => { /* empty */ }