Merge pull request #3253 from alfonso-salces/MOBILE-3833

MOBILE-3833 mod-quiz: show eye in password input
main
Dani Palou 2022-04-19 11:25:38 +02:00 committed by GitHub
commit 29b01837c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 5 deletions

View File

@ -63,7 +63,7 @@
[attr.aria-label]="'core.question.incorrect' | translate"></ion-icon> [attr.aria-label]="'core.question.incorrect' | translate"></ion-icon>
</ion-item> </ion-item>
<ion-button *ngIf="!multiQuestion.disabled" class="ion-text-wrap ion-margin-top" expand="block" fill="outline" <ion-button *ngIf="!multiQuestion.disabled" class="ion-text-wrap ion-margin-top" expand="block" fill="outline"
[disabled]="!multiQuestion.singleChoiceModel" (click)="clear()" type="reset"> [disabled]="!multiQuestion.singleChoiceModel" (click)="clear()" type="button">
{{ 'addon.mod_quiz.clearchoice' | translate }} {{ 'addon.mod_quiz.clearchoice' | translate }}
</ion-button> </ion-button>

View File

@ -1,6 +1,5 @@
<ng-content></ng-content> <ng-content></ng-content>
<ion-button fill="clear" [attr.aria-label]="label | translate" core-suppress-events (onClick)="toggle($event)" <ion-button fill="clear" [attr.aria-label]="label | translate" core-suppress-events (onClick)="toggle($event)"
(mousedown)="doNotBlur($event)" (keydown)="doNotBlur($event)" (keyup)="toggle($event)"> (mousedown)="doNotBlur($event)" (keydown)="doNotBlur($event)" (keyup)="toggle($event)">
<ion-icon [name]=" iconName" slot="icon-only" aria-hidden="true"> <ion-icon [name]="shown ? 'fas-eye-slash' : 'fas-eye'" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-icon>
</ion-button> </ion-button>

View File

@ -46,7 +46,6 @@ export class CoreShowPasswordComponent implements OnInit, AfterViewInit {
shown = false; // Whether the password is shown. shown = false; // Whether the password is shown.
label = ''; // Label for the button to show/hide. label = ''; // Label for the button to show/hide.
iconName = ''; // Name of the icon of the button to show/hide.
protected input?: HTMLInputElement; // Input affected. protected input?: HTMLInputElement; // Input affected.
protected element: HTMLElement; // Current element. protected element: HTMLElement; // Current element.
@ -99,7 +98,6 @@ export class CoreShowPasswordComponent implements OnInit, AfterViewInit {
*/ */
protected setData(input: HTMLInputElement): void { protected setData(input: HTMLInputElement): void {
this.label = this.shown ? 'core.hide' : 'core.show'; this.label = this.shown ? 'core.hide' : 'core.show';
this.iconName = this.shown ? 'fas-eye-slash' : 'fas-eye';
input.type = this.shown ? 'text' : 'password'; input.type = this.shown ? 'text' : 'password';
} }