buttons to nav

This commit is contained in:
Baptiste Lemoine 2020-01-20 15:01:56 +01:00
parent 9ebd22536b
commit 3808f19425
10 changed files with 260 additions and 184 deletions

View File

@ -1,7 +1,7 @@
export const mockMyPolls = export const mockMyPolls =
[{ [{
"id": 1, "id": 1000001,
"title": "blehehehe heh hehhe e", "title": "blehehehe heh hehhe e test1",
"customUrl": null, "customUrl": null,
"description": "maaaaaaaaaaah", "description": "maaaaaaaaaaah",
"creationDate": {"date": "2020-01-20 14:21:16.270157", "timezone_type": 3, "timezone": "Europe/Paris"}, "creationDate": {"date": "2020-01-20 14:21:16.270157", "timezone_type": 3, "timezone": "Europe/Paris"},
@ -19,5 +19,25 @@ export const mockMyPolls =
"choices": {}, "choices": {},
"comments": {}, "comments": {},
"defaultExpiracyDaysFromNow": 60 "defaultExpiracyDaysFromNow": 60
}, {
"id": 1000002,
"title": "bleh z zr erth tuyjikioy yylil test2",
"customUrl": null,
"description": "maaaaaaaaaaah 2",
"creationDate": {"date": "2020-01-20 14:21:16.270157", "timezone_type": 3, "timezone": "Europe/Paris"},
"expiracyDate": {"date": "2020-01-20 14:21:16.270178", "timezone_type": 3, "timezone": "Europe/Paris"},
"owner": null,
"kind": "text",
"allowedAnswers": ["yes"],
"modificationPolicy": "nobody",
"mailOnComment": null,
"mailOnVote": null,
"hideResults": null,
"showResultEvenIfPasswords": null,
"votes": {},
"stacksOfVotes": {},
"choices": {},
"comments": {},
"defaultExpiracyDaysFromNow": 60
}] }]
; ;

View File

@ -63,6 +63,7 @@
[(ngModel)]="answer.text" [(ngModel)]="answer.text"
(keyup.enter)="addAnswer()" (keyup.enter)="addAnswer()"
(keyup)="navigateOrDelete($event,i)" (keyup)="navigateOrDelete($event,i)"
required='required'
placeholder="réponse" placeholder="réponse"
> >
<button <button
@ -75,15 +76,19 @@
<button <button
class="btn btn--primary btn--outline" class="btn btn--primary btn--outline"
(click)="addAnswer()" (click)="addAnswer()"
[ngClass]="{'btn--primary': allAnswersAreValid}"
i18n i18n
> >
<i class='fa fa-plus' ></i >
Ajouter une proposition Ajouter une proposition
</button > </button >
<br > <br >
<button <button
[routerLink]="'/step/resume'" [routerLink]="'/step/resume'"
class="btn btn--full btn--primary" class="btn btn--full "
i18n i18n
[ngClass]="{'btn--primary': allAnswersAreValid}"
[disabled]='!allAnswersAreValid'
> >
Voyons ce que ça donne Voyons ce que ça donne
</button > </button >

View File

@ -1,8 +0,0 @@
:host {
.img-thumbnail {
width: 5em;
height: 5em;
margin: 1ch 0;
display: inline-block;
}
}

View File

@ -1,4 +1,4 @@
import {AfterViewInit, ChangeDetectorRef, Component, Inject, OnInit} from '@angular/core'; import {AfterViewInit, ChangeDetectorRef, Component, Inject, OnChanges, OnInit} from '@angular/core';
import {BaseComponent} from '../base-page/base.component'; import {BaseComponent} from '../base-page/base.component';
import {ConfigService} from '../../services/config.service'; import {ConfigService} from '../../services/config.service';
@ -9,7 +9,9 @@ import {DOCUMENT} from '@angular/common';
templateUrl: './answers.component.html', templateUrl: './answers.component.html',
styleUrls: ['./answers.component.scss'] styleUrls: ['./answers.component.scss']
}) })
export class AnswersComponent extends BaseComponent implements OnInit, AfterViewInit { export class AnswersComponent extends BaseComponent implements OnInit, AfterViewInit, OnChanges {
private allAnswersAreValid = false;
private answerList = []; private answerList = [];
private currentHeader: any = ""; private currentHeader: any = "";
@ -26,8 +28,24 @@ export class AnswersComponent extends BaseComponent implements OnInit, AfterView
ngOnInit() { ngOnInit() {
} }
ngOnChanges() {
this.checkValidAnswers();
}
checkValidAnswers() {
this.allAnswersAreValid = true;
this.config.answers.forEach(answer => {
if (!answer.text.length) {
this.allAnswersAreValid = false;
return;
}
});
}
ngAfterViewInit() { ngAfterViewInit() {
this.focusOnAnswer(0) this.focusOnAnswer(0);
this.checkValidAnswers();
} }
trackFunction(index: number, item: any): number { trackFunction(index: number, item: any): number {

View File

@ -63,8 +63,9 @@
for="poll_description" for="poll_description"
i18n i18n
> >
{{"creation.description"|translate}} {{"creation.description"|translate}}:
</label > </label >
<br >
<textarea <textarea
[(ngModel)]="config.description" [(ngModel)]="config.description"
cols="50" cols="50"
@ -91,7 +92,7 @@
<button <button
[routerLink]="'/step/answers'" [routerLink]="'/step/answers'"
class="btn btn-block" class="btn btn--primary btn--full"
i18n i18n
> >
Continuer Continuer

View File

@ -1,7 +1,9 @@
<h1 > <h1 >
Récapitulatif Récapitulatif
</h1 > </h1 >
<h2 class="hero-title"> <div class='card content' >
<h2 class="hero-title title" >
{{config.title}} {{config.title}}
</h2 > </h2 >
<div class="creation" > <div class="creation" >
@ -15,17 +17,29 @@
</div > </div >
<section > <section >
<ul > <ul >
<li markdown *ngFor="let questions of config.answers"> <li
markdown
*ngFor="let questions of config.answers" >
<img
class='img-thumbnail'
src='{{questions.url}}'
alt='image {{questions.url}}' >
{{questions.id + 1}}. {{questions.text}} {{questions.id + 1}}. {{questions.text}}
</li > </li >
</ul > </ul >
<button [routerLink]="'/step/answers'" class="btn btn-info">Retour</button>
</section > </section >
<button [routerLink]="'/step/end'" class="btn btn--primary" i18n="@@confirm">C'est parfait!</button>
</div >
<button
[routerLink]="'/step/end'"
class="btn btn--primary btn--full"
i18n="@@confirm" >C'est parfait!
</button >
<div class="back" > <div class="back" >
<a [routerLink]="'/step/visibility'" <a
class="btn btn--back"> [routerLink]="'/step/answers'"
class="prev" >
Retour Retour
</a > </a >
</div > </div >

View File

@ -0,0 +1,5 @@
.card {
box-shadow: 0px 0px 0.5em #ccc;
padding: 2em;
margin: 1em 0;
}

View File

@ -54,7 +54,8 @@
{{"visibility.archiving"|translate}} {{"visibility.archiving"|translate}}
</label > </label >
<input type="date" <input
type="date"
id="expirationDate" id="expirationDate"
[(ngModel)]="config.expirationDate" > [(ngModel)]="config.expirationDate" >
<div class="modification" > <div class="modification" >
@ -91,7 +92,6 @@
</div > </div >
</section > </section >
<section class="access" > <section class="access" >
<h2 > <h2 >
@ -103,7 +103,8 @@
{{"visibility.access_url_key"|translate}} {{"visibility.access_url_key"|translate}}
</label > </label >
<br > <br >
<input type="name" <input
type="name"
class="input-lg" class="input-lg"
name="url" name="url"
id="url" id="url"
@ -119,7 +120,10 @@
<label for="passwordAccess" > <label for="passwordAccess" >
{{"visibility.access_want"|translate}} {{"visibility.access_want"|translate}}
</label > </label >
<select name="passwordAccess" id="passwordAccess" [(ngModel)]="config.passwordAccess"> <select
name="passwordAccess"
id="passwordAccess"
[(ngModel)]="config.passwordAccess" >
<option value="0" > {{"visibility.access_want_no"|translate}}</option > <option value="0" > {{"visibility.access_want_no"|translate}}</option >
<option value="1" > {{"visibility.access_want_yes"|translate}}</option > <option value="1" > {{"visibility.access_want_yes"|translate}}</option >
</select > </select >
@ -128,20 +132,26 @@
{{"visibility.access_protect"|translate}} {{"visibility.access_protect"|translate}}
</label > </label >
<div class="enablepassword" *ngIf="config.passwordAccess == '1'"> <div
<input type="password" class="enablepassword"
*ngIf="config.passwordAccess == '1'" >
<input
type="password"
name="password" name="password"
id="password" id="password"
min="8" min="8"
*ngIf="!showCustomPassword" *ngIf="!showCustomPassword"
[(ngModel)]="config.password" > [(ngModel)]="config.password" >
<input type="name" <input
type="name"
name="password_visible" name="password_visible"
id="password_visible" id="password_visible"
min="8" min="8"
*ngIf="showCustomPassword" *ngIf="showCustomPassword"
[(ngModel)]="config.password" > [(ngModel)]="config.password" >
<button (click)="showCustomPassword = !showCustomPassword" [disabled]="!config.password" <button
(click)="showCustomPassword = !showCustomPassword"
[disabled]="!config.password"
class="btn btn--default" > class="btn btn--default" >
<i class="fa fa-eye" ></i > <i class="fa fa-eye" ></i >
{{"visibility.see_pass"|translate}} {{"visibility.see_pass"|translate}}
@ -149,14 +159,16 @@
</div > </div >
</section > </section >
<a [routerLink]="'/step/end'" <a
[routerLink]="'/step/end'"
class="btn btn-link btn--primary" > class="btn btn-link btn--primary" >
{{"visibility.validate_btn"|translate}} {{"visibility.validate_btn"|translate}}
</a > </a >
<div class="back" > <div class="back" >
<a [routerLink]="'/step/answers'" <a
class="btn btn--back"> [routerLink]="'/step/answers'"
class="prev" >
Retour Retour
</a > </a >
</div > </div >

View File

@ -46,7 +46,6 @@ option {
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
background: none;
border-radius: 0; border-radius: 0;
background-color: transparent; background-color: transparent;
@ -164,3 +163,7 @@ select, input, textarea {
display: block; display: block;
width: 100%; width: 100%;
} }
.btn, a {
cursor: pointer;
}

View File

@ -1 +1,7 @@
@charset "UTF-8"; @charset "UTF-8";
.img-thumbnail {
width: 5em;
height: 5em;
margin: 1ch 0;
display: inline-block;
}