src/app/pages/create-or-retrieve/create-or-retrieve.component.ts
selector | framadate-create-or-retrieve |
styleUrls | ./create-or-retrieve.component.scss |
templateUrl | ./create-or-retrieve.component.html |
Properties |
|
Methods |
constructor(config: ConfigService)
|
||||||
Parameters :
|
findMyPollsByEmail | ||||||
findMyPollsByEmail(email: string)
|
||||||
Parameters :
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
trackFunction |
trackFunction(index: number, item: any)
|
Returns :
number
|
checkValidity |
checkValidity()
|
Inherited from
BaseComponent
|
Defined in
BaseComponent:21
|
Returns :
boolean
|
displayErrorMessage |
displayErrorMessage()
|
Inherited from
BaseComponent
|
Defined in
BaseComponent:27
|
Returns :
boolean
|
ngOnInit |
ngOnInit()
|
Inherited from
BaseComponent
|
Defined in
BaseComponent:17
|
Returns :
void
|
Public config |
Type : ConfigService
|
loadedMyPolls |
Type : boolean
|
Default value : false
|
Public config |
Type : ConfigService
|
Inherited from
BaseComponent
|
Defined in
BaseComponent:14
|
import {Component, OnInit} from '@angular/core';
import {BaseComponent} from "../base-page/base.component";
import {ConfigService} from "../../services/config.service";
@Component({
selector: 'framadate-create-or-retrieve',
templateUrl: './create-or-retrieve.component.html',
styleUrls: ['./create-or-retrieve.component.scss']
})
export class CreateOrRetrieveComponent extends BaseComponent implements OnInit {
loadedMyPolls: boolean = false;
constructor(public config: ConfigService) {
super(config);
}
ngOnInit() {
// if (!environment.production) {
// this.findMyPollsByEmail('tktest@tktest.com')
// }
}
findMyPollsByEmail(email: string) {
if (!email) {
return
}
this.config.findPollsByEmail(email);
this.loadedMyPolls = true;
}
trackFunction(index: number, item: any): number {
return item.id;
};
}
<div class="container" >
<section class="creation" >
<h1 >
{{"creation.title"|translate}}
</h1 >
<p
class="description margin-btm-x5"
i18n >
{{"config.description"|translate}}
</p >
<div class="btn-next" >
<button
[routerLink]="'step/date'"
class="btn btn--full btn--primary" >
{{"config.letsgo"|translate}}
</button >
</div >
</section >
<section class="recuperation" >
<h1 class="margin-top-x8" >
{{"config.find_my_polls"|translate}}
</h1 >
<form
(ngSubmit)="findMyPollsByEmail(config.myEmail)"
>
<label
class="description"
for="sendemail"
i18n
>
<i class='fa fa-envelope' ></i >
{{"config.find_helper"|translate}} :
</label >
<input
[(ngModel)]="config.myEmail"
class='input'
autofocus="autofocus"
id="sendemail"
name="mail"
required="required"
type="email"
/>
<input
[disabled]="!config.myEmail || !config.myEmail.length"
[ngClass]="{'btn--primary': config.myEmail}"
class="btn btn--full"
id='sendemailbutton'
i18n-value="'config.find_button'|translate"
type="submit"
/>
</form >
</section >
<section
class="list-my-polls"
*ngIf="!config.loading" >
<h2 >
Mes Sondages trouvés:
</h2 >
<ul
class="poll-list"
*ngFor="let poll of config.myPolls ; index as i;trackBy trackFunction" >
<li >
<a href='{{poll.url}}' >
{{poll.title}}
<sub >
{{poll.description}}
</sub >
</a >
</li >
</ul >
<div
class="no-polls"
*ngIf="! config.myPolls || !config.myPolls.length" >
Aucun sondage.
</div >
</section >
<div
class="loading"
*ngIf="config.loading" >
<i class="fa fa-refresh fa-spin fa-3x fa-fw" ></i >
</div >
</div >
./create-or-retrieve.component.scss
.container{
display:flex;
flex-direction: column;
margin:auto;
}
h1 {
display: inline-block;
margin-bottom: 3rem;
font-size: 2.6rem;
&::after {
content: "";
display: block;
width: 27.4%;
height: 2px;
margin-top: 5px;
margin-right: auto;
margin-left: auto;
// background-color: $primary_color;
}
}
label{
float:left;
}
input[type=email]{
display:block;
}