forked from tykayn/funky-framadate-front
more clean of primeng
This commit is contained in:
parent
39d6effabc
commit
03cbb508c7
79
mocks/old-stuff/config/PollConfig.ts
Normal file
79
mocks/old-stuff/config/PollConfig.ts
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/**
|
||||||
|
* une option de date dans les sondages spéciaux
|
||||||
|
*/
|
||||||
|
import { environment } from '../../../src/environments/environment';
|
||||||
|
import { DateChoice, defaultAnswers, otherDefaultDates, PollAnswer } from './defaultConfigs';
|
||||||
|
|
||||||
|
export interface DateOption {
|
||||||
|
timeList: any;
|
||||||
|
literal: string;
|
||||||
|
date_object?: object;
|
||||||
|
}
|
||||||
|
|
||||||
|
const baseConfigValues = {
|
||||||
|
pollType: 'dates',
|
||||||
|
title: '',
|
||||||
|
description: '',
|
||||||
|
myName: '',
|
||||||
|
myEmail: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* configuration of the poll, add new fields at will
|
||||||
|
*/
|
||||||
|
export class PollConfig {
|
||||||
|
menuVisible = true;
|
||||||
|
|
||||||
|
expiracyDateDefaultInDays = 60;
|
||||||
|
deletionDateAfterLastModification = 180;
|
||||||
|
step = 0; // step in the progress of creating a poll
|
||||||
|
stepMax = 3; // step max in the progress of creating a poll
|
||||||
|
pollType = 'dates'; // classic or dates
|
||||||
|
|
||||||
|
title: string = environment.production ? '' : 'titre';
|
||||||
|
description: string = environment.production ? '' : 'ma description';
|
||||||
|
myName: string = environment.production ? '' : 'mon pseudo';
|
||||||
|
myComment: string = environment.production ? '' : 'wouah trop bien framadate!';
|
||||||
|
isAdmin = !environment.production;
|
||||||
|
myVoteStack: any;
|
||||||
|
myTempVoteStack = 0;
|
||||||
|
myEmail: string = environment.production ? '' : 'tktest@tktest.com';
|
||||||
|
myPolls: any = []; // list of retrieved polls from the backend api
|
||||||
|
/*
|
||||||
|
date specific poll, we have the choice to setup different hours (timeSlices) for all possible dates (dateChoices), 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
|
||||||
|
custom_url = 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 custom_url in the url, must be unique
|
||||||
|
customUrlIsUnique = null; // given by the backend
|
||||||
|
urlSlugPublic = null;
|
||||||
|
urlPublic = environment.production ? '' : document.location.href + '/poll/id/4';
|
||||||
|
urlAdmin = document.location.href + '/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
|
||||||
|
adminKey = ''; // key to change config of the poll
|
||||||
|
owner_modifier_token = ''; // key to change a vote stack
|
||||||
|
canModifyAnswers = true; // bool for the frontend selector
|
||||||
|
whoCanChangeAnswers = 'everybody'; // everybody, self, nobody (= just admin)
|
||||||
|
dateList: any = otherDefaultDates; // sets of dateChoices as strings, config to set identical time for dateChoices in a special dateChoices poll
|
||||||
|
timeList: DateChoice[] = otherDefaultDates; // ranges of time expressed as strings
|
||||||
|
|
||||||
|
answers: PollAnswer[] = defaultAnswers;
|
||||||
|
// modals
|
||||||
|
displayConfirmVoteModalAdmin = false;
|
||||||
|
|
||||||
|
resetConfig() {
|
||||||
|
const self = this;
|
||||||
|
Object.keys(baseConfigValues).forEach((key) => {
|
||||||
|
self[key] = baseConfigValues[key];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
112
mocks/old-stuff/config/defaultConfigs.ts
Normal file
112
mocks/old-stuff/config/defaultConfigs.ts
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
export interface DateChoice {
|
||||||
|
literal: string;
|
||||||
|
timeList: TimeSlices[];
|
||||||
|
date_object: Date;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TimeSlices {
|
||||||
|
literal: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PollAnswer {
|
||||||
|
id: number;
|
||||||
|
text: string;
|
||||||
|
url: string;
|
||||||
|
file: string;
|
||||||
|
literal: string;
|
||||||
|
date_object: Date;
|
||||||
|
timeList: TimeSlices[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentYear = new Date().getFullYear();
|
||||||
|
const currentMonth = new Date().getMonth();
|
||||||
|
const currentDay = new Date().getDate();
|
||||||
|
|
||||||
|
export const basicSlicesOfDay: TimeSlices[] = [
|
||||||
|
{ literal: 'matin' },
|
||||||
|
{ literal: 'midi' },
|
||||||
|
{ literal: 'après-midi' },
|
||||||
|
{ literal: 'soir' },
|
||||||
|
];
|
||||||
|
export const otherSlicesOfDay: TimeSlices[] = [
|
||||||
|
{ literal: 'aux aurores' },
|
||||||
|
{ literal: 'au petit dej' },
|
||||||
|
{ literal: 'au deuxième petit dej des hobbits' },
|
||||||
|
];
|
||||||
|
export const defaultTimeOfDay: TimeSlices[] = (() => {
|
||||||
|
return [...basicSlicesOfDay];
|
||||||
|
})();
|
||||||
|
|
||||||
|
export const otherTimeOfDay: TimeSlices[] = (() => {
|
||||||
|
return [...otherSlicesOfDay];
|
||||||
|
})();
|
||||||
|
export const moreTimeOfDay: TimeSlices[] = (() => {
|
||||||
|
return [...otherSlicesOfDay];
|
||||||
|
})();
|
||||||
|
export const defaultDates: DateChoice[] = [
|
||||||
|
{
|
||||||
|
literal: `${currentYear}-${currentMonth}-${currentDay}`,
|
||||||
|
date_object: new Date(),
|
||||||
|
timeList: defaultTimeOfDay,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
literal: `${currentYear}-${currentMonth}-${currentDay + 1}`,
|
||||||
|
date_object: new Date(),
|
||||||
|
timeList: defaultTimeOfDay,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
literal: `${currentYear}-${currentMonth}-${currentDay + 2}`,
|
||||||
|
date_object: new Date(),
|
||||||
|
timeList: defaultTimeOfDay,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const otherDefaultDates: DateChoice[] = [
|
||||||
|
{
|
||||||
|
literal: `${currentYear}-${currentMonth}-${currentDay}`,
|
||||||
|
date_object: new Date(),
|
||||||
|
timeList: defaultTimeOfDay,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
literal: `${currentYear}-${currentMonth}-${currentDay + 1}`,
|
||||||
|
date_object: new Date(currentYear, currentMonth, currentDay + 1),
|
||||||
|
timeList: otherTimeOfDay,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
literal: `${currentYear}-${currentMonth}-${currentDay + 2}`,
|
||||||
|
date_object: new Date(),
|
||||||
|
timeList: moreTimeOfDay,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
export const defaultAnswers: PollAnswer[] = [
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
text: 'réponse de démo 1',
|
||||||
|
file: '',
|
||||||
|
url:
|
||||||
|
'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574',
|
||||||
|
literal: `${currentYear}-${currentMonth}-${currentDay}`,
|
||||||
|
date_object: new Date(),
|
||||||
|
timeList: otherSlicesOfDay,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
text: 'réponse 2',
|
||||||
|
file: '',
|
||||||
|
url:
|
||||||
|
'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574',
|
||||||
|
literal: `${currentYear}-${currentMonth}-${currentDay + 1}`,
|
||||||
|
date_object: new Date(),
|
||||||
|
timeList: basicSlicesOfDay,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
text: 'la réponse D',
|
||||||
|
file: '',
|
||||||
|
url:
|
||||||
|
'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574',
|
||||||
|
literal: `${currentYear}-${currentMonth}-${currentDay + 2}`,
|
||||||
|
date_object: new Date(),
|
||||||
|
timeList: otherSlicesOfDay,
|
||||||
|
},
|
||||||
|
];
|
@ -16,7 +16,7 @@ import { TextSelectComponent } from './form/text-select/text-select.component';
|
|||||||
import { KindSelectComponent } from './form/kind-select/kind-select.component';
|
import { KindSelectComponent } from './form/kind-select/kind-select.component';
|
||||||
import { BaseConfigComponent } from './form/base-config/base-config.component';
|
import { BaseConfigComponent } from './form/base-config/base-config.component';
|
||||||
import { AdvancedConfigComponent } from './form/advanced-config/advanced-config.component';
|
import { AdvancedConfigComponent } from './form/advanced-config/advanced-config.component';
|
||||||
import { CalendarModule, DialogModule } from 'primeng';
|
|
||||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||||
import { IntervalComponent } from './form/date/interval/interval.component';
|
import { IntervalComponent } from './form/date/interval/interval.component';
|
||||||
import { DayListComponent } from './form/date/list/day/day-list.component';
|
import { DayListComponent } from './form/date/list/day/day-list.component';
|
||||||
@ -41,7 +41,6 @@ import { TimeListComponent } from './form/date/list/time/time-list.component';
|
|||||||
TimeListComponent,
|
TimeListComponent,
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
CalendarModule,
|
|
||||||
AdministrationRoutingModule,
|
AdministrationRoutingModule,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
@ -50,7 +49,6 @@ import { TimeListComponent } from './form/date/list/time/time-list.component';
|
|||||||
TranslateModule.forChild({ extend: true }),
|
TranslateModule.forChild({ extend: true }),
|
||||||
DateValueAccessorModule,
|
DateValueAccessorModule,
|
||||||
DragDropModule,
|
DragDropModule,
|
||||||
DialogModule,
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class AdministrationModule {}
|
export class AdministrationModule {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user