Merge pull request #4200 from emanuelschuetze/config-textarea-field

Use missing textarea field for config inputtype 'text'.
This commit is contained in:
Sean 2019-01-29 10:57:40 +01:00 committed by GitHub
commit 214b74e091
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -51,11 +51,19 @@
<div class="config-form-group" *ngIf="isExcludedType(configItem.inputType)"> <div class="config-form-group" *ngIf="isExcludedType(configItem.inputType)">
<div *ngIf="configItem.inputType === 'boolean'"> <div *ngIf="configItem.inputType === 'boolean'">
<mat-checkbox formControlName="value"> {{ configItem.label | translate }} </mat-checkbox> <mat-checkbox formControlName="value">{{ configItem.label | translate }}</mat-checkbox>
<div class="hint" *ngIf="configItem.helpText && !error">{{ configItem.helpText | translate }}</div> <div class="hint" *ngIf="configItem.helpText && !error">{{ configItem.helpText | translate }}</div>
<div class="error" *ngIf="error">{{ error }}</div> <div class="error" *ngIf="error">{{ error }}</div>
</div> </div>
<!-- textarea -->
<div *ngIf="configItem.inputType === 'text'">
<mat-form-field>
<textarea rows="10" matInput placeholder="{{ configItem.label | translate }}" [value]="translatedValue"></textarea>
<div class="hint" *ngIf="configItem.helpText && !error">{{ configItem.helpText | translate }}</div>
</mat-form-field>
</div>
<!-- The editor --> <!-- The editor -->
<div *ngIf="configItem.inputType === 'markupText'"> <div *ngIf="configItem.inputType === 'markupText'">
<h4>{{ configItem.label | translate }}</h4> <h4>{{ configItem.label | translate }}</h4>

View File

@ -102,7 +102,11 @@ export class ConfigFieldComponent extends BaseComponent implements OnInit {
}); });
this.translatedValue = this.configItem.value; this.translatedValue = this.configItem.value;
if (this.configItem.inputType === 'string' || this.configItem.inputType === 'markupText') { if (
this.configItem.inputType === 'string' ||
this.configItem.inputType === 'markupText' ||
this.configItem.inputType === 'text'
) {
if (typeof this.configItem.value === 'string' && this.configItem.value !== '') { if (typeof this.configItem.value === 'string' && this.configItem.value !== '') {
this.translatedValue = this.translate.instant(this.configItem.value); this.translatedValue = this.translate.instant(this.configItem.value);
} }
@ -207,7 +211,7 @@ export class ConfigFieldComponent extends BaseComponent implements OnInit {
* @returns wheather it should be excluded or not * @returns wheather it should be excluded or not
*/ */
public isExcludedType(type: string): boolean { public isExcludedType(type: string): boolean {
const excluded = ['boolean', 'markupText']; const excluded = ['boolean', 'markupText', 'text'];
return excluded.includes(type); return excluded.includes(type);
} }
} }