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",
"version": "0.1.0",
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"serve": "ng serve",
"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",
"lint": "ng lint",
"e2e": "ng e2e",
"trans": "ng xi18n --output-path=src/locale --i18n-locale=fr"
},
"private": true,
"private": false,
"dependencies": {
"@angular/animations": "^8.2.14",
"@angular/cdk": "^8.2.3",

View File

@ -2,8 +2,7 @@
* une option de date dans les sondages spéciaux
*/
import {environment} from "../../environments/environment";
import {mockMyPolls} from "./mocks/mockmypolls";
import {defaultAnswers, defaultDates, timeOfDay} from "./defaultConfigs";
import {defaultAnswers} from "./defaultConfigs";
export interface DateOption {
timeList: any;
@ -33,7 +32,7 @@ export class PollConfig {
myComment: string = 'wouah trop bien framadate!';
isAdmin: boolean = true;
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
allowSeveralHours = 'false';
// access
@ -42,7 +41,7 @@ export class PollConfig {
creationDate = new Date();
expirationDate = ''; // expiracy date
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;
password = '';
customUrl = ''; // custom slug in the url, must be unique
@ -52,8 +51,8 @@ export class PollConfig {
canModifyAnswers = 1;// everybody, self, nobody (= just admin)
whoModifiesAnswers = "self";// 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
timeList: DateOption[] = timeOfDay; // ranges of time expressed as strings
dateList: DateOption[]; // sets of days as strings, config to set identical time for days in a special days poll
timeList: DateOption[]; // ranges of time expressed as strings
answers: any = defaultAnswers;

View File

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

View File

@ -1,12 +1,12 @@
export const mockComments = [
{
name: "Bulbizarre",
pseudo: "Bulbizarre",
date: "23 décembre 2019",
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",
},
{
name: "Marylin",
pseudo: "Marylin",
date: "5 Janvier 2020",
text: "j'ai vu de la lumière o_o",
},

View File

@ -1,5 +1,3 @@
import {mockComments} from "./mock-comments";
export const mockPoll3 = {
"message": "your poll config",
"data": {
@ -8,19 +6,21 @@ export const mockPoll3 = {
"customUrl": null,
"description": "choisissez votre animé préféré",
"creationDate": {
"date": "2020-01-15 15:07:53.000000",
"date": "2020-01-20 16:45:48.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
"timezone": "Europe/Berlin"
},
"expiracyDate": {
"date": "2020-03-17 15:07:53.000000",
"date": "2020-01-20 16:45:48.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
"timezone": "Europe/Berlin"
},
"owner": {
"__initializer__": {},
"__cloner__": {},
"__isInitialized__": false
"__initializer__": null,
"__cloner__": null,
"__isInitialized__": true,
"pseudo": "tk_TEST",
"email": "tktest@tktest.com"
},
"kind": "text",
"allowedAnswers": [
@ -37,65 +37,318 @@ export const mockPoll3 = {
"comments": {},
"defaultExpiracyDaysFromNow": 60
},
"stacks_count": 4,
"stacks_count": 10,
"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": [
{
"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,
"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,
"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": [
{
"id": 5,
"answer": "yes",
"id": 8,
"vote_id": 18,
"value": "no",
"choice_id": 5,
"text": "Vic le viking"
},
{
"id": 8,
"answer": "maybe",
},
{
"id": 9,
"answer": "no",
},
]
},
{
"pseudo": "CopyCat",
"votes": [
{
"id": 5,
"answer": "yes",
"vote_id": 19,
"value": "maybe",
"choice_id": 6,
"text": "Boumbo petite automobile"
},
{
"id": 8,
"answer": "maybe",
},
{
"id": 9,
"answer": "no",
},
"vote_id": 20,
"value": "yes",
"choice_id": 7,
"text": "Les mystérieuses cités d'or"
}
]
},
{
"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": [
{
"id": 5,
"answer": "yes",
"id": 9,
"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": [
{
"id": 5,
"name": "Vic le viking",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"date": {
"date": "2020-01-20 16:45:48.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
"timezone": "Europe/Berlin"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
"text": "Vic le viking"
},
{
"id": 6,
"name": "Boumbo petite automobile",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"date": {
"date": "2020-01-20 16:45:48.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
"timezone": "Europe/Berlin"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
"text": "Boumbo petite automobile"
},
{
"id": 7,
"name": "Les mystérieuses cités d'or",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"date": {
"date": "2020-01-20 16:45:48.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
"timezone": "Europe/Berlin"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
"text": "Les mystérieuses cités d'or"
},
{
"id": 8,
"name": "Les mondes engloutis",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"date": {
"date": "2020-01-20 16:45:48.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
"timezone": "Europe/Berlin"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
"text": "Les mondes engloutis"
},
{
"id": 9,
"name": "Foot 2 rue",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"date": {
"date": "2020-01-20 16:45:48.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
"timezone": "Europe/Berlin"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
"text": "Foot 2 rue"
},
{
"id": 10,
"name": "Le chat, la vache, et l'océan",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"date": {
"date": "2020-01-20 16:45:48.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
"timezone": "Europe/Berlin"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
"text": "Le chat, la vache, et l'océan"
},
{
"id": 11,
"name": "Digimon",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"date": {
"date": "2020-01-20 16:45:48.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
"timezone": "Europe/Berlin"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
"text": "Digimon"
}
],
"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
class="btn btn--primary"
i18n
(click)="config.getPollById(1, 'example password')"
(click)="config.getPollById( '1', 'example password')"
>
get poll 1
</button >

View File

@ -1,16 +1,17 @@
import { Component, OnInit } from '@angular/core';
import {BaseComponent} from '../base-page/base.component';
import {Component, OnInit} from '@angular/core';
import {ConfigService} from '../../services/config.service';
@Component({
selector: 'framadate-admin',
templateUrl: './admin.component.html',
styleUrls: ['./admin.component.scss']
selector: 'framadate-admin',
templateUrl: './admin.component.html',
styleUrls: ['./admin.component.scss']
})
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 {
private allAnswersAreValid = false;
allAnswersAreValid = false;
private answerList = [];
private currentHeader: any = "";
private display: boolean;
answerList = [];
currentHeader: any = "";
display: boolean;
constructor(public config: ConfigService,
@Inject(DOCUMENT) private document: any,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,6 +5,8 @@ import {environment} from "../../environments/environment";
import {ConfirmationService, MessageService} from 'primeng/api';
import {Router} from "@angular/router";
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
@ -14,7 +16,6 @@ import {mockPoll3} from "../config/mocks/mock-poll3";
})
export class ConfigService extends PollConfig {
currentPoll: any = mockPoll3;
loading: boolean = false;
baseHref: any = environment.baseApiHref;
@ -25,6 +26,14 @@ export class ConfigService extends PollConfig {
private confirmationService: ConfirmationService,
) {
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) {
@ -114,6 +123,10 @@ export class ConfigService extends PollConfig {
return jsonConfig
}
/**
* prepare headers like the charset and json type for any call to the backend
* @param bodyContent
*/
makeHeaders(bodyContent?: any) {
const headerDict = {
@ -132,13 +145,16 @@ export class ConfigService extends PollConfig {
return requestOptions;
}
checkIfSlugIsUniqueInDatabase(slug: string) {
checkIfSlugIsUniqueInDatabase(slug: string = '') {
this.customUrlIsUnique = null;
if (!slug) {
slug = this.makeSlug();
}
this.loading = true;
// TODO
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}),
)
.subscribe((res: any) => {
@ -282,11 +298,14 @@ export class ConfigService extends PollConfig {
.subscribe((res: any) => {
// redirect to the page to administrate the new poll
this.messageService.add({severity: 'success', summary: 'Sondage Créé',});
this.selectedPoll = res;
this.currentPoll = res;
this.pollId = res.pollId;
this.loading = false;
this.myPolls.push(config);
this.router.navigate(['step/end']);
// TODO save new poll to localstorage
// reset all fields in current config
this.resetConfig();
}, (e) => {
this.handleError(e)
}
@ -401,7 +420,7 @@ export class ConfigService extends PollConfig {
}
deleteVotes() {
// prompt for confirmation
// prompt for confirmation
this.confirmationService.confirm({
message: 'Are you sure that you want to completely delete the votes of this poll (' + this.title + ') permanentely?',
accept: () => {

View File

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

View File

@ -1,7 +1,7 @@
<nav class="choices" >
<a
[routerLink]="'home'"
[ngClass]="{'active': step === 'home'}"
[ngClass]="{'active': (step === 'home')}"
i18n
>
<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 {
@Input() public step: 'home';
@Input() public step: string = 'home';
constructor(public config: ConfigService,
public route: Router) {

View File

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

View File

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

View File

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