Skip to content

Commit

Permalink
Merged in bugfix/SHIBUI-1458 (pull request #418)
Browse files Browse the repository at this point in the history
SHIBUI-1458 Fixed issue with label on data list components

Approved-by: Dmitriy Kopylenko <dkopylenko@unicon.net>
  • Loading branch information
rmathis committed Nov 18, 2019
2 parents a62cc1e + 946a1a9 commit ae9452f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="widget form-group">
<label [for]="formProperty._canonicalPath" class="d-flex justify-content-between control-label">
<span [ngClass]="{'sr-only': formProperty.parent.schema.type === 'array'}">
<translate-i18n [key]="schema.title">{{ schema.title }}</translate-i18n>
<translate-i18n [key]="title">{{ title }}</translate-i18n>
<i class="fa fa-asterisk text-danger" aria-hidden="true" *ngIf="required"></i>
</span>
<span *ngIf="schema.description">
Expand All @@ -19,7 +19,7 @@
[attr.placeholder]="schema.placeholder || '' | translate"
[attr.disabled]="schema.readOnly?true:null"
role="textbox"
[attr.aria-label]="schema.title | translate">
[attr.aria-label]="title | translate">
</auto-complete>
<small class="form-text text-danger" *ngIf="errorMessages && errorMessages.length && control.touched">
<ng-container *ngFor="let error of errorMessages; let first=first;">
Expand Down
4 changes: 4 additions & 0 deletions ui/src/app/schema-form/widget/datalist/datalist.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export class DatalistComponent extends ControlWidget implements AfterViewInit {
return this.widgetService.isRequired(this.formProperty);
}

get title(): string {
return this.schema.title || this.formProperty.parent.schema.title;
}

getError(error: string): string {
return HARD_CODED_REQUIRED_MSG.test(error) ? 'message.required' : error;
}
Expand Down
3 changes: 1 addition & 2 deletions ui/src/app/schema-form/widget/select/select.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
[formControl]="control"
[attr.name]="name"
class="form-control"
[attr.aria-label]="schema.title"
[ngClass]="{'text-muted': !this.formProperty.value}">
[attr.aria-label]="schema.title">
<option selected value="">
<translate-i18n *ngIf="schema.placeholder" [key]="schema.placeholder">{{ schema.placeholder }}</translate-i18n>
<translate-i18n *ngIf="!schema.placeholder" [key]="schema.title">{{ schema.title }}</translate-i18n>
Expand Down

0 comments on commit ae9452f

Please sign in to comment.