src/app/config/PollConfig.ts
configuration of the poll, add new fields at will
adminKey |
Type : string
|
Default value : ''
|
Defined in src/app/config/PollConfig.ts:58
|
allowSeveralHours |
Type : string
|
Default value : 'true'
|
Defined in src/app/config/PollConfig.ts:41
|
answers |
Type : PollAnswer[]
|
Default value : defaultAnswers
|
Defined in src/app/config/PollConfig.ts:66
|
canModifyAnswers |
Type : boolean
|
Default value : true
|
Defined in src/app/config/PollConfig.ts:60
|
creationDate |
Default value : new Date()
|
Defined in src/app/config/PollConfig.ts:45
|
currentPoll |
Defined in src/app/config/PollConfig.ts:50
|
customUrl |
Type : string
|
Default value : ''
|
Defined in src/app/config/PollConfig.ts:53
|
customUrlIsUnique |
Type : null
|
Default value : null
|
Defined in src/app/config/PollConfig.ts:54
|
dateList |
Type : any
|
Default value : otherDefaultDates
|
Defined in src/app/config/PollConfig.ts:63
|
deletionDateAfterLastModification |
Type : number
|
Default value : 180
|
Defined in src/app/config/PollConfig.ts:27
|
description |
Type : string
|
Default value : 'ma description'
|
Defined in src/app/config/PollConfig.ts:32
|
expiracyDateDefaultInDays |
Type : number
|
Default value : 60
|
Defined in src/app/config/PollConfig.ts:26
|
expirationDate |
Type : string
|
Default value : ''
|
Defined in src/app/config/PollConfig.ts:46
|
isAdmin |
Type : boolean
|
Default value : true
|
Defined in src/app/config/PollConfig.ts:35
|
myComment |
Type : string
|
Default value : 'wouah trop bien framadate!'
|
Defined in src/app/config/PollConfig.ts:34
|
myEmail |
Type : string
|
Default value : "tktest@tktest.com"
|
Defined in src/app/config/PollConfig.ts:38
|
myName |
Type : string
|
Default value : 'mon pseudo'
|
Defined in src/app/config/PollConfig.ts:33
|
myPolls |
Type : any
|
Default value : []
|
Defined in src/app/config/PollConfig.ts:39
|
myTempVoteStack |
Type : number
|
Default value : 0
|
Defined in src/app/config/PollConfig.ts:37
|
myVoteStack |
Type : any
|
Defined in src/app/config/PollConfig.ts:36
|
owner_modifier_token |
Type : string
|
Default value : ''
|
Defined in src/app/config/PollConfig.ts:59
|
password |
Type : string
|
Default value : ''
|
Defined in src/app/config/PollConfig.ts:52
|
passwordAccess |
Type : number
|
Default value : 0
|
Defined in src/app/config/PollConfig.ts:51
|
pollId |
Type : null
|
Default value : null
|
Defined in src/app/config/PollConfig.ts:48
|
pollSlug |
Type : null
|
Default value : null
|
Defined in src/app/config/PollConfig.ts:49
|
pollType |
Type : string
|
Default value : 'dates'
|
Defined in src/app/config/PollConfig.ts:30
|
step |
Type : number
|
Default value : 0
|
Defined in src/app/config/PollConfig.ts:28
|
stepMax |
Type : number
|
Default value : 3
|
Defined in src/app/config/PollConfig.ts:29
|
timeList |
Type : DateChoice[]
|
Default value : otherDefaultDates
|
Defined in src/app/config/PollConfig.ts:64
|
title |
Type : string
|
Default value : 'titre'
|
Defined in src/app/config/PollConfig.ts:31
|
urlAdmin |
Default value : environment.baseHref + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345'
|
Defined in src/app/config/PollConfig.ts:57
|
urlPublic |
Default value : environment.baseHref + '/#/poll/id/4'
|
Defined in src/app/config/PollConfig.ts:56
|
urlSlugPublic |
Type : null
|
Default value : null
|
Defined in src/app/config/PollConfig.ts:55
|
visibility |
Type : string
|
Default value : 'link_only'
|
Defined in src/app/config/PollConfig.ts:43
|
voteChoices |
Type : string
|
Default value : 'only_yes'
|
Defined in src/app/config/PollConfig.ts:44
|
voteStackId |
Type : null
|
Default value : null
|
Defined in src/app/config/PollConfig.ts:47
|
whoCanChangeAnswers |
Type : string
|
Default value : 'everybody'
|
Defined in src/app/config/PollConfig.ts:62
|
whoModifiesAnswers |
Type : string
|
Default value : "everybody"
|
Defined in src/app/config/PollConfig.ts:61
|
resetConfig |
resetConfig()
|
Defined in src/app/config/PollConfig.ts:68
|
Returns :
void
|
import {environment} from "../../environments/environment";
import {DateChoice, defaultAnswers, otherDefaultDates, PollAnswer} from "./defaultConfigs";
export interface DateOption {
timeList: any;
literal: string;
date_object?: object;
}
const baseConfigValues = {
pollType: "classic",
title: "",
description: "",
myName: "",
myEmail: "",
};
/**
* configuration of the poll, add new fields at will
*/
export class PollConfig {
expiracyDateDefaultInDays = 60;
deletionDateAfterLastModification = 180;
step: number = 0; // step in the progress of creating a poll
stepMax: number = 3; // step max in the progress of creating a poll
pollType: string = 'dates';// classic or dates
title: string = 'titre';
description: string = 'ma description';
myName: string = 'mon pseudo';
myComment: string = 'wouah trop bien framadate!';
isAdmin: boolean = true;
myVoteStack: any;
myTempVoteStack = 0;
myEmail: string = "tktest@tktest.com";
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 = 'true';
// access
visibility = 'link_only'; // visible to anyone with the link:
voteChoices = 'only_yes'; // possible answers to a vote choice: only "yes", "yes, maybe, no"
creationDate = new Date();
expirationDate = ''; // expiracy date
voteStackId = null; // id of the vote stack to update
pollId = null; // id of the current poll when created. data given by the backend api
pollSlug = null; // id of the current poll when created. data given by the backend api
currentPoll; // current poll selected with createPoll or getPoll of ConfigService
passwordAccess = 0;
password = '';
customUrl = ''; // custom slug in the url, must be unique
customUrlIsUnique = null; // given by the backend
urlSlugPublic = null;
urlPublic = environment.baseHref + '/#/poll/id/4';
urlAdmin = environment.baseHref + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
adminKey = ''; // key to change config of the poll
owner_modifier_token = ''; // key to change a vote stack
canModifyAnswers: boolean = true;// bool for the frontend selector
whoModifiesAnswers = "everybody";// everybody, self, nobody (= just admin)
whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin)
dateList: any = otherDefaultDates; // sets of days as strings, config to set identical time for days in a special days poll
timeList: DateChoice[] = otherDefaultDates; // ranges of time expressed as strings
answers: PollAnswer[] = defaultAnswers;
resetConfig() {
const self = this;
Object.keys(baseConfigValues).forEach((key) => {
self[key] = baseConfigValues[key];
})
}
}