mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
⚡ 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
|
* une option de date dans les sondages spéciaux
|
||||||
*/
|
*/
|
||||||
import {environment} from "../../environments/environment";
|
import {environment} from "../../environments/environment";
|
||||||
|
import {mockMyPolls} from "./mocks/mockmypolls";
|
||||||
|
import {defaultAnswers, defaultDates, timeOfDay} from "./defaultConfigs";
|
||||||
|
|
||||||
export interface DateOption {
|
export interface DateOption {
|
||||||
timeList: any;
|
timeList: any;
|
||||||
literal: string;
|
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
|
* configuration of the poll, add new fields at will
|
||||||
@ -51,15 +17,16 @@ export const defaultAnswers = [{
|
|||||||
export class PollConfig {
|
export class PollConfig {
|
||||||
expiracyDateDefaultInDays = 60;
|
expiracyDateDefaultInDays = 60;
|
||||||
deletionDateAfterLastModification = 180;
|
deletionDateAfterLastModification = 180;
|
||||||
step = 0;
|
step: number = 0; // step in the progress of creating a poll
|
||||||
stepMax = 3;
|
stepMax: number = 3; // step max in the progress of creating a poll
|
||||||
pollType = 'classic';// classic or date
|
pollType: string = 'classic';// classic or date
|
||||||
title = 'titre';
|
title: string = 'titre';
|
||||||
description = 'ma description';
|
description: string = 'ma description';
|
||||||
myName = 'mon pseudo';
|
myName: string = 'mon pseudo';
|
||||||
myComment = 'wouah trop bien framadate!';
|
myComment: string = 'wouah trop bien framadate!';
|
||||||
isAdmin: boolean = false;
|
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
|
// 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';
|
allowSeveralHours = 'false';
|
||||||
// access
|
// 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 >
|
<br >
|
||||||
<button
|
<button
|
||||||
[routerLink]="'/step/resume'"
|
[routerLink]="'/step/resume'"
|
||||||
class="btn btn--primary"
|
class="btn btn--full btn--primary"
|
||||||
i18n
|
i18n
|
||||||
>
|
>
|
||||||
Voyons ce que ça donne
|
Voyons ce que ça donne
|
||||||
|
@ -3,12 +3,16 @@
|
|||||||
<h1 >
|
<h1 >
|
||||||
{{"creation.title"|translate}}
|
{{"creation.title"|translate}}
|
||||||
</h1 >
|
</h1 >
|
||||||
<p class="description margin-btm-x5" i18n>
|
<p
|
||||||
|
class="description margin-btm-x5"
|
||||||
|
i18n >
|
||||||
{{"config.description"|translate}}
|
{{"config.description"|translate}}
|
||||||
</p >
|
</p >
|
||||||
<div class="btn-next" >
|
<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}}
|
{{"config.letsgo"|translate}}
|
||||||
</button >
|
</button >
|
||||||
|
|
||||||
@ -27,10 +31,12 @@
|
|||||||
for="email"
|
for="email"
|
||||||
i18n
|
i18n
|
||||||
>
|
>
|
||||||
|
<i class='fa fa-envelope' ></i >
|
||||||
{{"config.find_helper"|translate}} :
|
{{"config.find_helper"|translate}} :
|
||||||
</label >
|
</label >
|
||||||
<input
|
<input
|
||||||
[(ngModel)]="config.myEmail"
|
[(ngModel)]="config.myEmail"
|
||||||
|
class='input'
|
||||||
autofocus="autofocus"
|
autofocus="autofocus"
|
||||||
id="email"
|
id="email"
|
||||||
name="mail"
|
name="mail"
|
||||||
@ -38,26 +44,43 @@
|
|||||||
type="email"
|
type="email"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
[disabled]="!config.myEmail"
|
[disabled]="!config.myEmail || !config.myEmail.length"
|
||||||
[ngClass]="{'btn-primary': config.myEmail}"
|
[ngClass]="{'btn--primary': config.myEmail}"
|
||||||
class="btn btn-block"
|
class="btn btn--full"
|
||||||
i18n-value="'config.find_button'|translate"
|
i18n-value="'config.find_button'|translate"
|
||||||
type="submit"
|
type="submit"
|
||||||
/>
|
/>
|
||||||
</form >
|
</form >
|
||||||
</section >
|
</section >
|
||||||
<section class="list-my-polls" *ngIf="!config.loading">
|
<section
|
||||||
<ul class="poll-list" *ngFor="let poll of config.myPolls">
|
class="list-my-polls"
|
||||||
<li> poll</li>
|
*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 >
|
</ul >
|
||||||
|
|
||||||
<div class="no-polls" *ngIf="! config.myPolls || !config.myPolls.length">
|
<div
|
||||||
|
class="no-polls"
|
||||||
|
*ngIf="! config.myPolls || !config.myPolls.length" >
|
||||||
Aucun sondage.
|
Aucun sondage.
|
||||||
</div >
|
</div >
|
||||||
</section >
|
</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 >
|
<i class="fa fa-refresh fa-spin fa-3x fa-fw" ></i >
|
||||||
</div >
|
</div >
|
||||||
|
|
||||||
|
|
||||||
</div >
|
</div >
|
||||||
|
@ -11,6 +11,7 @@ export class CreateOrRetrieveComponent extends BaseComponent implements OnInit {
|
|||||||
|
|
||||||
loadedMyPolls: boolean = false;
|
loadedMyPolls: boolean = false;
|
||||||
|
|
||||||
|
|
||||||
constructor(public config: ConfigService) {
|
constructor(public config: ConfigService) {
|
||||||
super(config);
|
super(config);
|
||||||
}
|
}
|
||||||
@ -30,4 +31,7 @@ export class CreateOrRetrieveComponent extends BaseComponent implements OnInit {
|
|||||||
this.loadedMyPolls = true;
|
this.loadedMyPolls = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trackFunction(index: number, item: any): number {
|
||||||
|
return item.id;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {BaseComponent} from "../base-page/base.component";
|
import {BaseComponent} from "../base-page/base.component";
|
||||||
import {ConfigService} from "../../services/config.service";
|
import {ConfigService} from "../../services/config.service";
|
||||||
import {mockPoll3} from "../../config/mock-poll3";
|
import {mockPoll3} from "../../config/mocks/mock-poll3";
|
||||||
import {mockComments} from "../../config/mock-comments";
|
import {mockComments} from "../../config/mocks/mock-comments";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'framadate-poll-display',
|
selector: 'framadate-poll-display',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Component, Input, OnInit} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {mockComments} from "../../../config/mock-comments";
|
import {mockComments} from "../../../config/mocks/mock-comments";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'framadate-voting-comment',
|
selector: 'framadate-voting-comment',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {Component, Input, OnInit} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {ConfigService} from "../../../services/config.service";
|
import {ConfigService} from "../../../services/config.service";
|
||||||
import {mockPoll3} from "../../../config/mock-poll3";
|
import {mockPoll3} from "../../../config/mocks/mock-poll3";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'framadate-voting-summary',
|
selector: 'framadate-voting-summary',
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import {Component, Inject, OnInit} from "@angular/core";
|
import {Component, Inject, OnInit} from "@angular/core";
|
||||||
import {Chart} from "chart.js";
|
import {Chart} from "chart.js";
|
||||||
import {DOCUMENT} from '@angular/common';
|
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 {graphOptions} from "../config/graph-canevas-options";
|
||||||
import {ConfigService} from "../services/config.service";
|
import {ConfigService} from "../services/config.service";
|
||||||
import {mockPoll3} from "../config/mock-poll3";
|
import {mockPoll3} from "../config/mocks/mock-poll3";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "framadate-poll-graphic",
|
selector: "framadate-poll-graphic",
|
||||||
|
@ -15,7 +15,6 @@ export class ConfigService extends PollConfig {
|
|||||||
|
|
||||||
loading: boolean = false;
|
loading: boolean = false;
|
||||||
baseHref: any = environment.baseApiHref;
|
baseHref: any = environment.baseApiHref;
|
||||||
myPolls: any;// list of retrieved polls from the backend api
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private http: HttpClient,
|
constructor(private http: HttpClient,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user