From 4bcd3e475f9c7f31b5b4f8f5ffe700239929660c Mon Sep 17 00:00:00 2001
From: Baptiste Lemoine
Date: Tue, 4 Feb 2020 14:28:43 +0100
Subject: [PATCH] :zap: reset all answers before loading a stack
---
src/app/app.module.ts | 2 -
src/app/config/Routes.ts | 4 +-
src/app/config/mocks/mock-poll3.ts | 4 +-
src/app/config/mocks/mock-success-vote.ts | 2 +-
src/app/pages/kind/kind.component.html | 449 +++++++++++-------
.../poll-display/poll-display.component.html | 4 +-
.../voting-choice.component.html | 172 ++++++-
.../voting-choice.component.scss | 276 +++++++++++
.../voting-choice/voting-choice.component.ts | 74 ++-
.../voting-summary.component.html | 1 +
src/app/services/config.service.ts | 7 +
.../ui/vote-choice/vote-choice.component.html | 171 -------
.../ui/vote-choice/vote-choice.component.scss | 276 -----------
.../vote-choice/vote-choice.component.spec.ts | 25 -
.../ui/vote-choice/vote-choice.component.ts | 70 ---
15 files changed, 789 insertions(+), 748 deletions(-)
delete mode 100644 src/app/ui/vote-choice/vote-choice.component.html
delete mode 100644 src/app/ui/vote-choice/vote-choice.component.scss
delete mode 100644 src/app/ui/vote-choice/vote-choice.component.spec.ts
delete mode 100644 src/app/ui/vote-choice/vote-choice.component.ts
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 46e5344e..4e01729a 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -25,7 +25,6 @@ import {VotingGraphComponent} from './pages/voting/voting-graph/voting-graph.com
import {VotingChoiceComponent} from './pages/voting/voting-choice/voting-choice.component';
import {PasswordComponent} from './pages/password/password.component';
import {HomeComponent} from './pages/home/home.component';
-import {VoteChoiceComponent} from './ui/vote-choice/vote-choice.component';
import {HttpClient, HttpClientModule} from '@angular/common/http';
import {MarkdownModule} from 'ngx-markdown';
import {
@@ -90,7 +89,6 @@ export function HttpLoaderFactory(http: HttpClient) {
PasswordComponent,
HomeComponent,
PollGraphicComponent,
- VoteChoiceComponent,
AdminComponent,
SelectorComponent,
PollDisplayComponent,
diff --git a/src/app/config/Routes.ts b/src/app/config/Routes.ts
index 67df9d67..4e8c2de6 100644
--- a/src/app/config/Routes.ts
+++ b/src/app/config/Routes.ts
@@ -10,11 +10,11 @@ import {CreateOrRetrieveComponent} from '../pages/create-or-retrieve/create-or-r
import {BaseComponent} from '../pages/base-page/base.component';
import {HomeComponent} from "../pages/home/home.component";
import {PollGraphicComponent} from '../poll-graphic/poll-graphic.component';
-import {VoteChoiceComponent} from "../ui/vote-choice/vote-choice.component";
import {PollDisplayComponent} from "../pages/poll-display/poll-display.component";
import {VotingComponent} from "../pages/voting/voting.component";
import {PasswordComponent} from "../pages/password/password.component";
+import {VotingChoiceComponent} from "../pages/voting/voting-choice/voting-choice.component";
/**
* each step in the form is a component
@@ -37,7 +37,7 @@ export const Routes =
{path: 'graphic/:poll', component: PollGraphicComponent},
{path: 'vote/poll/id/:poll', component: PollDisplayComponent},
{path: 'vote/poll/slug/:pollSlug', component: PollDisplayComponent},
- {path: 'votechoice', component: VoteChoiceComponent},
+ {path: 'votingchoice', component: VotingChoiceComponent},
{path: 'voting', component: VotingComponent},
{path: 'step/password', component: PasswordComponent},
{path: '**', redirectTo: '/home', pathMatch: 'full'},
diff --git a/src/app/config/mocks/mock-poll3.ts b/src/app/config/mocks/mock-poll3.ts
index 80c46059..a98f4a2a 100644
--- a/src/app/config/mocks/mock-poll3.ts
+++ b/src/app/config/mocks/mock-poll3.ts
@@ -24,9 +24,9 @@ export const mockPoll3 = {
},
"kind": "text",
"allowedAnswers": [
- "yes"
+ "yes","maybe","no"
],
- "modificationPolicy": "self",
+ "modificationPolicy": "everybody",
"mailOnComment": null,
"mailOnVote": null,
"hideResults": null,
diff --git a/src/app/config/mocks/mock-success-vote.ts b/src/app/config/mocks/mock-success-vote.ts
index b9e60f65..9971ccab 100644
--- a/src/app/config/mocks/mock-success-vote.ts
+++ b/src/app/config/mocks/mock-success-vote.ts
@@ -26,7 +26,7 @@ export const mockSuccessVote = {
"allowedAnswers": [
"yes"
],
- "modificationPolicy": "self",
+ "modificationPolicy": "everybody",
"mailOnComment": null,
"mailOnVote": null,
"hideResults": null,
diff --git a/src/app/pages/kind/kind.component.html b/src/app/pages/kind/kind.component.html
index 02f06730..7ae00308 100644
--- a/src/app/pages/kind/kind.component.html
+++ b/src/app/pages/kind/kind.component.html
@@ -1,262 +1,343 @@
-page de démo
-cette étape est en cours de développement. S'inspirer de la page de Home pour réaliser d'autres pages
-
-C'est parfait!
-Atoms
-
+
-
- Lists
+
+ Lists
- Unordered list
-
-
+ Unordered list
+
+
plop
-
-
+
+
plop
-
-
+
+
plop
-
-
+
+
- Ordered list
-
-
+ Ordered list
+
+
plop
-
-
+
+
plop
-
-
+
+
plop
-
-
-
+
+
+
-
- Images
-
-
-
+
+ Images
+
+
+
-
- Molecules
-
-
- Useful classes
+
+
+ Commentaries
+
+
-
- Components
+
+ Components
-
- Images list
- that
-
+
+ Images list
+ that
+
-
- Calendar
-
+
+ Calendar
+
-
- Modale
-
+
+ Modale
+
-
- Way to vote
- that
-
+
+ Way to vote
+ that
+
-
- Voted
- that
-
+
+ Voted
+ that
+
-
- Graphics
- that
-
-
+
+ Graphics
+ that
+
+
diff --git a/src/app/pages/poll-display/poll-display.component.html b/src/app/pages/poll-display/poll-display.component.html
index 00f575d9..94eb5d8c 100644
--- a/src/app/pages/poll-display/poll-display.component.html
+++ b/src/app/pages/poll-display/poll-display.component.html
@@ -56,11 +56,11 @@
class="list-of-choices" >
-
+ [poll]='config.currentPoll' >
voting-choice works!
+
+
+
+
+
+
+
+
+
+
+ {{choice.text}}
+
+
+
+
+
+
+
+
+
+ {{choice.date.date | date:'EEE'}} {{choice.date.date | date:'dd'}} {{choice.date.date | date:'LLL'}}
+
+
+ {{choice.date.date | date:'H:m'}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ aucun vote
+
+
+
+ {{poll.choices_count.counts[choice.id].yes.count}}
+
+
+
+ {{poll.choices_count.counts[choice.id].maybe.count}}
+
+
+
+
+
+ Choix ayant reçu le plus de votes
+
+
+
+
+
+
+
+
diff --git a/src/app/pages/voting/voting-choice/voting-choice.component.scss b/src/app/pages/voting/voting-choice/voting-choice.component.scss
index e69de29b..45ab9402 100644
--- a/src/app/pages/voting/voting-choice/voting-choice.component.scss
+++ b/src/app/pages/voting/voting-choice/voting-choice.component.scss
@@ -0,0 +1,276 @@
+// ---------------------------------------------------------
+// -- VOTE CHOICE COMPONENT
+// ---------------------------------------------------------
+
+// -- IMPORTS
+// ----------------------------
+
+@import "../../../../assets/scss/variables";
+
+
+// -- VARIABLES
+// ----------------------------
+
+$box-padding: 2rem;
+$box-border-width: .6rem;
+$btn-size: 5rem;
+$btn-margin-x: 1rem;
+$btn-margin-y: 1.5rem;
+$btn-wrap-size: calc(2 * #{$btn-size} + 4 * #{$btn-margin-x});
+$img-maxheight: 12rem;
+$breakpoint-responsive: 640px; // à définir
+
+
+// -- GLOBAL
+// ----------------------------
+
+.choicebox {
+ position: relative;
+ min-width: 32rem;
+ min-height: 16rem;
+ display: block;
+ padding: $box-padding $box-padding $box-padding calc(#{$box-padding} - #{$box-border-width});
+ border-left: $box-border-width solid transparent;
+ background-color: $white;
+ box-shadow: 0 0 .6rem 0 rgba($black, .2);
+
+ &--active {
+ padding-left: $box-padding;
+ border-left-color: $primary_color;
+ }
+
+ &.selection-yes {
+ font-weight: 700;
+ background: #e9bdeb;
+ }
+
+ @media (min-width: $breakpoint-responsive) {
+ align-items: center;
+ justify-content: space-between;
+ min-height: auto;
+ }
+
+ .title {
+ max-width: 25%;
+ }
+}
+
+.choicebox__subject {
+ margin-bottom: 3rem;
+ padding-right: $btn-wrap-size;
+ @media (min-width: $breakpoint-responsive) {
+ margin-bottom: 0;
+ padding-right: 0;
+ }
+}
+
+
+// -- DATE
+// ----------------------------
+
+.choicebox__date {
+ font-size: 1.8rem;
+ margin-bottom: .5rem;
+ white-space: nowrap;
+ text-transform: capitalize;
+
+ @media (min-width: $breakpoint-responsive) {
+ margin-bottom: 0;
+ }
+}
+
+.choicebox__day {
+ font-size: 2.4rem;
+ font-weight: bold;
+}
+
+
+// -- IMG
+// ----------------------------
+
+.choicebox__img {
+ max-width: 100%;
+ max-height: $img-maxheight;
+}
+
+
+// -- TXT
+// ----------------------------
+
+.choicebox__txt {
+ margin: 0;
+ font-size: 1.8rem;
+ min-width: 10em;
+}
+
+
+// -- VOTE BTNS
+// ----------------------------
+
+.choicebox__actions {
+ position: absolute;
+ z-index: 1;
+
+ max-width: $btn-wrap-size;
+ top: 50%;
+ right: $box-padding;
+
+ @media (min-width: $breakpoint-responsive) {
+ position: static;
+ max-width: none;
+ transform: none;
+ margin: 0 1.5rem;
+ }
+}
+
+.choicebox__btn {
+ width: $btn-size;
+ height: $btn-size;
+ align-items: center;
+ justify-content: center;
+ margin: $btn-margin-y $btn-margin-x;
+ border: .3rem solid #ccc9c9;
+ background-color: transparent;
+ border-radius: 50%;
+ cursor: pointer;
+ float: left;
+
+ &--maybe {
+ position: relative;
+ top: calc((#{$btn-size} + 2 * #{$btn-margin-y}) / 2);
+ @media (min-width: $breakpoint-responsive) {
+ top: auto;
+ left: auto;
+ }
+ }
+
+ &--active {
+ border-color: #bf83c2;
+ }
+
+ @media (min-width: $breakpoint-responsive) {
+ margin-top: 0;
+ margin-bottom: 0;
+ }
+
+}
+
+
+// -- VOTE COUNT
+// ----------------------------
+
+.choicebox__count {
+ position: relative;
+ padding-right: $btn-wrap-size;
+ @media (min-width: $breakpoint-responsive) {
+ text-align: right;
+ padding-right: 0;
+ }
+}
+
+.choicebox__votes {
+ border: 0;
+ padding: 0;
+ line-height: normal;
+ background-color: transparent;
+ @media (min-width: $breakpoint-responsive) {
+ padding: 1.5rem;
+ }
+}
+
+.choicebox__vote {
+ display: inline-block;
+ vertical-align: middle;
+
+ & + .choicebox__vote {
+ margin-left: 1.5rem;
+ }
+}
+
+.choicebox__countxt {
+ display: none;
+ margin-top: .5rem;
+
+ .choicebox--active & {
+ display: block;
+ @media (min-width: $breakpoint-responsive) {
+ display: none;
+ }
+ }
+}
+
+
+// -- TOOLTIP
+// ----------------------------
+
+.choicebox__tooltip {
+ display: none;
+ @media (min-width: $breakpoint-responsive) {
+ position: absolute;
+ min-width: 18rem;
+ font-weight: normal;
+ top: 5rem;
+ left: 50%;
+ z-index: 1;
+ padding: 2rem;
+ border: .1rem solid rgba($black, .1);
+ background-color: $white;
+ text-align: left;
+ transform: translateX(-50%);
+ &::after,
+ &::before {
+ position: absolute;
+ width: 0;
+ height: 0;
+ bottom: 100%;
+ left: 50%;
+ content: " ";
+ pointer-events: none;
+ border: solid transparent;
+ }
+ &::after {
+ margin-left: -1.5rem;
+ border-width: 1.5rem;
+ border-color: rgba($white, 0);
+ border-bottom-color: #fff;
+ }
+ &::before {
+ margin-left: -1.6rem;
+ border-width: 1.6rem;
+ border-color: rgba($black, 0);
+ border-bottom-color: rgba($black, .1);
+ }
+ ul {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ }
+ }
+}
+
+.choicebox__tooltiplist {
+ & + .choicebox__tooltiplist {
+ padding-left: 3rem;
+ }
+
+ ul {
+ max-height: 11rem;
+ overflow: auto;
+ }
+}
+
+.choicebox__tooltipttl {
+ @media (min-width: $breakpoint-responsive) {
+ margin-bottom: 1rem;
+ font-size: 1.6rem;
+ font-weight: bold;
+ white-space: nowrap;
+ img {
+ margin-right: .5rem;
+ vertical-align: sub;
+ }
+ & ~ .choicebox__tooltipttl {
+ margin-top: 3rem;
+ }
+ }
+}
diff --git a/src/app/pages/voting/voting-choice/voting-choice.component.ts b/src/app/pages/voting/voting-choice/voting-choice.component.ts
index 532427fd..92159ea7 100644
--- a/src/app/pages/voting/voting-choice/voting-choice.component.ts
+++ b/src/app/pages/voting/voting-choice/voting-choice.component.ts
@@ -1,20 +1,70 @@
-import { Component, OnInit } from '@angular/core';
-import {BaseComponent} from "../../base-page/base.component";
+import {Component, ElementRef, Input} from '@angular/core';
import {ConfigService} from "../../../services/config.service";
-@Component({
- selector: 'framadate-voting-choice',
- templateUrl: './voting-choice.component.html',
- styleUrls: ['./voting-choice.component.scss']
-})
-export class VotingChoiceComponent extends BaseComponent implements OnInit {
+interface VoteChoice {
+ votes?: {
+ yes: number
+ no: number
+ maybe: number
+ notAnswered: number
+ };
+ name?: string;
+ date?: Date;
+ answer: 'yes' | 'no' | 'maybe' | null;
+ simpleAnswer?: boolean
+ false; // enable if we display only a togglable "yes"
+}
- constructor(public config: ConfigService) {
- super(config);
+/**
+ * each vote choice takes a configuration from the container of all choices.
+ * this component is used to select a date choice, or a name answer
+ */
+@Component({
+ selector: 'framadate-voting-choice',
+ templateUrl: './voting-choice.component.html',
+ styleUrls: ['./voting-choice.component.scss']
+})
+export class VotingChoiceComponent {
+
+ public showChangeChoicebutton = false;
+ @Input() public choice: any;
+ @Input() public choices_count: any;
+ @Input() public choice_id: any;
+ @Input() public poll: any;
+ @Input() public simpleAnswer: boolean = true;
+ @Input() public pollIsSpecialDate: boolean = false;
+
+ constructor(private el: ElementRef,
+ private config: ConfigService) {
+
+ if (this.poll && this.poll.data && this.poll.data.allowedAnswers) {
+ this.simpleAnswer = this.poll.data.allowedAnswers.length == 1
+ }
}
+ setAnswserTo(newAnswer: 'yes' | 'no' | 'maybe' | null) {
+ if (this.simpleAnswer) {
+ // only toggle yes to no
+ if (this.choice.answer && this.choice.answer === 'yes') {
+ this.choice.answer = 'no';
+ this.config.myTempVoteStack--;
+ } else {
+ this.choice.answer = 'yes';
+ this.config.myTempVoteStack++;
+ }
- ngOnInit() {
- }
+ } else {
+ this.choice.answer = newAnswer;
+ if (this.choice.answer !== newAnswer) {
+ if (newAnswer == 'maybe' || newAnswer == 'yes') {
+ this.config.myTempVoteStack++;
+ }
+ } else {
+ console.info('same answer as before')
+ }
+
+ }
+ this.el.nativeElement.blur();
+ }
}
diff --git a/src/app/pages/voting/voting-summary/voting-summary.component.html b/src/app/pages/voting/voting-summary/voting-summary.component.html
index fedb4545..dda20167 100644
--- a/src/app/pages/voting/voting-summary/voting-summary.component.html
+++ b/src/app/pages/voting/voting-summary/voting-summary.component.html
@@ -95,6 +95,7 @@
>
+
{
+ choice.answer = null;
+ })
+ }
+
/**
* update current answers with a previous vote
* @param voteStack
@@ -309,6 +315,7 @@ export class ConfigService extends PollConfig {
this.myVoteStack = voteStack;
let keys = Object.keys(voteStack.votes)
console.log('voteStack', voteStack);
+ this.resetCurrentChoicesAnswers();
keys.forEach((id: any) => {
let voteItem = voteStack.votes[id];
diff --git a/src/app/ui/vote-choice/vote-choice.component.html b/src/app/ui/vote-choice/vote-choice.component.html
deleted file mode 100644
index 53d04eec..00000000
--- a/src/app/ui/vote-choice/vote-choice.component.html
+++ /dev/null
@@ -1,171 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- {{choice.text}}
-
-
-
-
-
-
-
-
-
- {{choice.date.date | date:'EEE'}} {{choice.date.date | date:'dd'}} {{choice.date.date | date:'LLL'}}
-
-
- {{choice.date.date | date:'H:m'}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- aucun vote
-
-
-
- {{poll.choices_count.counts[choice.id].yes.count}}
-
-
-
- {{poll.choices_count.counts[choice.id].maybe.count}}
-
-
-
-
-
- Choix ayant reçu le plus de votes
-
-
-
-
-
-
-
-
diff --git a/src/app/ui/vote-choice/vote-choice.component.scss b/src/app/ui/vote-choice/vote-choice.component.scss
deleted file mode 100644
index afbee2df..00000000
--- a/src/app/ui/vote-choice/vote-choice.component.scss
+++ /dev/null
@@ -1,276 +0,0 @@
-// ---------------------------------------------------------
-// -- VOTE CHOICE COMPONENT
-// ---------------------------------------------------------
-
-// -- IMPORTS
-// ----------------------------
-
-@import "../../../assets/scss/variables";
-
-
-// -- VARIABLES
-// ----------------------------
-
-$box-padding: 2rem;
-$box-border-width: .6rem;
-$btn-size: 5rem;
-$btn-margin-x: 1rem;
-$btn-margin-y: 1.5rem;
-$btn-wrap-size: calc(2 * #{$btn-size} + 4 * #{$btn-margin-x});
-$img-maxheight: 12rem;
-$breakpoint-responsive: 640px; // à définir
-
-
-// -- GLOBAL
-// ----------------------------
-
-.choicebox {
- position: relative;
- min-width: 32rem;
- min-height: 16rem;
- display: block;
- padding: $box-padding $box-padding $box-padding calc(#{$box-padding} - #{$box-border-width});
- border-left: $box-border-width solid transparent;
- background-color: $white;
- box-shadow: 0 0 .6rem 0 rgba($black, .2);
-
- &--active {
- padding-left: $box-padding;
- border-left-color: $primary_color;
- }
-
- &.selection-yes {
- font-weight: 700;
- background: #e9bdeb;
- }
-
- @media (min-width: $breakpoint-responsive) {
- align-items: center;
- justify-content: space-between;
- min-height: auto;
- }
-
- .title {
- max-width: 25%;
- }
-}
-
-.choicebox__subject {
- margin-bottom: 3rem;
- padding-right: $btn-wrap-size;
- @media (min-width: $breakpoint-responsive) {
- margin-bottom: 0;
- padding-right: 0;
- }
-}
-
-
-// -- DATE
-// ----------------------------
-
-.choicebox__date {
- font-size: 1.8rem;
- margin-bottom: .5rem;
- white-space: nowrap;
- text-transform: capitalize;
-
- @media (min-width: $breakpoint-responsive) {
- margin-bottom: 0;
- }
-}
-
-.choicebox__day {
- font-size: 2.4rem;
- font-weight: bold;
-}
-
-
-// -- IMG
-// ----------------------------
-
-.choicebox__img {
- max-width: 100%;
- max-height: $img-maxheight;
-}
-
-
-// -- TXT
-// ----------------------------
-
-.choicebox__txt {
- margin: 0;
- font-size: 1.8rem;
- min-width: 10em;
-}
-
-
-// -- VOTE BTNS
-// ----------------------------
-
-.choicebox__actions {
- position: absolute;
- z-index: 1;
-
- max-width: $btn-wrap-size;
- top: 50%;
- right: $box-padding;
-
- @media (min-width: $breakpoint-responsive) {
- position: static;
- max-width: none;
- transform: none;
- margin: 0 1.5rem;
- }
-}
-
-.choicebox__btn {
- width: $btn-size;
- height: $btn-size;
- align-items: center;
- justify-content: center;
- margin: $btn-margin-y $btn-margin-x;
- border: .3rem solid #ccc9c9;
- background-color: transparent;
- border-radius: 50%;
- cursor: pointer;
- float: left;
-
- &--maybe {
- position: relative;
- top: calc((#{$btn-size} + 2 * #{$btn-margin-y}) / 2);
- @media (min-width: $breakpoint-responsive) {
- top: auto;
- left: auto;
- }
- }
-
- &--active {
- border-color: #bf83c2;
- }
-
- @media (min-width: $breakpoint-responsive) {
- margin-top: 0;
- margin-bottom: 0;
- }
-
-}
-
-
-// -- VOTE COUNT
-// ----------------------------
-
-.choicebox__count {
- position: relative;
- padding-right: $btn-wrap-size;
- @media (min-width: $breakpoint-responsive) {
- text-align: right;
- padding-right: 0;
- }
-}
-
-.choicebox__votes {
- border: 0;
- padding: 0;
- line-height: normal;
- background-color: transparent;
- @media (min-width: $breakpoint-responsive) {
- padding: 1.5rem;
- }
-}
-
-.choicebox__vote {
- display: inline-block;
- vertical-align: middle;
-
- & + .choicebox__vote {
- margin-left: 1.5rem;
- }
-}
-
-.choicebox__countxt {
- display: none;
- margin-top: .5rem;
-
- .choicebox--active & {
- display: block;
- @media (min-width: $breakpoint-responsive) {
- display: none;
- }
- }
-}
-
-
-// -- TOOLTIP
-// ----------------------------
-
-.choicebox__tooltip {
- display: none;
- @media (min-width: $breakpoint-responsive) {
- position: absolute;
- min-width: 18rem;
- font-weight: normal;
- top: 5rem;
- left: 50%;
- z-index: 1;
- padding: 2rem;
- border: .1rem solid rgba($black, .1);
- background-color: $white;
- text-align: left;
- transform: translateX(-50%);
- &::after,
- &::before {
- position: absolute;
- width: 0;
- height: 0;
- bottom: 100%;
- left: 50%;
- content: " ";
- pointer-events: none;
- border: solid transparent;
- }
- &::after {
- margin-left: -1.5rem;
- border-width: 1.5rem;
- border-color: rgba($white, 0);
- border-bottom-color: #fff;
- }
- &::before {
- margin-left: -1.6rem;
- border-width: 1.6rem;
- border-color: rgba($black, 0);
- border-bottom-color: rgba($black, .1);
- }
- ul {
- margin: 0;
- padding: 0;
- list-style: none;
- }
- }
-}
-
-.choicebox__tooltiplist {
- & + .choicebox__tooltiplist {
- padding-left: 3rem;
- }
-
- ul {
- max-height: 11rem;
- overflow: auto;
- }
-}
-
-.choicebox__tooltipttl {
- @media (min-width: $breakpoint-responsive) {
- margin-bottom: 1rem;
- font-size: 1.6rem;
- font-weight: bold;
- white-space: nowrap;
- img {
- margin-right: .5rem;
- vertical-align: sub;
- }
- & ~ .choicebox__tooltipttl {
- margin-top: 3rem;
- }
- }
-}
diff --git a/src/app/ui/vote-choice/vote-choice.component.spec.ts b/src/app/ui/vote-choice/vote-choice.component.spec.ts
deleted file mode 100644
index f24b9070..00000000
--- a/src/app/ui/vote-choice/vote-choice.component.spec.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { VoteChoiceComponent } from './vote-choice.component';
-
-describe('VoteChoiceComponent', () => {
- let component: VoteChoiceComponent;
- let fixture: ComponentFixture;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ VoteChoiceComponent ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(VoteChoiceComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/src/app/ui/vote-choice/vote-choice.component.ts b/src/app/ui/vote-choice/vote-choice.component.ts
deleted file mode 100644
index a54656b2..00000000
--- a/src/app/ui/vote-choice/vote-choice.component.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import {Component, ElementRef, Input} from '@angular/core';
-import {ConfigService} from "../../services/config.service";
-
-interface VoteChoice {
- votes?: {
- yes: number
- no: number
- maybe: number
- notAnswered: number
- };
- name?: string;
- date?: Date;
- answer: 'yes' | 'no' | 'maybe' | null;
- simpleAnswer?: boolean
- false; // enable if we display only a togglable "yes"
-}
-
-/**
- * each vote choice takes a configuration from the container of all choices.
- * this component is used to select a date choice, or a name answer
- */
-@Component({
- selector: 'framadate-vote-choice',
- templateUrl: './vote-choice.component.html',
- styleUrls: ['./vote-choice.component.scss']
-})
-export class VoteChoiceComponent {
-
- public showChangeChoicebutton = false;
- @Input() public choice: any;
- @Input() public choices_count: any;
- @Input() public choice_id: any;
- @Input() public poll: any;
- @Input() public simpleAnswer: boolean = true;
- @Input() public pollIsSpecialDate: boolean = false;
-
- constructor(private el: ElementRef,
- private config: ConfigService) {
-
- if (this.poll && this.poll.data && this.poll.data.allowedAnswers) {
- this.simpleAnswer = this.poll.data.allowedAnswers.length == 1
- }
- }
-
- setAnswserTo(newAnswer: 'yes' | 'no' | 'maybe' | null) {
- if (this.simpleAnswer) {
- // only toggle yes to no
- if (this.choice.answer && this.choice.answer === 'yes') {
- this.choice.answer = 'no';
- this.config.myTempVoteStack--;
- } else {
- this.choice.answer = 'yes';
- this.config.myTempVoteStack++;
- }
-
- } else {
- this.choice.answer = newAnswer;
- if (this.choice.answer !== newAnswer) {
- if (newAnswer == 'maybe' || newAnswer == 'yes') {
- this.config.myTempVoteStack++;
- }
- } else {
- console.info('same answer as before')
- }
-
- }
- this.el.nativeElement.blur();
- }
-
-}