From d413774d3b473c5355e2a52f1d0f73efa90b3ab8 Mon Sep 17 00:00:00 2001 From: tykayn Date: Sat, 10 Aug 2019 18:14:00 +0200 Subject: [PATCH] :zap: sync answers --- src/app/config/PollConfig.ts | 22 +++++----- .../form-container.component.html | 2 +- src/app/pages/answers/answers.component.html | 42 ++++++++++++------- src/app/pages/answers/answers.component.ts | 7 ++++ .../ui/navigation/navigation.component.html | 41 +++++------------- src/assets/_global_layout.scss | 42 ++++++++++++++----- 6 files changed, 88 insertions(+), 68 deletions(-) diff --git a/src/app/config/PollConfig.ts b/src/app/config/PollConfig.ts index 232f380d..2837f892 100644 --- a/src/app/config/PollConfig.ts +++ b/src/app/config/PollConfig.ts @@ -20,17 +20,19 @@ export class PollConfig { // date specific poll allowSeveralHours = false; dateList: DateOption[] = []; - answers: string[] = []; + answers: any = [{ + id: 0, + text: 'réponse de démo 1' + }, - addAnswer() { - this.answers.push(''); - } + { + id: 1, + text: 'réponse 2' + }, + { + id: 2, + text: 'la réponse D' + }]; - removeAnswer(answer: string) { - const indexFound = this.answers.indexOf(answer); - if (indexFound !== -1) { - this.answers.splice(indexFound); - } - } } diff --git a/src/app/form-container/form-container.component.html b/src/app/form-container/form-container.component.html index a557f6be..15b6c96d 100644 --- a/src/app/form-container/form-container.component.html +++ b/src/app/form-container/form-container.component.html @@ -46,7 +46,7 @@ C'est parti diff --git a/src/app/pages/answers/answers.component.html b/src/app/pages/answers/answers.component.html index 8082cfac..8014ef37 100644 --- a/src/app/pages/answers/answers.component.html +++ b/src/app/pages/answers/answers.component.html @@ -1,15 +1,27 @@ -

- Choisir les propositions -

-

- vous pouvez utiliser la syntaxe markdown -

-
    -
  1. - - -
  2. -
-
Voyons ce que ça donne +
+ +

+ Choisir les propositions +

+

+ vous pouvez utiliser la syntaxe markdown +

+
    +
  1. + + +
  2. +
+ + Voyons ce que ça donne + +
diff --git a/src/app/pages/answers/answers.component.ts b/src/app/pages/answers/answers.component.ts index aec85fb5..adc9d872 100644 --- a/src/app/pages/answers/answers.component.ts +++ b/src/app/pages/answers/answers.component.ts @@ -9,18 +9,25 @@ import {ConfigService} from '../../config.service'; }) export class AnswersComponent extends BaseComponent implements OnInit { + private answerList=[]; + constructor(config: ConfigService) { super(config); + this.answerList = this.config.answers; } // todo, manage validation of each page in a common way ngOnInit() { } + trackFunction(index: number, item: any): number { return item.id; } + // add a new answer on the press of ENTER in an input addWhenEnterKey(event) { + console.log('event', event); if (event.keyCode === 13) { this.config.addAnswer(); } + return; } } diff --git a/src/app/ui/navigation/navigation.component.html b/src/app/ui/navigation/navigation.component.html index dfc75807..ef57963f 100644 --- a/src/app/ui/navigation/navigation.component.html +++ b/src/app/ui/navigation/navigation.component.html @@ -1,64 +1,43 @@ -
+
+ diff --git a/src/assets/_global_layout.scss b/src/assets/_global_layout.scss index c0a0562a..7fa6cfe8 100644 --- a/src/assets/_global_layout.scss +++ b/src/assets/_global_layout.scss @@ -1,12 +1,4 @@ -input, textarea, -select { - @extend .funky-box; -} - -textarea { - border-left: 3px solid $main_color_strong; -} - +// form inputs .funky-box { background: $light; padding: 1em; @@ -19,6 +11,17 @@ textarea { } } +input, textarea, +select { + @extend .funky-box; +} + +textarea { + margin-top: 1em; + border-left: 3px solid $main_color_strong; +} + + // buttons .btn { display: inline-block; @@ -31,14 +34,31 @@ textarea { min-height: 1.5rem; } +.btn-block { + display: block; +} + a { text-decoration: none; + + nav & { + display: inline-block; + margin: 0.5em; + @extend .btn-outline, .btn; + color: #000; + } } .home_link { text-decoration: none; } -.striked { - background: linear-gradient($main_color, $main_color_strong); +.btn-outline { + background: $light; + border: solid 1px $main_color_strong; +} + +.striked { + @extend .btn-outline; + color: $main_color_strong; }