erasable inputs on first config screen ok

This commit is contained in:
Baptiste Lemoine 2020-01-20 15:15:06 +01:00
parent 3808f19425
commit 3ada66ac5f
6 changed files with 90 additions and 60 deletions

View File

@ -1,6 +1,7 @@
import {Component} from '@angular/core'; import {Component, Inject} from '@angular/core';
import {TranslateService} from '@ngx-translate/core'; import {TranslateService} from '@ngx-translate/core';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {DOCUMENT} from "@angular/common";
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
@ -21,6 +22,7 @@ export class AppComponent {
private step: string; private step: string;
constructor(private translate: TranslateService, constructor(private translate: TranslateService,
@Inject(DOCUMENT) private document,
private route: Router) { private route: Router) {
this.translate.setDefaultLang(this.currentLang); this.translate.setDefaultLang(this.currentLang);
this.detectCurrentTabOnRouteChange(); this.detectCurrentTabOnRouteChange();
@ -29,6 +31,7 @@ export class AppComponent {
detectCurrentTabOnRouteChange() { detectCurrentTabOnRouteChange() {
this.route.events.subscribe((event: any) => { this.route.events.subscribe((event: any) => {
this.scrollGoToTop();
if (event.url) { if (event.url) {
@ -68,4 +71,8 @@ export class AppComponent {
toggleMenu() { toggleMenu() {
this.menuVisible = !this.menuVisible; this.menuVisible = !this.menuVisible;
} }
scrollGoToTop() {
this.document.documentElement.scrollTop = 0;
}
} }

View File

@ -28,7 +28,7 @@
> >
<label <label
class="description" class="description"
for="email" for="sendemail"
i18n i18n
> >
<i class='fa fa-envelope' ></i > <i class='fa fa-envelope' ></i >
@ -38,7 +38,7 @@
[(ngModel)]="config.myEmail" [(ngModel)]="config.myEmail"
class='input' class='input'
autofocus="autofocus" autofocus="autofocus"
id="email" id="sendemail"
name="mail" name="mail"
required="required" required="required"
type="email" type="email"
@ -47,6 +47,7 @@
[disabled]="!config.myEmail || !config.myEmail.length" [disabled]="!config.myEmail || !config.myEmail.length"
[ngClass]="{'btn--primary': config.myEmail}" [ngClass]="{'btn--primary': config.myEmail}"
class="btn btn--full" class="btn btn--full"
id='sendemailbutton'
i18n-value="'config.find_button'|translate" i18n-value="'config.find_button'|translate"
type="submit" type="submit"
/> />

View File

@ -37,24 +37,32 @@
{{"dates.add_interval"|translate}} {{"dates.add_interval"|translate}}
</button > </button >
<button <button
(click)="emptyAll()" (click)="emptyAll()"
class="btn btn-warning" class="btn btn-warning"
id="empty_button" id="empty_button"
>{{"dates.empty"|translate}} >{{"dates.empty"|translate}}
</button > </button >
<section *ngIf="showDateInterval" class="date-interval"> <section
*ngIf="showDateInterval"
class="date-interval" >
<!-- TODO à mettre en popup--> <!-- TODO à mettre en popup-->
<hr > <hr >
<h2 > {{"dates.add_interval"|translate}}</h2 > <h2 > {{"dates.add_interval"|translate}}</h2 >
<p > <p >
{{"dates.interval_propose"|translate}} {{"dates.interval_propose"|translate}}
<input (change)="countDays()" [(ngModel)]="startDateInterval" type="date"> <input
(change)="countDays()"
[(ngModel)]="startDateInterval"
type="date" >
{{"dates.interval_span"|translate}} {{"dates.interval_span"|translate}}
<input (change)="countDays()" [(ngModel)]="endDateInterval" type="date"> <input
(change)="countDays()"
[(ngModel)]="endDateInterval"
type="date" >
</p > </p >
<button (click)="addIntervalOfDates()" <button
(click)="addIntervalOfDates()"
class="btn btn-block" > class="btn btn-block" >
{{"dates.interval_button"|translate}} {{"dates.interval_button"|translate}}
{{intervalDays}} {{intervalDays}}
@ -91,7 +99,10 @@
name="timeChoices_{{id}}" name="timeChoices_{{id}}"
type="name" type="name"
> >
<button (click)="config.timeList.splice(id, 1)" class="btn btn-warning">X</button> <button
(click)="config.timeList.splice(id, 1)"
class="btn btn-warning" >X
</button >
</div > </div >
</div > </div >
<hr > <hr >
@ -147,7 +158,13 @@
<a <a
[routerLink]="'/step/end'" [routerLink]="'/step/end'"
class="btn btn-block" class="btn btn--full btn--primary"
> >
C'est parfait! C'est parfait!
</a > </a >
<a
[routerLink]="'/step/home'"
class="prev"
>
Retour
</a >

View File

@ -42,6 +42,7 @@
placeholder="{{'creation.choose_title_placeholder'|translate}}" placeholder="{{'creation.choose_title_placeholder'|translate}}"
type="name" type="name"
> >
<framadate-erasable-input [(inputModel)]="config.title" ></framadate-erasable-input >
</div > </div >
<div > <div >
@ -55,6 +56,7 @@
placeholder="{{'creation.name_placeholder'|translate}}" placeholder="{{'creation.name_placeholder'|translate}}"
type="name" type="name"
> >
<framadate-erasable-input [(inputModel)]="config.myName" ></framadate-erasable-input >
</div > </div >
<div > <div >
@ -64,6 +66,7 @@
i18n i18n
> >
{{"creation.description"|translate}}: {{"creation.description"|translate}}:
<framadate-erasable-input [(inputModel)]="config.description" ></framadate-erasable-input >
</label > </label >
<br > <br >
<textarea <textarea

View File

@ -1,3 +1,6 @@
<button class="erase" (click)="eraseInput()"> <button
class="erase btn btn--warning"
[disabled]='!inputModel'
(click)="eraseInput()" >
<i class="fa fa-times" ></i > <i class="fa fa-times" ></i >
</button > </button >

View File

@ -14,7 +14,6 @@ export class ErasableInputComponent implements OnInit {
} }
set inputModel(val) { set inputModel(val) {
// this.inputModel = val;
} }
constructor() { constructor() {
@ -25,7 +24,7 @@ export class ErasableInputComponent implements OnInit {
eraseInput() { eraseInput() {
this.inputModel = ''; this.inputModel = '';
this.inputModelChange.emit(this.inputModel); this.inputModelChange.emit('');
} }
} }