build for production, 🐛 fix publicy of vars in templates

This commit is contained in:
Baptiste Lemoine 2020-01-22 11:18:55 +01:00
parent d2c726012b
commit ea43430e1b
20 changed files with 656 additions and 287 deletions

View File

@ -1,18 +1,19 @@
{ {
"name": "framadate-funky-frontend", "name": "framadate-funky-frontend",
"version": "0.1.0", "version": "1.0.0",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"serve": "ng serve", "serve": "ng serve",
"build": "ng build --crossOrigin=anonymous --aot=false", "build": "ng build --crossOrigin=anonymous --aot=false",
"build:demo": "ng build --crossOrigin=anonymous --extractCss=true --baseHref=https://framadate-api.cipherbliss.com --aot=true --progress=true --statsJson=true", "package": " cat dist/framadate/{polyfills,runtime,main}.js > ./package.js",
"build:demo": "ng build --crossOrigin=anonymous --extractCss=true --baseHref=https://framadate-api.cipherbliss.com --progress=true --output-hashing=none --prod && npm run package",
"test": "ng test", "test": "ng test",
"lint": "ng lint", "lint": "ng lint",
"e2e": "ng e2e", "e2e": "ng e2e",
"trans": "ng xi18n --output-path=src/locale --i18n-locale=fr" "trans": "ng xi18n --output-path=src/locale --i18n-locale=fr"
}, },
"private": true, "private": false,
"dependencies": { "dependencies": {
"@angular/animations": "^8.2.14", "@angular/animations": "^8.2.14",
"@angular/cdk": "^8.2.3", "@angular/cdk": "^8.2.3",

View File

@ -2,8 +2,7 @@
* une option de date dans les sondages spéciaux * une option de date dans les sondages spéciaux
*/ */
import {environment} from "../../environments/environment"; import {environment} from "../../environments/environment";
import {mockMyPolls} from "./mocks/mockmypolls"; import {defaultAnswers} from "./defaultConfigs";
import {defaultAnswers, defaultDates, timeOfDay} from "./defaultConfigs";
export interface DateOption { export interface DateOption {
timeList: any; timeList: any;
@ -33,7 +32,7 @@ export class PollConfig {
myComment: string = 'wouah trop bien framadate!'; myComment: string = 'wouah trop bien framadate!';
isAdmin: boolean = true; isAdmin: boolean = true;
myEmail: string = "tktest@tktest.com"; myEmail: string = "tktest@tktest.com";
myPolls: any = mockMyPolls;// list of retrieved polls from the backend api myPolls: any;// list of retrieved polls from the backend api
// date specific poll, we have the choice to setup different hours (timeList) for all possible dates (dateList), or use the same hours for all dates // date specific poll, we have the choice to setup different hours (timeList) for all possible dates (dateList), or use the same hours for all dates
allowSeveralHours = 'false'; allowSeveralHours = 'false';
// access // access
@ -42,7 +41,7 @@ export class PollConfig {
creationDate = new Date(); creationDate = new Date();
expirationDate = ''; // expiracy date expirationDate = ''; // expiracy date
pollId = null; // id of the current poll when created. data given by the backend api pollId = null; // id of the current poll when created. data given by the backend api
selectedPoll = null; // current poll selected with createPoll or getPoll of ConfigService currentPoll; // current poll selected with createPoll or getPoll of ConfigService
passwordAccess = 0; passwordAccess = 0;
password = ''; password = '';
customUrl = ''; // custom slug in the url, must be unique customUrl = ''; // custom slug in the url, must be unique
@ -52,8 +51,8 @@ export class PollConfig {
canModifyAnswers = 1;// everybody, self, nobody (= just admin) canModifyAnswers = 1;// everybody, self, nobody (= just admin)
whoModifiesAnswers = "self";// everybody, self, nobody (= just admin) whoModifiesAnswers = "self";// everybody, self, nobody (= just admin)
whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin) whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin)
dateList: DateOption[] = defaultDates; // sets of days as strings, config to set identical time for days in a special days poll dateList: DateOption[]; // sets of days as strings, config to set identical time for days in a special days poll
timeList: DateOption[] = timeOfDay; // ranges of time expressed as strings timeList: DateOption[]; // ranges of time expressed as strings
answers: any = defaultAnswers; answers: any = defaultAnswers;

View File

@ -1,5 +1,5 @@
{ {
"message": "your poll config v2", "message": "your poll config",
"data": { "data": {
"id": 3, "id": 3,
"title": "dessin animé préféré", "title": "dessin animé préféré",
@ -38,8 +38,8 @@
"defaultExpiracyDaysFromNow": 60 "defaultExpiracyDaysFromNow": 60
}, },
"stacks_count": 10, "stacks_count": 10,
"stacks": { "stacks": [
"3": { {
"id": 3, "id": 3,
"pseudo": "voting_people_TEST", "pseudo": "voting_people_TEST",
"creation_date": { "creation_date": {
@ -47,24 +47,24 @@
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
}, },
"votes": { "votes": [
"4": { {
"id": 3, "id": 3,
"vote_id": 4, "vote_id": 4,
"value": "yes", "value": "yes",
"choice_id": 7, "choice_id": 7,
"text": "Les mystérieuses cités d'or" "text": "Les mystérieuses cités d'or"
}, },
"5": { {
"id": 3, "id": 3,
"vote_id": 5, "vote_id": 5,
"value": "maybe", "value": "maybe",
"choice_id": 6, "choice_id": 6,
"text": "Boumbo petite automobile" "text": "Boumbo petite automobile"
} }
} ]
}, },
"4": { {
"id": 4, "id": 4,
"pseudo": "voting_people_TEST", "pseudo": "voting_people_TEST",
"creation_date": { "creation_date": {
@ -72,31 +72,31 @@
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
}, },
"votes": { "votes": [
"6": { {
"id": 4, "id": 4,
"vote_id": 6, "vote_id": 6,
"value": "yes", "value": "yes",
"choice_id": 6, "choice_id": 6,
"text": "Boumbo petite automobile" "text": "Boumbo petite automobile"
}, },
"7": { {
"id": 4, "id": 4,
"vote_id": 7, "vote_id": 7,
"value": "yes", "value": "yes",
"choice_id": 7, "choice_id": 7,
"text": "Les mystérieuses cités d'or" "text": "Les mystérieuses cités d'or"
}, },
"8": { {
"id": 4, "id": 4,
"vote_id": 8, "vote_id": 8,
"value": "no", "value": "no",
"choice_id": 7, "choice_id": 7,
"text": "Les mystérieuses cités d'or" "text": "Les mystérieuses cités d'or"
} }
} ]
}, },
"5": { {
"id": 5, "id": 5,
"pseudo": "voting_people_TEST", "pseudo": "voting_people_TEST",
"creation_date": { "creation_date": {
@ -104,31 +104,31 @@
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
}, },
"votes": { "votes": [
"9": { {
"id": 5, "id": 5,
"vote_id": 9, "vote_id": 9,
"value": "no", "value": "no",
"choice_id": 5, "choice_id": 5,
"text": "Vic le viking" "text": "Vic le viking"
}, },
"10": { {
"id": 5, "id": 5,
"vote_id": 10, "vote_id": 10,
"value": "maybe", "value": "maybe",
"choice_id": 6, "choice_id": 6,
"text": "Boumbo petite automobile" "text": "Boumbo petite automobile"
}, },
"11": { {
"id": 5, "id": 5,
"vote_id": 11, "vote_id": 11,
"value": "yes", "value": "yes",
"choice_id": 7, "choice_id": 7,
"text": "Les mystérieuses cités d'or" "text": "Les mystérieuses cités d'or"
} }
} ]
}, },
"6": { {
"id": 6, "id": 6,
"pseudo": "voting_people_TEST", "pseudo": "voting_people_TEST",
"creation_date": { "creation_date": {
@ -136,31 +136,31 @@
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
}, },
"votes": { "votes": [
"12": { {
"id": 6, "id": 6,
"vote_id": 12, "vote_id": 12,
"value": "no", "value": "no",
"choice_id": 5, "choice_id": 5,
"text": "Vic le viking" "text": "Vic le viking"
}, },
"13": { {
"id": 6, "id": 6,
"vote_id": 13, "vote_id": 13,
"value": "maybe", "value": "maybe",
"choice_id": 6, "choice_id": 6,
"text": "Boumbo petite automobile" "text": "Boumbo petite automobile"
}, },
"14": { {
"id": 6, "id": 6,
"vote_id": 14, "vote_id": 14,
"value": "yes", "value": "yes",
"choice_id": 7, "choice_id": 7,
"text": "Les mystérieuses cités d'or" "text": "Les mystérieuses cités d'or"
} }
} ]
}, },
"7": { {
"id": 7, "id": 7,
"pseudo": "voting_people_TEST", "pseudo": "voting_people_TEST",
"creation_date": { "creation_date": {
@ -168,31 +168,31 @@
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
}, },
"votes": { "votes": [
"15": { {
"id": 7, "id": 7,
"vote_id": 15, "vote_id": 15,
"value": "no", "value": "no",
"choice_id": 5, "choice_id": 5,
"text": "Vic le viking" "text": "Vic le viking"
}, },
"16": { {
"id": 7, "id": 7,
"vote_id": 16, "vote_id": 16,
"value": "maybe", "value": "maybe",
"choice_id": 6, "choice_id": 6,
"text": "Boumbo petite automobile" "text": "Boumbo petite automobile"
}, },
"17": { {
"id": 7, "id": 7,
"vote_id": 17, "vote_id": 17,
"value": "yes", "value": "yes",
"choice_id": 7, "choice_id": 7,
"text": "Les mystérieuses cités d'or" "text": "Les mystérieuses cités d'or"
} }
} ]
}, },
"8": { {
"id": 8, "id": 8,
"pseudo": "voting_people_TEST", "pseudo": "voting_people_TEST",
"creation_date": { "creation_date": {
@ -200,31 +200,31 @@
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
}, },
"votes": { "votes": [
"18": { {
"id": 8, "id": 8,
"vote_id": 18, "vote_id": 18,
"value": "no", "value": "no",
"choice_id": 5, "choice_id": 5,
"text": "Vic le viking" "text": "Vic le viking"
}, },
"19": { {
"id": 8, "id": 8,
"vote_id": 19, "vote_id": 19,
"value": "maybe", "value": "maybe",
"choice_id": 6, "choice_id": 6,
"text": "Boumbo petite automobile" "text": "Boumbo petite automobile"
}, },
"20": { {
"id": 8, "id": 8,
"vote_id": 20, "vote_id": 20,
"value": "yes", "value": "yes",
"choice_id": 7, "choice_id": 7,
"text": "Les mystérieuses cités d'or" "text": "Les mystérieuses cités d'or"
} }
} ]
}, },
"9": { {
"id": 9, "id": 9,
"pseudo": "voting_people_TEST", "pseudo": "voting_people_TEST",
"creation_date": { "creation_date": {
@ -232,31 +232,31 @@
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
}, },
"votes": { "votes": [
"21": { {
"id": 9, "id": 9,
"vote_id": 21, "vote_id": 21,
"value": "no", "value": "no",
"choice_id": 5, "choice_id": 5,
"text": "Vic le viking" "text": "Vic le viking"
}, },
"22": { {
"id": 9, "id": 9,
"vote_id": 22, "vote_id": 22,
"value": "maybe", "value": "maybe",
"choice_id": 6, "choice_id": 6,
"text": "Boumbo petite automobile" "text": "Boumbo petite automobile"
}, },
"23": { {
"id": 9, "id": 9,
"vote_id": 23, "vote_id": 23,
"value": "yes", "value": "yes",
"choice_id": 7, "choice_id": 7,
"text": "Les mystérieuses cités d'or" "text": "Les mystérieuses cités d'or"
} }
} ]
}, },
"10": { {
"id": 10, "id": 10,
"pseudo": "voting_people_TEST", "pseudo": "voting_people_TEST",
"creation_date": { "creation_date": {
@ -264,31 +264,31 @@
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
}, },
"votes": { "votes": [
"24": { {
"id": 10, "id": 10,
"vote_id": 24, "vote_id": 24,
"value": "no", "value": "no",
"choice_id": 5, "choice_id": 5,
"text": "Vic le viking" "text": "Vic le viking"
}, },
"25": { {
"id": 10, "id": 10,
"vote_id": 25, "vote_id": 25,
"value": "maybe", "value": "maybe",
"choice_id": 6, "choice_id": 6,
"text": "Boumbo petite automobile" "text": "Boumbo petite automobile"
}, },
"26": { {
"id": 10, "id": 10,
"vote_id": 26, "vote_id": 26,
"value": "yes", "value": "yes",
"choice_id": 7, "choice_id": 7,
"text": "Les mystérieuses cités d'or" "text": "Les mystérieuses cités d'or"
} }
} ]
}, },
"11": { {
"id": 11, "id": 11,
"pseudo": "voting_people_TEST", "pseudo": "voting_people_TEST",
"creation_date": { "creation_date": {
@ -296,31 +296,31 @@
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
}, },
"votes": { "votes": [
"27": { {
"id": 11, "id": 11,
"vote_id": 27, "vote_id": 27,
"value": "no", "value": "no",
"choice_id": 5, "choice_id": 5,
"text": "Vic le viking" "text": "Vic le viking"
}, },
"28": { {
"id": 11, "id": 11,
"vote_id": 28, "vote_id": 28,
"value": "maybe", "value": "maybe",
"choice_id": 6, "choice_id": 6,
"text": "Boumbo petite automobile" "text": "Boumbo petite automobile"
}, },
"29": { {
"id": 11, "id": 11,
"vote_id": 29, "vote_id": 29,
"value": "yes", "value": "yes",
"choice_id": 7, "choice_id": 7,
"text": "Les mystérieuses cités d'or" "text": "Les mystérieuses cités d'or"
} }
} ]
}, },
"12": { {
"id": 12, "id": 12,
"pseudo": "voting_people_TEST", "pseudo": "voting_people_TEST",
"creation_date": { "creation_date": {
@ -328,34 +328,34 @@
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
}, },
"votes": { "votes": [
"30": { {
"id": 12, "id": 12,
"vote_id": 30, "vote_id": 30,
"value": "no", "value": "no",
"choice_id": 5, "choice_id": 5,
"text": "Vic le viking" "text": "Vic le viking"
}, },
"31": { {
"id": 12, "id": 12,
"vote_id": 31, "vote_id": 31,
"value": "maybe", "value": "maybe",
"choice_id": 6, "choice_id": 6,
"text": "Boumbo petite automobile" "text": "Boumbo petite automobile"
}, },
"32": { {
"id": 12, "id": 12,
"vote_id": 32, "vote_id": 32,
"value": "yes", "value": "yes",
"choice_id": 7, "choice_id": 7,
"text": "Les mystérieuses cités d'or" "text": "Les mystérieuses cités d'or"
} }
} ]
} }
}, ],
"choices_count": 7, "choices_count": 7,
"choices": { "choices": [
"5": { {
"id": 5, "id": 5,
"date": { "date": {
"date": "2020-01-20 16:45:48.000000", "date": "2020-01-20 16:45:48.000000",
@ -364,7 +364,7 @@
}, },
"text": "Vic le viking" "text": "Vic le viking"
}, },
"6": { {
"id": 6, "id": 6,
"date": { "date": {
"date": "2020-01-20 16:45:48.000000", "date": "2020-01-20 16:45:48.000000",
@ -373,7 +373,7 @@
}, },
"text": "Boumbo petite automobile" "text": "Boumbo petite automobile"
}, },
"7": { {
"id": 7, "id": 7,
"date": { "date": {
"date": "2020-01-20 16:45:48.000000", "date": "2020-01-20 16:45:48.000000",
@ -382,7 +382,7 @@
}, },
"text": "Les mystérieuses cités d'or" "text": "Les mystérieuses cités d'or"
}, },
"8": { {
"id": 8, "id": 8,
"date": { "date": {
"date": "2020-01-20 16:45:48.000000", "date": "2020-01-20 16:45:48.000000",
@ -391,7 +391,7 @@
}, },
"text": "Les mondes engloutis" "text": "Les mondes engloutis"
}, },
"9": { {
"id": 9, "id": 9,
"date": { "date": {
"date": "2020-01-20 16:45:48.000000", "date": "2020-01-20 16:45:48.000000",
@ -400,7 +400,7 @@
}, },
"text": "Foot 2 rue" "text": "Foot 2 rue"
}, },
"10": { {
"id": 10, "id": 10,
"date": { "date": {
"date": "2020-01-20 16:45:48.000000", "date": "2020-01-20 16:45:48.000000",
@ -409,7 +409,7 @@
}, },
"text": "Le chat, la vache, et l'océan" "text": "Le chat, la vache, et l'océan"
}, },
"11": { {
"id": 11, "id": 11,
"date": { "date": {
"date": "2020-01-20 16:45:48.000000", "date": "2020-01-20 16:45:48.000000",
@ -418,9 +418,9 @@
}, },
"text": "Digimon" "text": "Digimon"
} }
}, ],
"comments": { "comments": [
"3": { {
"id": 3, "id": 3,
"text": "wouah trop bien framadate!", "text": "wouah trop bien framadate!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -430,7 +430,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"4": { {
"id": 4, "id": 4,
"text": "wouah trop bien framadate!", "text": "wouah trop bien framadate!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -440,7 +440,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"5": { {
"id": 5, "id": 5,
"text": "wouah trop bien framadate!", "text": "wouah trop bien framadate!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -450,7 +450,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"6": { {
"id": 6, "id": 6,
"text": "wouah trop bien framadate!", "text": "wouah trop bien framadate!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -460,7 +460,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"7": { {
"id": 7, "id": 7,
"text": "wouah trop bien framadate!", "text": "wouah trop bien framadate!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -470,7 +470,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"8": { {
"id": 8, "id": 8,
"text": "wouah trop bien framadate!", "text": "wouah trop bien framadate!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -480,7 +480,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"9": { {
"id": 9, "id": 9,
"text": "wouah trop bien framadate!", "text": "wouah trop bien framadate!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -490,7 +490,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"10": { {
"id": 10, "id": 10,
"text": "wouah trop bien framadate!", "text": "wouah trop bien framadate!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -500,7 +500,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"11": { {
"id": 11, "id": 11,
"text": "wouah trop bien framadate!", "text": "wouah trop bien framadate!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -510,7 +510,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"12": { {
"id": 12, "id": 12,
"text": "wouah trop bien framadate!", "text": "wouah trop bien framadate!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -520,7 +520,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"13": { {
"id": 13, "id": 13,
"text": "wouah trop bien framadate!", "text": "wouah trop bien framadate!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -530,7 +530,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"14": { {
"id": 14, "id": 14,
"text": "wouah trop bien framadate wouhouuu!", "text": "wouah trop bien framadate wouhouuu!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -540,7 +540,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"15": { {
"id": 15, "id": 15,
"text": "wouah trop bien framadate wouhouucghfdghu!", "text": "wouah trop bien framadate wouhouucghfdghu!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -550,7 +550,7 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
}, },
"16": { {
"id": 16, "id": 16,
"text": "wouah trop bien framadate woudghdghhouucghfdghu!", "text": "wouah trop bien framadate woudghdghhouucghfdghu!",
"pseudo": "tk_TEST", "pseudo": "tk_TEST",
@ -560,6 +560,6 @@
"timezone": "Europe/Berlin" "timezone": "Europe/Berlin"
} }
} }
}, ],
"comments_count": 14 "comments_count": 14
} }

View File

@ -1,12 +1,12 @@
export const mockComments = [ export const mockComments = [
{ {
name: "Bulbizarre", pseudo: "Bulbizarre",
date: "23 décembre 2019", date: "23 décembre 2019",
text: "Pokem ipsum dolor sit amet Electric Cottonee Scratch Leech Life Ice Berry Ducklett. Leaf Green Durant Zoroark\n" + text: "Pokem ipsum dolor sit amet Electric Cottonee Scratch Leech Life Ice Berry Ducklett. Leaf Green Durant Zoroark\n" +
" Skitty Rock Luxio Surskit. Glacier Badge", " Skitty Rock Luxio Surskit. Glacier Badge",
}, },
{ {
name: "Marylin", pseudo: "Marylin",
date: "5 Janvier 2020", date: "5 Janvier 2020",
text: "j'ai vu de la lumière o_o", text: "j'ai vu de la lumière o_o",
}, },

View File

@ -1,5 +1,3 @@
import {mockComments} from "./mock-comments";
export const mockPoll3 = { export const mockPoll3 = {
"message": "your poll config", "message": "your poll config",
"data": { "data": {
@ -8,19 +6,21 @@ export const mockPoll3 = {
"customUrl": null, "customUrl": null,
"description": "choisissez votre animé préféré", "description": "choisissez votre animé préféré",
"creationDate": { "creationDate": {
"date": "2020-01-15 15:07:53.000000", "date": "2020-01-20 16:45:48.000000",
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Paris" "timezone": "Europe/Berlin"
}, },
"expiracyDate": { "expiracyDate": {
"date": "2020-03-17 15:07:53.000000", "date": "2020-01-20 16:45:48.000000",
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Paris" "timezone": "Europe/Berlin"
}, },
"owner": { "owner": {
"__initializer__": {}, "__initializer__": null,
"__cloner__": {}, "__cloner__": null,
"__isInitialized__": false "__isInitialized__": true,
"pseudo": "tk_TEST",
"email": "tktest@tktest.com"
}, },
"kind": "text", "kind": "text",
"allowedAnswers": [ "allowedAnswers": [
@ -37,65 +37,318 @@ export const mockPoll3 = {
"comments": {}, "comments": {},
"defaultExpiracyDaysFromNow": 60 "defaultExpiracyDaysFromNow": 60
}, },
"stacks_count": 4, "stacks_count": 10,
"stacks": [ "stacks": [
{ {
"pseudo": "Wulfila", "id": 3,
"pseudo": "voting_people_TEST",
"creation_date": {
"date": "2020-01-20 16:45:48.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
},
"votes": [
{
"id": 3,
"vote_id": 4,
"value": "yes",
"choice_id": 7,
"text": "Les mystérieuses cités d'or"
},
{
"id": 3,
"vote_id": 5,
"value": "maybe",
"choice_id": 6,
"text": "Boumbo petite automobile"
}
]
},
{
"id": 4,
"pseudo": "voting_people_TEST",
"creation_date": {
"date": "2020-01-20 16:45:48.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
},
"votes": [
{
"id": 4,
"vote_id": 6,
"value": "yes",
"choice_id": 6,
"text": "Boumbo petite automobile"
},
{
"id": 4,
"vote_id": 7,
"value": "yes",
"choice_id": 7,
"text": "Les mystérieuses cités d'or"
},
{
"id": 4,
"vote_id": 8,
"value": "no",
"choice_id": 7,
"text": "Les mystérieuses cités d'or"
}
]
},
{
"id": 5,
"pseudo": "voting_people_TEST",
"creation_date": {
"date": "2020-01-21 10:33:26.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
},
"votes": [ "votes": [
{ {
"id": 5, "id": 5,
"answer": "yes", "vote_id": 9,
"value": "no",
"choice_id": 5,
"text": "Vic le viking"
},
{
"id": 5,
"vote_id": 10,
"value": "maybe",
"choice_id": 6,
"text": "Boumbo petite automobile"
},
{
"id": 5,
"vote_id": 11,
"value": "yes",
"choice_id": 7,
"text": "Les mystérieuses cités d'or"
}
]
},
{
"id": 6,
"pseudo": "voting_people_TEST",
"creation_date": {
"date": "2020-01-21 10:36:58.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
},
"votes": [
{
"id": 6,
"vote_id": 12,
"value": "no",
"choice_id": 5,
"text": "Vic le viking"
}, },
{ {
"id": 6, "id": 6,
"answer": "maybe", "vote_id": 13,
"value": "maybe",
"choice_id": 6,
"text": "Boumbo petite automobile"
},
{
"id": 6,
"vote_id": 14,
"value": "yes",
"choice_id": 7,
"text": "Les mystérieuses cités d'or"
}
]
},
{
"id": 7,
"pseudo": "voting_people_TEST",
"creation_date": {
"date": "2020-01-21 10:39:12.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
},
"votes": [
{
"id": 7,
"vote_id": 15,
"value": "no",
"choice_id": 5,
"text": "Vic le viking"
}, },
{ {
"id": 7, "id": 7,
"answer": "no", "vote_id": 16,
"value": "maybe",
"choice_id": 6,
"text": "Boumbo petite automobile"
}, },
{
"id": 7,
"vote_id": 17,
"value": "yes",
"choice_id": 7,
"text": "Les mystérieuses cités d'or"
}
] ]
}, },
{ {
"pseudo": "Tykayn", "id": 8,
"pseudo": "voting_people_TEST",
"creation_date": {
"date": "2020-01-21 10:39:13.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
},
"votes": [ "votes": [
{ {
"id": 5, "id": 8,
"answer": "yes", "vote_id": 18,
"value": "no",
"choice_id": 5,
"text": "Vic le viking"
}, },
{ {
"id": 8, "id": 8,
"answer": "maybe", "vote_id": 19,
}, "value": "maybe",
{ "choice_id": 6,
"id": 9, "text": "Boumbo petite automobile"
"answer": "no",
},
]
},
{
"pseudo": "CopyCat",
"votes": [
{
"id": 5,
"answer": "yes",
}, },
{ {
"id": 8, "id": 8,
"answer": "maybe", "vote_id": 20,
}, "value": "yes",
{ "choice_id": 7,
"id": 9, "text": "Les mystérieuses cités d'or"
"answer": "no", }
},
] ]
}, },
{ {
"pseudo": "Marylin", "id": 9,
"pseudo": "voting_people_TEST",
"creation_date": {
"date": "2020-01-21 10:42:19.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
},
"votes": [ "votes": [
{ {
"id": 5, "id": 9,
"answer": "yes", "vote_id": 21,
"value": "no",
"choice_id": 5,
"text": "Vic le viking"
},
{
"id": 9,
"vote_id": 22,
"value": "maybe",
"choice_id": 6,
"text": "Boumbo petite automobile"
},
{
"id": 9,
"vote_id": 23,
"value": "yes",
"choice_id": 7,
"text": "Les mystérieuses cités d'or"
}
]
},
{
"id": 10,
"pseudo": "voting_people_TEST",
"creation_date": {
"date": "2020-01-21 10:42:32.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
},
"votes": [
{
"id": 10,
"vote_id": 24,
"value": "no",
"choice_id": 5,
"text": "Vic le viking"
},
{
"id": 10,
"vote_id": 25,
"value": "maybe",
"choice_id": 6,
"text": "Boumbo petite automobile"
},
{
"id": 10,
"vote_id": 26,
"value": "yes",
"choice_id": 7,
"text": "Les mystérieuses cités d'or"
}
]
},
{
"id": 11,
"pseudo": "voting_people_TEST",
"creation_date": {
"date": "2020-01-21 10:43:46.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
},
"votes": [
{
"id": 11,
"vote_id": 27,
"value": "no",
"choice_id": 5,
"text": "Vic le viking"
},
{
"id": 11,
"vote_id": 28,
"value": "maybe",
"choice_id": 6,
"text": "Boumbo petite automobile"
},
{
"id": 11,
"vote_id": 29,
"value": "yes",
"choice_id": 7,
"text": "Les mystérieuses cités d'or"
}
]
},
{
"id": 12,
"pseudo": "voting_people_TEST",
"creation_date": {
"date": "2020-01-21 10:44:35.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
},
"votes": [
{
"id": 12,
"vote_id": 30,
"value": "no",
"choice_id": 5,
"text": "Vic le viking"
},
{
"id": 12,
"vote_id": 31,
"value": "maybe",
"choice_id": 6,
"text": "Boumbo petite automobile"
},
{
"id": 12,
"vote_id": 32,
"value": "yes",
"choice_id": 7,
"text": "Les mystérieuses cités d'or"
} }
] ]
} }
@ -104,137 +357,209 @@ export const mockPoll3 = {
"choices": [ "choices": [
{ {
"id": 5, "id": 5,
"name": "Vic le viking", "date": {
"dateTime": { "date": "2020-01-20 16:45:48.000000",
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Paris" "timezone": "Europe/Berlin"
}, },
"votes": { "text": "Vic le viking"
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
}, },
{ {
"id": 6, "id": 6,
"name": "Boumbo petite automobile", "date": {
"dateTime": { "date": "2020-01-20 16:45:48.000000",
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Paris" "timezone": "Europe/Berlin"
}, },
"votes": { "text": "Boumbo petite automobile"
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
}, },
{ {
"id": 7, "id": 7,
"name": "Les mystérieuses cités d'or", "date": {
"dateTime": { "date": "2020-01-20 16:45:48.000000",
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Paris" "timezone": "Europe/Berlin"
}, },
"votes": { "text": "Les mystérieuses cités d'or"
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
}, },
{ {
"id": 8, "id": 8,
"name": "Les mondes engloutis", "date": {
"dateTime": { "date": "2020-01-20 16:45:48.000000",
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Paris" "timezone": "Europe/Berlin"
}, },
"votes": { "text": "Les mondes engloutis"
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
}, },
{ {
"id": 9, "id": 9,
"name": "Foot 2 rue", "date": {
"dateTime": { "date": "2020-01-20 16:45:48.000000",
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Paris" "timezone": "Europe/Berlin"
}, },
"votes": { "text": "Foot 2 rue"
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
}, },
{ {
"id": 10, "id": 10,
"name": "Le chat, la vache, et l'océan", "date": {
"dateTime": { "date": "2020-01-20 16:45:48.000000",
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Paris" "timezone": "Europe/Berlin"
}, },
"votes": { "text": "Le chat, la vache, et l'océan"
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
}, },
{ {
"id": 11, "id": 11,
"name": "Digimon", "date": {
"dateTime": { "date": "2020-01-20 16:45:48.000000",
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3, "timezone_type": 3,
"timezone": "Europe/Paris" "timezone": "Europe/Berlin"
}, },
"votes": { "text": "Digimon"
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
} }
], ],
"comments": mockComments "comments": [
{
"id": 3,
"text": "wouah trop bien framadate!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-20 16:58:56.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 4,
"text": "wouah trop bien framadate!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-20 16:59:48.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 5,
"text": "wouah trop bien framadate!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-21 10:12:02.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 6,
"text": "wouah trop bien framadate!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-21 10:12:34.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 7,
"text": "wouah trop bien framadate!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-21 10:14:20.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 8,
"text": "wouah trop bien framadate!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-21 10:15:09.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 9,
"text": "wouah trop bien framadate!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-21 10:15:10.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 10,
"text": "wouah trop bien framadate!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-21 10:15:35.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 11,
"text": "wouah trop bien framadate!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-21 10:26:58.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 12,
"text": "wouah trop bien framadate!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-21 10:27:03.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 13,
"text": "wouah trop bien framadate!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-21 10:27:10.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 14,
"text": "wouah trop bien framadate wouhouuu!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-21 10:34:04.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 15,
"text": "wouah trop bien framadate wouhouucghfdghu!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-21 10:36:33.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
},
{
"id": 16,
"text": "wouah trop bien framadate woudghdghhouucghfdghu!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-21 10:50:43.000000",
"timezone_type": 3,
"timezone": "Europe/Berlin"
}
}
],
"comments_count": 14
}; };

View File

@ -28,7 +28,7 @@
<button <button
class="btn btn--primary" class="btn btn--primary"
i18n i18n
(click)="config.getPollById(1, 'example password')" (click)="config.getPollById( '1', 'example password')"
> >
get poll 1 get poll 1
</button > </button >

View File

@ -1,16 +1,17 @@
import { Component, OnInit } from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {BaseComponent} from '../base-page/base.component';
import {ConfigService} from '../../services/config.service'; import {ConfigService} from '../../services/config.service';
@Component({ @Component({
selector: 'framadate-admin', selector: 'framadate-admin',
templateUrl: './admin.component.html', templateUrl: './admin.component.html',
styleUrls: ['./admin.component.scss'] styleUrls: ['./admin.component.scss']
}) })
export class AdminComponent implements OnInit { export class AdminComponent implements OnInit {
constructor(private config : ConfigService) { } constructor(public config: ConfigService) {
}
ngOnInit() { ngOnInit() {
} }
} }

View File

@ -11,11 +11,11 @@ import {DOCUMENT} from '@angular/common';
}) })
export class AnswersComponent extends BaseComponent implements OnInit, AfterViewInit, OnChanges { export class AnswersComponent extends BaseComponent implements OnInit, AfterViewInit, OnChanges {
private allAnswersAreValid = false; allAnswersAreValid = false;
private answerList = []; answerList = [];
private currentHeader: any = ""; currentHeader: any = "";
private display: boolean; display: boolean;
constructor(public config: ConfigService, constructor(public config: ConfigService,
@Inject(DOCUMENT) private document: any, @Inject(DOCUMENT) private document: any,

View File

@ -1,8 +1,22 @@
<div class="poll" > <div class="poll" >
<nav class='sections-nav' > <nav class='sections-nav' >
<ul > <ul >
<li ><a href='#title' >{{config.currentPoll.data.title}}</a ></li > <li >
<li ><a href='#graph' >Graphique</a ></li > <a href='#title' >
{{config.currentPoll.data.title}}
</a >
</li >
<li >
<a href='#table' >
{{config.currentPoll.stacks.length}}
votes
</a >
</li >
<li >
<a href='#graph' >
Graphique
</a >
</li >
<li > <li >
<a href='#comments' > <a href='#comments' >
<i class='fa fa-comments' ></i > <i class='fa fa-comments' ></i >
@ -11,7 +25,8 @@
class='comments-count' > class='comments-count' >
{{config.currentPoll.comments.length}} {{config.currentPoll.comments.length}}
</span > </span >
commentaires</a > commentaires
</a >
</li > </li >
</ul > </ul >
</nav > </nav >
@ -94,11 +109,14 @@
(click)='config.addVote()' > (click)='config.addVote()' >
<i class='fa fa-paper-plane' ></i > Envoyer <i class='fa fa-paper-plane' ></i > Envoyer
</button > </button >
<hr >
<div id='graph' > <div id='graph' >
<!--<framadate-voting-graph ></framadate-voting-graph >--> <!--<framadate-voting-graph ></framadate-voting-graph >-->
</div > </div >
<!--<framadate-voting-summary ></framadate-voting-summary >--> <div id='table' >
<!--<framadate-voting-summary ></framadate-voting-summary >-->
</div >
<div <div
class="comments" class="comments"
id='comments' > id='comments' >

View File

@ -134,7 +134,7 @@
<div <div
class="enablepassword" class="enablepassword"
*ngIf="config.passwordAccess == '1'" > *ngIf="config.passwordAccess == 1" >
<input <input
type="password" type="password"
name="password" name="password"

View File

@ -1,7 +1,7 @@
<div class="comment"> <div class="comment" >
<span class="cname">{{comment.name}} </span>, le <span class="cname" >{{comment.pseudo}} </span >, le
<span class="date padding-btm-x1">{{comment.date}}</span> <span class="date padding-btm-x1" >{{comment.date}}</span >
<p class="text"> <p class="text" >
{{comment.text}} {{comment.text}}
</p> </p >
</div> </div >

View File

@ -8,7 +8,7 @@ import {mockComments} from "../../../config/mocks/mock-comments";
}) })
export class VotingCommentComponent implements OnInit { export class VotingCommentComponent implements OnInit {
@Input() private comment = mockComments[0]; @Input() comment = mockComments[0];
constructor() { constructor() {
} }

View File

@ -9,10 +9,10 @@ import {mockPoll3} from "../../../config/mocks/mock-poll3";
}) })
export class VotingSummaryComponent implements OnInit { export class VotingSummaryComponent implements OnInit {
private preferred: string = 'rien'; preferred: string = 'rien';
private counters: any = {}; counters: any = {};
@Input() private pollconfig = mockPoll3; @Input() pollconfig = mockPoll3;
constructor(private config: ConfigService) { constructor(private config: ConfigService) {
@ -30,11 +30,11 @@ export class VotingSummaryComponent implements OnInit {
let maximumYesCount = 0; let maximumYesCount = 0;
let choice_id_max = 0; let choice_id_max = 0;
let winners_id = []; let winners_id = [];
this.pollconfig.stacks.map(stack => { this.pollconfig.stacks.forEach(stack => {
stack.votes.map(vote => { stack.votes.map(vote => {
let choice_id = vote.id; let choice_id = vote.choice_id;
let answer = vote.answer; let answer = vote.text;
if (!this.counters["choice_" + choice_id]) { if (!this.counters["choice_" + choice_id]) {
this.counters["choice_" + choice_id] = { this.counters["choice_" + choice_id] = {
yes: 0, yes: 0,
@ -50,12 +50,14 @@ export class VotingSummaryComponent implements OnInit {
// find the favourite // find the favourite
}) });
console.log('this.counters', this.counters); console.log('choice_id_max', choice_id_max);
console.log(' this.pollconfig.choices', this.pollconfig.choices);
let choiceTitleFound = this.pollconfig.choices.find(elem => { let choiceTitleFound = this.pollconfig.choices.find(elem => {
console.log('elem', elem);
return elem.id == choice_id_max return elem.id == choice_id_max
}) });
this.preferred = choiceTitleFound.name; this.preferred = choiceTitleFound.text;
console.log('choiceTitleFound', choiceTitleFound) console.log('choiceTitleFound', choiceTitleFound)
} }

View File

@ -5,6 +5,8 @@ import {environment} from "../../environments/environment";
import {ConfirmationService, MessageService} from 'primeng/api'; import {ConfirmationService, MessageService} from 'primeng/api';
import {Router} from "@angular/router"; import {Router} from "@angular/router";
import {mockPoll3} from "../config/mocks/mock-poll3"; import {mockPoll3} from "../config/mocks/mock-poll3";
import {mockMyPolls} from "../config/mocks/mockmypolls";
import {defaultAnswers, defaultDates, timeOfDay} from "../config/defaultConfigs";
/** /**
* le service transverse à chaque page qui permet de syncroniser la configuration de sondage souhaitée * le service transverse à chaque page qui permet de syncroniser la configuration de sondage souhaitée
@ -14,7 +16,6 @@ import {mockPoll3} from "../config/mocks/mock-poll3";
}) })
export class ConfigService extends PollConfig { export class ConfigService extends PollConfig {
currentPoll: any = mockPoll3;
loading: boolean = false; loading: boolean = false;
baseHref: any = environment.baseApiHref; baseHref: any = environment.baseApiHref;
@ -25,6 +26,14 @@ export class ConfigService extends PollConfig {
private confirmationService: ConfirmationService, private confirmationService: ConfirmationService,
) { ) {
super(); super();
// fill in mock values if we are not in production environment
if (!environment.production) {
this.currentPoll = mockPoll3;
this.myPolls = mockMyPolls;
this.dateList = defaultDates;
this.timeList = timeOfDay;
this.answers = defaultAnswers;
}
} }
set(key, val) { set(key, val) {
@ -114,6 +123,10 @@ export class ConfigService extends PollConfig {
return jsonConfig return jsonConfig
} }
/**
* prepare headers like the charset and json type for any call to the backend
* @param bodyContent
*/
makeHeaders(bodyContent?: any) { makeHeaders(bodyContent?: any) {
const headerDict = { const headerDict = {
@ -132,13 +145,16 @@ export class ConfigService extends PollConfig {
return requestOptions; return requestOptions;
} }
checkIfSlugIsUniqueInDatabase(slug: string) { checkIfSlugIsUniqueInDatabase(slug: string = '') {
this.customUrlIsUnique = null; this.customUrlIsUnique = null;
if (!slug) {
slug = this.makeSlug();
}
this.loading = true; this.loading = true;
// TODO // TODO
this.todo('check slug is unique'); this.todo('check slug is unique');
this.http.get(`${this.baseHref}/check-slug-is-uniq`, this.http.get(`${this.baseHref}/check-slug-is-uniq/${slug}`,
this.makeHeaders({slug: this.customUrl}), this.makeHeaders({slug: this.customUrl}),
) )
.subscribe((res: any) => { .subscribe((res: any) => {
@ -282,11 +298,14 @@ export class ConfigService extends PollConfig {
.subscribe((res: any) => { .subscribe((res: any) => {
// redirect to the page to administrate the new poll // redirect to the page to administrate the new poll
this.messageService.add({severity: 'success', summary: 'Sondage Créé',}); this.messageService.add({severity: 'success', summary: 'Sondage Créé',});
this.selectedPoll = res; this.currentPoll = res;
this.pollId = res.pollId; this.pollId = res.pollId;
this.loading = false; this.loading = false;
this.myPolls.push(config); this.myPolls.push(config);
this.router.navigate(['step/end']); this.router.navigate(['step/end']);
// TODO save new poll to localstorage
// reset all fields in current config
this.resetConfig();
}, (e) => { }, (e) => {
this.handleError(e) this.handleError(e)
} }
@ -401,7 +420,7 @@ export class ConfigService extends PollConfig {
} }
deleteVotes() { deleteVotes() {
// prompt for confirmation // prompt for confirmation
this.confirmationService.confirm({ this.confirmationService.confirm({
message: 'Are you sure that you want to completely delete the votes of this poll (' + this.title + ') permanentely?', message: 'Are you sure that you want to completely delete the votes of this poll (' + this.title + ') permanentely?',
accept: () => { accept: () => {

View File

@ -19,6 +19,7 @@ export class ErasableInputComponent implements OnInit {
eraseInput() { eraseInput() {
// //
this.inputModelChange.emit(''); this.inputModelChange.emit('');
// TODO focus on other element
} }
} }

View File

@ -1,7 +1,7 @@
<nav class="choices" > <nav class="choices" >
<a <a
[routerLink]="'home'" [routerLink]="'home'"
[ngClass]="{'active': step === 'home'}" [ngClass]="{'active': (step === 'home')}"
i18n i18n
> >
<i class="fa fa-home" ></i > <i class="fa fa-home" ></i >

View File

@ -11,7 +11,7 @@ import {ConfigService} from '../../services/config.service';
}) })
export class NavigationComponent extends BaseComponent implements OnInit { export class NavigationComponent extends BaseComponent implements OnInit {
@Input() public step: 'home'; @Input() public step: string = 'home';
constructor(public config: ConfigService, constructor(public config: ConfigService,
public route: Router) { public route: Router) {

View File

@ -7,7 +7,7 @@
<div <div
class="text title clickable" class="text title clickable"
(click)="setAnswserTo('yes')" > (click)="setAnswserTo('yes')" >
{{choice.name}} {{choice.text}}
</div > </div >
<div class="choicebox__subject" > <div class="choicebox__subject" >
@ -25,13 +25,13 @@
<!-- DATE CASE --> <!-- DATE CASE -->
<div <div
class="dates" class="dates"
*ngIf="choice.date" > *ngIf="pollIsSpecialDate" >
<div class="choicebox__date" > <div class="choicebox__date" >
{{choice.date | date:'EEE'}} <span {{choice.date.date | date:'EEE'}} <span
class="choicebox__day" >{{choice.date | date:'dd'}}</span > {{choice.date | date:'LLL'}} class="choicebox__day" >{{choice.date.date | date:'dd'}}</span > {{choice.date.date | date:'LLL'}}
</div > </div >
<div class="choicebox__hour" > <div class="choicebox__hour" >
08:00 {{choice.date.date | date:'H:m'}}
</div > </div >
</div > </div >
<!-- DATE CASE --> <!-- DATE CASE -->
@ -84,7 +84,7 @@
type="button" type="button"
aria-describedby="choicebox-tooltip" aria-describedby="choicebox-tooltip"
class="choicebox__votes" class="choicebox__votes"
*ngIf="choice.votes.count" > *ngIf="choice.votes" >
<div class="choicebox__vote" > <div class="choicebox__vote" >
{{choice.votes.count.yes}} {{choice.votes.count.yes}}
<img <img

View File

@ -26,13 +26,16 @@ interface VoteChoice {
export class VoteChoiceComponent { export class VoteChoiceComponent {
@Input() public choice: any; @Input() public choice: any;
@Input() public simpleAnswer: boolean = true;
@Input() public pollIsSpecialDate: boolean = false;
constructor(private el: ElementRef) { constructor(private el: ElementRef) {
console.log('choice', this.choice)
} }
setAnswserTo(newAnswer: 'yes' | 'no' | 'maybe' | null) { setAnswserTo(newAnswer: 'yes' | 'no' | 'maybe' | null) {
if (this.choice.simpleAnswer) { if (this.simpleAnswer) {
// only toggle yes to no // only toggle yes to no
if (this.choice.answer && this.choice.answer === 'yes') { if (this.choice.answer && this.choice.answer === 'yes') {
this.choice.answer = 'no'; this.choice.answer = 'no';

View File

@ -2,6 +2,6 @@
git pull origin dev git pull origin dev
yarn install --pure-lockfile yarn install --pure-lockfile
yarn build yarn build:demo
sudo cp -r ./dist/framadate/* ../framadate-api/public/ sudo cp -r ./dist/framadate/* ../framadate-api/public/
echo " now check update demo at https://framadate-api.cipherbliss.com/index.html " echo " now check update demo at https://framadate-api.cipherbliss.com/index.html "