diff --git a/src/app/config/PollConfig.ts b/src/app/config/PollConfig.ts index c47403e2..54d01228 100644 --- a/src/app/config/PollConfig.ts +++ b/src/app/config/PollConfig.ts @@ -2,48 +2,14 @@ * 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"; export interface DateOption { timeList: any; literal: string; } -export const timeOfDay = [{ - timeList: [], - literal: 'matin' -}, - {timeList: [], literal: 'midi'}, - {timeList: [], literal: 'après-midi'}, - {timeList: [], literal: 'soirée'}]; -export const defaultDates = [ - { - literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}`, - timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}] - }, - { - literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 1}`, - timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}] - }, - { - literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 2}`, - timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}] - } -]; -export const defaultAnswers = [{ - id: 0, - text: 'réponse de démo 1', - url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', -}, - { - id: 1, - text: 'réponse 2', - url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', - }, - { - id: 2, - text: 'la réponse D', - url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', - }]; /** * configuration of the poll, add new fields at will @@ -51,15 +17,16 @@ export const defaultAnswers = [{ export class PollConfig { expiracyDateDefaultInDays = 60; deletionDateAfterLastModification = 180; - step = 0; - stepMax = 3; - pollType = 'classic';// classic or date - title = 'titre'; - description = 'ma description'; - myName = 'mon pseudo'; - myComment = 'wouah trop bien framadate!'; + 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 = 'classic';// classic or date + title: string = 'titre'; + description: string = 'ma description'; + myName: string = 'mon pseudo'; + myComment: string = 'wouah trop bien framadate!'; isAdmin: boolean = false; - myEmail: string = ""; + myEmail: string = "tktest@tktest.com"; + myPolls: any = mockMyPolls;// 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 diff --git a/src/app/config/defaultConfigs.ts b/src/app/config/defaultConfigs.ts new file mode 100644 index 00000000..e3706d54 --- /dev/null +++ b/src/app/config/defaultConfigs.ts @@ -0,0 +1,36 @@ +export const timeOfDay = [{ + timeList: [], + literal: 'matin' +}, + {timeList: [], literal: 'midi'}, + {timeList: [], literal: 'après-midi'}, + {timeList: [], literal: 'soirée'}]; +export const defaultDates = [ + { + literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}`, + timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}] + }, + { + literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 1}`, + timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}] + }, + { + literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 2}`, + timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}] + } +]; +export const defaultAnswers = [{ + id: 0, + text: 'réponse de démo 1', + url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', +}, + { + id: 1, + text: 'réponse 2', + url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', + }, + { + id: 2, + text: 'la réponse D', + url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', + }]; diff --git a/src/app/config/mock-comments.ts b/src/app/config/mocks/mock-comments.ts similarity index 100% rename from src/app/config/mock-comments.ts rename to src/app/config/mocks/mock-comments.ts diff --git a/src/app/config/mock-graph.ts b/src/app/config/mocks/mock-graph.ts similarity index 100% rename from src/app/config/mock-graph.ts rename to src/app/config/mocks/mock-graph.ts diff --git a/src/app/config/mock-poll3.ts b/src/app/config/mocks/mock-poll3.ts similarity index 100% rename from src/app/config/mock-poll3.ts rename to src/app/config/mocks/mock-poll3.ts diff --git a/src/app/config/mocks/mockmypolls.ts b/src/app/config/mocks/mockmypolls.ts new file mode 100644 index 00000000..2fb32db2 --- /dev/null +++ b/src/app/config/mocks/mockmypolls.ts @@ -0,0 +1,23 @@ +export const mockMyPolls = + [{ + "id": 1, + "title": "blehehehe heh hehhe e", + "customUrl": null, + "description": "maaaaaaaaaaah", + "creationDate": {"date": "2020-01-20 14:21:16.270157", "timezone_type": 3, "timezone": "Europe/Paris"}, + "expiracyDate": {"date": "2020-01-20 14:21:16.270178", "timezone_type": 3, "timezone": "Europe/Paris"}, + "owner": null, + "kind": "text", + "allowedAnswers": ["yes"], + "modificationPolicy": "nobody", + "mailOnComment": null, + "mailOnVote": null, + "hideResults": null, + "showResultEvenIfPasswords": null, + "votes": {}, + "stacksOfVotes": {}, + "choices": {}, + "comments": {}, + "defaultExpiracyDaysFromNow": 60 + }] +; diff --git a/src/app/pages/answers/answers.component.html b/src/app/pages/answers/answers.component.html index af4539ba..fb8ddce4 100644 --- a/src/app/pages/answers/answers.component.html +++ b/src/app/pages/answers/answers.component.html @@ -82,7 +82,7 @@
+ - - + + -
-

+
+

{{"config.find_my_polls"|translate}} -

+

@@ -27,10 +31,12 @@ for="email" i18n > + {{"config.find_helper"|translate}} : - + -
-
-
- + +
+
+

+ Mes Sondages trouvés: +

+ -
+
Aucun sondage. -
-
-
- -
+ + +
+ +
- - + diff --git a/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts b/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts index 5b6271a6..ec87f8d8 100644 --- a/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts +++ b/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts @@ -11,6 +11,7 @@ export class CreateOrRetrieveComponent extends BaseComponent implements OnInit { loadedMyPolls: boolean = false; + constructor(public config: ConfigService) { super(config); } @@ -30,4 +31,7 @@ export class CreateOrRetrieveComponent extends BaseComponent implements OnInit { this.loadedMyPolls = true; } + trackFunction(index: number, item: any): number { + return item.id; + }; } diff --git a/src/app/pages/poll-display/poll-display.component.ts b/src/app/pages/poll-display/poll-display.component.ts index 913e9a2a..64a48108 100644 --- a/src/app/pages/poll-display/poll-display.component.ts +++ b/src/app/pages/poll-display/poll-display.component.ts @@ -1,8 +1,8 @@ import {Component, OnInit} from '@angular/core'; import {BaseComponent} from "../base-page/base.component"; import {ConfigService} from "../../services/config.service"; -import {mockPoll3} from "../../config/mock-poll3"; -import {mockComments} from "../../config/mock-comments"; +import {mockPoll3} from "../../config/mocks/mock-poll3"; +import {mockComments} from "../../config/mocks/mock-comments"; @Component({ selector: 'framadate-poll-display', diff --git a/src/app/pages/voting/voting-comment/voting-comment.component.ts b/src/app/pages/voting/voting-comment/voting-comment.component.ts index 7bc61462..6ab3b627 100644 --- a/src/app/pages/voting/voting-comment/voting-comment.component.ts +++ b/src/app/pages/voting/voting-comment/voting-comment.component.ts @@ -1,5 +1,5 @@ import {Component, Input, OnInit} from '@angular/core'; -import {mockComments} from "../../../config/mock-comments"; +import {mockComments} from "../../../config/mocks/mock-comments"; @Component({ selector: 'framadate-voting-comment', diff --git a/src/app/pages/voting/voting-summary/voting-summary.component.ts b/src/app/pages/voting/voting-summary/voting-summary.component.ts index 13889b43..ddfc4650 100644 --- a/src/app/pages/voting/voting-summary/voting-summary.component.ts +++ b/src/app/pages/voting/voting-summary/voting-summary.component.ts @@ -1,6 +1,6 @@ import {Component, Input, OnInit} from '@angular/core'; import {ConfigService} from "../../../services/config.service"; -import {mockPoll3} from "../../../config/mock-poll3"; +import {mockPoll3} from "../../../config/mocks/mock-poll3"; @Component({ selector: 'framadate-voting-summary', diff --git a/src/app/poll-graphic/poll-graphic.component.ts b/src/app/poll-graphic/poll-graphic.component.ts index d3161f83..9568935b 100644 --- a/src/app/poll-graphic/poll-graphic.component.ts +++ b/src/app/poll-graphic/poll-graphic.component.ts @@ -1,10 +1,10 @@ import {Component, Inject, OnInit} from "@angular/core"; import {Chart} from "chart.js"; import {DOCUMENT} from '@angular/common'; -import {mockGraphConfig} from "../config/mock-graph"; +import {mockGraphConfig} from "../config/mocks/mock-graph"; import {graphOptions} from "../config/graph-canevas-options"; import {ConfigService} from "../services/config.service"; -import {mockPoll3} from "../config/mock-poll3"; +import {mockPoll3} from "../config/mocks/mock-poll3"; @Component({ selector: "framadate-poll-graphic", diff --git a/src/app/services/config.service.ts b/src/app/services/config.service.ts index 8dff28fa..319a4239 100644 --- a/src/app/services/config.service.ts +++ b/src/app/services/config.service.ts @@ -15,7 +15,6 @@ export class ConfigService extends PollConfig { loading: boolean = false; baseHref: any = environment.baseApiHref; - myPolls: any;// list of retrieved polls from the backend api constructor(private http: HttpClient,