mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
next lang select on click on icon
This commit is contained in:
parent
71d139f177
commit
422090e997
@ -124,7 +124,6 @@ export class DayListComponent {
|
||||
});
|
||||
|
||||
// this.cd.detectChanges();
|
||||
console.log('this.choices.length', this.storageService.dateList.length);
|
||||
|
||||
this.focusOnChoice(this.storageService.dateList.length - 1);
|
||||
}
|
||||
|
@ -81,7 +81,6 @@ export class FormComponent implements OnInit {
|
||||
startDateInterval: ['', [Validators.required]],
|
||||
endDateInterval: ['', [Validators.required]],
|
||||
});
|
||||
console.log('this.form ', this.form);
|
||||
|
||||
// take back values from pollservice
|
||||
this.form.patchValue(this.pollService.poll);
|
||||
@ -140,8 +139,6 @@ export class FormComponent implements OnInit {
|
||||
const dateStart = this.dateUtils.formateDateToInputStringNg(new Date());
|
||||
const dateEnd = this.dateUtils.formateDateToInputStringNg(this.dateUtils.addDaysToDate(5, new Date()));
|
||||
|
||||
console.log('dateStart', dateStart);
|
||||
|
||||
this.form.patchValue({
|
||||
title: title,
|
||||
custom_url: this.pollUtilitiesService.makeSlugFromString(title),
|
||||
@ -156,7 +153,6 @@ export class FormComponent implements OnInit {
|
||||
}
|
||||
|
||||
goNextStep() {
|
||||
console.log('this.steps', this.steps);
|
||||
let indexCurrentStep = this.steps.indexOf(this.currentStep);
|
||||
indexCurrentStep += 1;
|
||||
this.currentStep = this.steps[indexCurrentStep];
|
||||
@ -164,7 +160,6 @@ export class FormComponent implements OnInit {
|
||||
}
|
||||
|
||||
public createPoll(): void {
|
||||
console.log('this.form', this.form);
|
||||
const newpoll = this.pollService.newPollFromForm(this.form);
|
||||
console.log('newpoll', newpoll);
|
||||
const router = this.router;
|
||||
@ -180,7 +175,7 @@ export class FormComponent implements OnInit {
|
||||
router.navigate(['success']);
|
||||
},
|
||||
(err) => {
|
||||
this.toastService.display('erreur lors de la sauvegarde');
|
||||
this.toastService.display('erreur lors de la sauvegarde ' + err.message);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
|
@ -23,7 +23,7 @@ export class ErrorsListComponent implements OnInit {
|
||||
}
|
||||
|
||||
getFormValidationErrors(): void {
|
||||
console.log('%c ==>> Validation Errors: ', 'color: red; font-weight: bold; font-size:22px;');
|
||||
// console.log('%c ==>> Validation Errors: ', 'color: red; font-weight: bold; font-size:22px;');
|
||||
|
||||
let totalErrors = 0;
|
||||
this.messages = [];
|
||||
@ -37,22 +37,16 @@ export class ErrorsListComponent implements OnInit {
|
||||
if (!firstErrorId) {
|
||||
firstErrorId = key;
|
||||
}
|
||||
// totalErrors++;
|
||||
// this.messages.push('' + key + ' est invalide');
|
||||
}
|
||||
const controlErrors: ValidationErrors = theKey.errors;
|
||||
|
||||
if (controlErrors != null) {
|
||||
console.log('controlErrors', controlErrors);
|
||||
totalErrors++;
|
||||
Object.keys(controlErrors).forEach((keyError) => {
|
||||
if (!firstErrorId) {
|
||||
firstErrorId = key;
|
||||
}
|
||||
const message = '' + key + ', ' + keyError + '';
|
||||
console.log(
|
||||
'Key control: ' + key + ', keyError: ' + keyError + ', err value: ' + controlErrors[keyError]
|
||||
);
|
||||
|
||||
this.messages.push(message);
|
||||
});
|
||||
@ -62,11 +56,10 @@ export class ErrorsListComponent implements OnInit {
|
||||
this.firstErrorId = firstErrorId;
|
||||
|
||||
if (totalErrors) {
|
||||
console.log('Number of errors: ', totalErrors);
|
||||
}
|
||||
}
|
||||
|
||||
scrollToFirstError() {
|
||||
scrollToFirstError(): void {
|
||||
if (this.firstErrorId) {
|
||||
const foundErrorField = this.document.querySelector('#' + this.firstErrorId);
|
||||
if (foundErrorField) {
|
||||
@ -77,7 +70,6 @@ export class ErrorsListComponent implements OnInit {
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
console.log('foundErrorField', foundErrorField);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,8 @@
|
||||
<label for="lang_selector" class="hidden">{{ 'selector.lang' | translate }}</label>
|
||||
<select class="select is-hidden-touch" id="lang_selector" (change)="setLang()" [(ngModel)]="currentLang">
|
||||
<option *ngFor="let language of availableLanguages" value="{{ language }}">
|
||||
{{ language }} - {{ 'LANGUAGES.' + language | translate }}
|
||||
<!-- {{ language }} - -->
|
||||
{{ 'LANGUAGES.' + language | translate }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -11,7 +11,7 @@ import { StorageService } from '../../../../core/services/storage.service';
|
||||
})
|
||||
export class LanguageSelectorComponent implements OnInit {
|
||||
public currentLang: Language;
|
||||
public availableLanguages: string[] = [];
|
||||
public availableLanguages: any = [];
|
||||
|
||||
constructor(private languageService: LanguageService, private storageService: StorageService) {}
|
||||
|
||||
@ -19,7 +19,6 @@ export class LanguageSelectorComponent implements OnInit {
|
||||
this.availableLanguages = this.languageService.getAvailableLanguages();
|
||||
|
||||
this.currentLang = this.languageService.getLangage();
|
||||
this.nextLang();
|
||||
}
|
||||
|
||||
setLang(): void {
|
||||
@ -27,7 +26,26 @@ export class LanguageSelectorComponent implements OnInit {
|
||||
}
|
||||
|
||||
nextLang(): void {
|
||||
const index = this.availableLanguages.indexOf(this.currentLang);
|
||||
console.log('this.currentLang ', this.currentLang, 'index', index);
|
||||
|
||||
if (index !== -1) {
|
||||
// on passe au language suivant si il existe, sinon on revient au numéro 0
|
||||
const nextlang = console.log('this.availableLanguages[index + 1]', this.availableLanguages[index + 1]);
|
||||
console.log('nextlang', nextlang);
|
||||
|
||||
if (this.availableLanguages[index + 1]) {
|
||||
console.log('lang suivante', this.availableLanguages[index + 1]);
|
||||
this.currentLang = this.availableLanguages[index + 1];
|
||||
} else {
|
||||
console.log('retour à la langue 0');
|
||||
this.currentLang = this.availableLanguages[0];
|
||||
}
|
||||
this.setLang();
|
||||
}
|
||||
console.log('this.currentLang ', this.currentLang);
|
||||
|
||||
console.log('this.availableLanguages', this.availableLanguages);
|
||||
console.log('TODO');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user