forked from tykayn/funky-framadate-front
⚡ list mypolls on first page
This commit is contained in:
parent
255205696b
commit
9ebd22536b
@ -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
|
||||
|
36
src/app/config/defaultConfigs.ts
Normal file
36
src/app/config/defaultConfigs.ts
Normal file
@ -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',
|
||||
}];
|
23
src/app/config/mocks/mockmypolls.ts
Normal file
23
src/app/config/mocks/mockmypolls.ts
Normal file
@ -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
|
||||
}]
|
||||
;
|
@ -82,7 +82,7 @@
|
||||
<br >
|
||||
<button
|
||||
[routerLink]="'/step/resume'"
|
||||
class="btn btn--primary"
|
||||
class="btn btn--full btn--primary"
|
||||
i18n
|
||||
>
|
||||
Voyons ce que ça donne
|
||||
|
@ -3,12 +3,16 @@
|
||||
<h1 >
|
||||
{{"creation.title"|translate}}
|
||||
</h1 >
|
||||
<p class="description margin-btm-x5" i18n>
|
||||
<p
|
||||
class="description margin-btm-x5"
|
||||
i18n >
|
||||
{{"config.description"|translate}}
|
||||
</p >
|
||||
<div class="btn-next" >
|
||||
|
||||
<button [routerLink]="'step/date'" class="btn btn--full btn--primary">
|
||||
<button
|
||||
[routerLink]="'step/date'"
|
||||
class="btn btn--full btn--primary" >
|
||||
{{"config.letsgo"|translate}}
|
||||
</button >
|
||||
|
||||
@ -27,10 +31,12 @@
|
||||
for="email"
|
||||
i18n
|
||||
>
|
||||
<i class='fa fa-envelope' ></i >
|
||||
{{"config.find_helper"|translate}} :
|
||||
</label >
|
||||
<input
|
||||
[(ngModel)]="config.myEmail"
|
||||
class='input'
|
||||
autofocus="autofocus"
|
||||
id="email"
|
||||
name="mail"
|
||||
@ -38,26 +44,43 @@
|
||||
type="email"
|
||||
/>
|
||||
<input
|
||||
[disabled]="!config.myEmail"
|
||||
[ngClass]="{'btn-primary': config.myEmail}"
|
||||
class="btn btn-block"
|
||||
[disabled]="!config.myEmail || !config.myEmail.length"
|
||||
[ngClass]="{'btn--primary': config.myEmail}"
|
||||
class="btn btn--full"
|
||||
i18n-value="'config.find_button'|translate"
|
||||
type="submit"
|
||||
/>
|
||||
</form >
|
||||
</section >
|
||||
<section class="list-my-polls" *ngIf="!config.loading">
|
||||
<ul class="poll-list" *ngFor="let poll of config.myPolls">
|
||||
<li> poll</li>
|
||||
<section
|
||||
class="list-my-polls"
|
||||
*ngIf="!config.loading" >
|
||||
<h2 >
|
||||
Mes Sondages trouvés:
|
||||
</h2 >
|
||||
<ul
|
||||
class="poll-list"
|
||||
*ngFor="let poll of config.myPolls ; index as i;trackBy trackFunction" >
|
||||
<li >
|
||||
<a href='{{poll.url}}' >
|
||||
{{poll.title}}
|
||||
<sub >
|
||||
{{poll.description}}
|
||||
</sub >
|
||||
</a >
|
||||
</li >
|
||||
</ul >
|
||||
|
||||
<div class="no-polls" *ngIf="! config.myPolls || !config.myPolls.length">
|
||||
<div
|
||||
class="no-polls"
|
||||
*ngIf="! config.myPolls || !config.myPolls.length" >
|
||||
Aucun sondage.
|
||||
</div >
|
||||
</section >
|
||||
<div class="loading" *ngIf="config.loading">
|
||||
<div
|
||||
class="loading"
|
||||
*ngIf="config.loading" >
|
||||
<i class="fa fa-refresh fa-spin fa-3x fa-fw" ></i >
|
||||
</div >
|
||||
|
||||
|
||||
</div >
|
||||
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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",
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user