form and radio button

This commit is contained in:
Tykayn 2022-02-15 14:04:41 +01:00 committed by tykayn
parent eb1fffb628
commit 7d0d04954c
3 changed files with 76 additions and 56 deletions

View File

@ -15,6 +15,8 @@
{{ 'LANGUAGES.' + currentLang.toUpperCase() | translate }} {{ 'LANGUAGES.' + currentLang.toUpperCase() | translate }}
</span> </span>
</button> </button>
<form action="#/administration/step/{{ pollService.step_current }}">
<p-dialog <p-dialog
[modal]="true" [modal]="true"
[(visible)]="display_lang_dialog" [(visible)]="display_lang_dialog"
@ -48,17 +50,29 @@
</h1> </h1>
<div class="list-of-langs"> <div class="list-of-langs">
<button <div *ngFor="let language of availableLanguages" (click)="language_to_apply = language">
<label
[attr.for]="'#lang_' + language"
class="lang-element button" class="lang-element button"
[ngClass]="{ 'is-primary': language_to_apply === language, 'is-current': language === currentLang }" [ngClass]="{
*ngFor="let language of availableLanguages" 'is-primary': language_to_apply === language,
value="{{ language }}" 'is-current': language === currentLang
(click)="language_to_apply = language" }"
> >
<!-- {{ language }} - --> <input
class="pull-left"
type="radio"
value="{{ language }}"
name="lang_to_apply"
lang="{{ language }}"
[(ngModel)]="language_to_apply"
[attr.id]="'#lang_' + language"
(click)="language_to_apply = language"
/>
{{ language }} - {{ language }} -
{{ 'LANGUAGES.' + language.toUpperCase() | translate }} {{ 'LANGUAGES.' + language.toUpperCase() | translate }}
</button> </label>
</div>
</div> </div>
</ng-template> </ng-template>
@ -73,4 +87,5 @@
</div> </div>
</ng-template> </ng-template>
</p-dialog> </p-dialog>
</form>
</div> </div>

View File

@ -39,9 +39,14 @@
border: 0; border: 0;
border-radius: 2rem; border-radius: 2rem;
padding: 0.5rem 0.25rem; padding: 0.5rem 0.25rem;
padding-right: 1rem;
&:hover { &:hover {
background: $d-neutral; background: $primary_color;
color: $white;
}
input {
height: 1.5rem;
} }
} }

View File

@ -17,7 +17,7 @@ export class LanguageSelectorComponent implements OnInit {
public availableLanguages: any = ['FR', 'EN', 'ES']; public availableLanguages: any = ['FR', 'EN', 'ES'];
language: string; language: string;
language_to_apply: string; language_to_apply: string;
display_lang_dialog: boolean = false; display_lang_dialog: boolean = true;
constructor( constructor(
private languageService: LanguageService, private languageService: LanguageService,