reorganize poll display page

This commit is contained in:
Baptiste Lemoine 2020-01-16 10:20:15 +01:00
commit 79ef34e5af
65 changed files with 1516 additions and 1122 deletions

View File

@ -1,133 +1,138 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"framadate": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "framadate",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/framadate",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": false,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": [
"node_modules/marked/lib/marked.js",
"node_modules/prismjs/prism.js",
"node_modules/prismjs/components/prism-css.min.js"
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"framadate": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
"root": "",
"sourceRoot": "src",
"prefix": "framadate",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/framadate",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": false,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/primeicons/primeicons.css",
"node_modules/font-awesome/css/font-awesome.css",
"node_modules/primeng/resources/themes/nova-light/theme.css",
"node_modules/primeng/resources/primeng.min.css",
"src/styles.scss"
],
"scripts": [
"node_modules/marked/lib/marked.js",
"node_modules/prismjs/prism.js",
"node_modules/prismjs/components/prism-css.min.js"
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "framadate:build"
},
"configurations": {
"production": {
"browserTarget": "framadate:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "framadate:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "framadate:serve"
},
"configurations": {
"production": {
"devServerTarget": "framadate:serve:production"
}
}
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "framadate:build"
},
"configurations": {
"production": {
"browserTarget": "framadate:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "framadate:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "framadate:serve"
},
"configurations": {
"production": {
"devServerTarget": "framadate:serve:production"
}
}
}
}
}},
"defaultProject": "framadate"
},
"defaultProject": "framadate"
}

View File

@ -17,7 +17,7 @@ module.exports = function (config) {
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/framadate'),
reports: ['html', 'lcovonly', 'text-summary'],
reports: ['html', 'lcovonly', 'name-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],

View File

@ -1,52 +1,61 @@
{
"name": "framadate-funky-frontend",
"version": "0.1.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"trans": "ng xi18n --output-path=src/locale --i18n-locale=fr"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.0",
"@angular/common": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/forms": "~8.2.0",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"chart.js": "^2.8.0",
"ngx-markdown": "^8.2.1",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.21",
"@angular/cli": "~8.3.21",
"@angular/compiler-cli": "^8.2.14",
"@angular/language-service": "^8.2.14",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "^2.0.8",
"@types/node": "~8.9.4",
"codelyzer": "^5.2.1",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.5.1",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
"name": "framadate-funky-frontend",
"version": "0.1.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"serve": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"trans": "ng xi18n --output-path=src/locale --i18n-locale=fr"
},
"private": true,
"dependencies": {
"@angular/animations": "^8.2.14",
"@angular/cdk": "^8.2.3",
"@angular/common": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/forms": "~8.2.0",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"@fullcalendar/core": "^4.3.1",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"chart.js": "^2.8.0",
"font-awesome": "^4.7.0",
"ngx-markdown": "^8.2.1",
"ngx-toaster": "^1.0.1",
"primeicons": "^2.0.0",
"primeng": "^9.0.0-rc.2",
"quill": "^1.3.7",
"rxjs": "~6.4.0",
"rxjs-compat": "^6.5.3",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.21",
"@angular/cli": "~8.3.21",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.8",
"@types/node": "~8.9.4",
"codelyzer": "^5.2.1",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.5.1",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}

View File

@ -1,6 +1,5 @@
import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {BaseComponent} from './pages/base-page/base.component';
@ -21,12 +20,12 @@ import {EndConfirmationComponent} from './pages/end-confirmation/end-confirmatio
import {CreateOrRetrieveComponent} from './pages/create-or-retrieve/create-or-retrieve.component';
import localeFr from '@angular/common/locales/fr';
import localeEn from '@angular/common/locales/en';
import {VotingSummaryComponent} from './pages/voting-summary/voting-summary.component';
import {VotingGraphComponent} from './pages/voting-graph/voting-graph.component';
import {VotingChoiceComponent} from './pages/voting-choice/voting-choice.component';
import {VotingSummaryComponent} from './pages/voting/voting-summary/voting-summary.component';
import {VotingGraphComponent} from './pages/voting/voting-graph/voting-graph.component';
import {VotingChoiceComponent} from './pages/voting/voting-choice/voting-choice.component';
import {PasswordComponent} from './pages/password/password.component';
import {HomeComponent} from './pages/home/home.component';
import {VoteChoiceComponent} from './vote-choice/vote-choice.component';
import {VoteChoiceComponent} from './ui/vote-choice/vote-choice.component';
import {HttpClient, HttpClientModule} from '@angular/common/http';
import {MarkdownModule} from 'ngx-markdown';
import {
@ -41,7 +40,14 @@ import {PollGraphicComponent} from './poll-graphic/poll-graphic.component';
import {AdminComponent} from './pages/admin/admin.component';
import {SelectorComponent} from './ui/selector/selector.component';
import { VotingComponent } from './pages/voting/voting.component';
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {ConfigService} from "./services/config.service";
import {PollService} from "./services/poll.service";
import {ToastModule} from 'primeng/toast';
import {MessageService} from "primeng";
import {PollDisplayComponent} from './pages/poll-display/poll-display.component';
import {VotingComponent} from './pages/voting/voting.component';
import { VotingCommentComponent } from './pages/voting/voting-comment/voting-comment.component';
export class MyMissingTranslationHandler implements MissingTranslationHandler {
handle(params: MissingTranslationHandlerParams) {
@ -80,13 +86,17 @@ export function HttpLoaderFactory(http: HttpClient) {
VoteChoiceComponent,
AdminComponent,
SelectorComponent,
PollDisplayComponent,
VotingComponent,
VotingCommentComponent,
],
imports: [
CommonModule,
BrowserModule,
BrowserAnimationsModule,
AppRoutingModule,
ToastModule,
MarkdownModule.forRoot(),
TranslateModule.forRoot({
missingTranslationHandler: {
@ -104,7 +114,7 @@ export function HttpLoaderFactory(http: HttpClient) {
FormsModule,
RouterModule.forRoot(Routes)
],
providers: [TranslateService],
providers: [TranslateService, ConfigService, PollService, MessageService],
bootstrap: [AppComponent]
})
export class AppModule {

View File

@ -1,37 +0,0 @@
import {Injectable} from '@angular/core';
import {PollConfig} from './config/PollConfig';
import {HttpClient} from "@angular/common/http";
import {environment} from "../environments/environment";
/**
* le service transverse à chaque page qui permet de syncroniser la configuration de sondage souhaitée
*/
@Injectable({
providedIn: 'root'
})
export class ConfigService extends PollConfig {
myEmail: string;
myPolls: any;// list of retrieved polls from the backend api
constructor(public http: HttpClient) {
super();
}
set(key, val) {
this[key] = val;
}
createPoll() {
// todo
console.log('sends the form');
alert('envoi de formulaire pour création de sondage en XHR à faire');
const payload = this;
this.http.post(`${environment.baseApiHref}/poll`, payload)
.subscribe(res => {
console.log('res', res)
},
err => console.error('err', err))
}
}

View File

@ -58,9 +58,13 @@ export class PollConfig {
visibility = 'link_only'; // visible to anyone with the link:
voteChoices = 'only_yes'; // possible answers to a vote choice: only "yes", "yes, maybe, no"
expirationDate = ''; // expiracy date
pollId = null; // id of the current poll when created. data given by the backend api
selectedPoll = null; // current poll selected with createPoll or getPoll of ConfigService
passwordAccess = 0;
password = '';
customUrl = '';
urlPublic = 'https://framadate.org/default-url';
urlAdmin = 'https://framadate.org/default-url/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
canModifyAnswers = 1;// everybody, self, nobody (= just admin)
whoModifiesAnswers = "self";// everybody, self, nobody (= just admin)
whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin)
@ -69,5 +73,6 @@ export class PollConfig {
answers: any = defaultAnswers;
constructor() {
}
}

View File

@ -10,7 +10,9 @@ import {CreateOrRetrieveComponent} from '../pages/create-or-retrieve/create-or-r
import {BaseComponent} from '../pages/base-page/base.component';
import {HomeComponent} from "../pages/home/home.component";
import {PollGraphicComponent} from '../poll-graphic/poll-graphic.component';
import {VoteChoiceComponent} from "../vote-choice/vote-choice.component";
import {VoteChoiceComponent} from "../ui/vote-choice/vote-choice.component";
import {PollDisplayComponent} from "../pages/poll-display/poll-display.component";
import {VotingComponent} from "../pages/voting/voting.component";
import {PasswordComponent} from "../pages/password/password.component";
/**
@ -18,7 +20,7 @@ import {PasswordComponent} from "../pages/password/password.component";
*/
export const Routes =
[
{path: '', component: CreateOrRetrieveComponent},
{path: '', redirectTo: 'step/creation', pathMatch: 'full'},
{path: 'home', component: HomeComponent},
{path: 'base', component: BaseComponent},
{path: 'step/base', component: BaseComponent},
@ -32,7 +34,9 @@ export const Routes =
{path: 'step/resume', component: ResumeComponent},
{path: 'step/end', component: EndConfirmationComponent},
{path: 'graphic/:poll', component: PollGraphicComponent},
{path: 'vote/poll/id/:poll', component: PollDisplayComponent},
{path: 'votechoice', component: VoteChoiceComponent},
{path: '**', redirectTo: '/home', pathMatch: 'full'},
{path: 'voting', component: VotingComponent},
{path: 'step/password', component: PasswordComponent},
]

View File

@ -0,0 +1,8 @@
export const mockComments = [
{
name: "Bulbizarre",
date: "23 décembre 2019",
text: "Pokem ipsum dolor sit amet Electric Cottonee Scratch Leech Life Ice Berry Ducklett. Leaf Green Durant Zoroark\n" +
" Skitty Rock Luxio Surskit. Glacier Badge",
}
];

View File

@ -0,0 +1,186 @@
export const mockPoll3 = {
"message": "your poll config",
"data": {
"id": 3,
"title": "dessin animé préféré",
"customUrl": null,
"description": "choisissez votre animé préféré",
"creationDate": {
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
},
"expiracyDate": {
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
},
"owner": {
"__initializer__": {},
"__cloner__": {},
"__isInitialized__": false
},
"kind": "text",
"allowedAnswers": [
"yes"
],
"modificationPolicy": "self",
"mailOnComment": null,
"mailOnVote": null,
"hideResults": null,
"showResultEvenIfPasswords": null,
"votes": {},
"stacksOfVotes": {},
"choices": {},
"comments": {},
"defaultExpiracyDaysFromNow": 60
},
"stacks_count": 2,
"stacks": [
{
"pseudo": "Wulfila",
"votes": {}
},
{
"pseudo": "Tykayn",
"votes": {}
}
],
"choices_count": 7,
"choices": [
{
"id": 5,
"name": "Vic le viking",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
},
{
"id": 6,
"name": "Boumbo petite automobile",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
},
{
"id": 7,
"name": "Les mystérieuses cités d'or",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
},
{
"id": 8,
"name": "Les mondes engloutis",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
},
{
"id": 9,
"name": "Foot 2 rue",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
},
{
"id": 10,
"name": "Le chat, la vache, et l'océan",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
},
{
"id": 11,
"name": "Digimon",
"dateTime": {
"date": "2020-01-15 15:07:53.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
},
"votes": {
"count": {
"yes": 0,
"no": 0,
"maybe": 0,
"null": 0,
}
},
simpleAnswer: true,
"answer": null
}
],
"comments": []
}

View File

@ -17,52 +17,32 @@
<li>
type de formulaire: {{config.pollType}}
</li>
<li>
config:
<pre>
{{config.answers|json}}
</pre>
</li>
</ul>
<button
class="btn btn--primary"
i18n
(click)="config.createPoll()"
>
Envoyer le formulaire
</button>
<button
class="btn btn--primary"
i18n
(click)="config.getPollById(1, 'example password')"
>
get poll 1
</button>
<button
class="btn btn--primary"
i18n
(click)="config.getMyPolls( 'tktest@tktest.com')"
>
get my polls
</button>
<button class="btn btn--success" (click)="launchToast()">
launch success toast
</button>
<a [routerLink]="'/vote/poll/id/3'" class="btn btn--success">
See example of vote page
</a>
</div>
<span i18n>
Choix cornélien syncronisé:
</span>
<!-- todo: factoriser les boutons-->
<button
(click)="config.set('pollType' , 'classic')"
[class.active]="config.pollType == 'classic'"
[disabled]="!formIsValid"
class="btn btn--primary next"
>
<span i18n>
sondage classique
</span>
<span *ngIf="config.pollType == 'classic'">
[x]
</span>
</button>
<button
(click)="selectOption('pollType' ,'dates')"
[class.active]="config.pollType == 'dates'"
[disabled]="!formIsValid"
class="btn btn--primary next"
>
<span i18n>
sondage spécial date
</span>
<span *ngIf="config.pollType == 'dates'">
[x]
</span>
</button>
<button
class="btn btn--primary"
i18n
(click)="config.createPoll()"
>
Envoyer le formulaire
</button>

View File

@ -1,5 +1,5 @@
import {Component, OnInit} from '@angular/core';
import {ConfigService} from '../config.service';
import {ConfigService} from '../services/config.service';
@Component({
selector: 'framadate-debugger',
@ -23,4 +23,8 @@ export class DebuggerComponent implements OnInit {
return true;
}
launchToast() {
this.config.handleError({message: "hop"})
}
}

View File

@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import {BaseComponent} from '../base-page/base.component';
import {ConfigService} from '../../config.service';
import {ConfigService} from '../../services/config.service';
@Component({
selector: 'framadate-admin',
templateUrl: './admin.component.html',

View File

@ -11,7 +11,7 @@
<li #answers *ngFor="let answer of config.answers; index as i;trackBy trackFunction"
class="answer-item">
<input
type="text"
type="name"
class="answer"
[(ngModel)]="answer.text"
(keyup.enter)="addAnswer()"

View File

@ -1,6 +1,6 @@
import {AfterViewInit, ChangeDetectorRef, Component, Inject, OnInit} from '@angular/core';
import {BaseComponent} from '../base-page/base.component';
import {ConfigService} from '../../config.service';
import {ConfigService} from '../../services/config.service';
import {DOCUMENT} from '@angular/common';

View File

@ -1,5 +1,5 @@
import {Component, OnInit} from '@angular/core';
import {ConfigService} from '../../config.service';
import {ConfigService} from '../../services/config.service';
@Component({
selector: 'framadate-base-page',

View File

@ -17,23 +17,49 @@
<h1 class="margin-top-x8">
{{"config.find_my_polls"|translate}}
</h1>
<section class="list-my-polls">
<!--<ul class="poll-list" *ngFor="let poll of config.myPolls">-->
<a href="#" class="next margin-btm-x3">Anniversaire de tonton Patrick</a>
<a href="#" class="next margin-btm-x5">Anniversaire de Bernard </a>
<!--</ul>-->
</section>
<form (ngSubmit)="findMyPollsByEmail(emailToFind.value)">
<section class="row">
<label class="description" for="email" i18n>
<form
(ngSubmit)="findMyPollsByEmail(config.myEmail)"
>
<label
class="description"
for="email"
i18n
>
{{"config.find_helper"|translate}} :
</label>
<input class="margin-btm-x5" #emailToFind type="email" name="mail" id="email" autofocus="autofocus">
</section>
<input type="submit" class="btn btn--primary btn--default btn--purple btn--black-text" value='{{"config.find_button"|translate}}'>
<input
type="email"
name="mail"
id="email"
autofocus="autofocus"
[(ngModel)]="config.myEmail"
required="required"
/>
<input
type="submit"
class="btn btn-block"
[ngClass]="{'btn-primary': config.myEmail}"
i18n-value="'config.find_button'|translate"
[disabled]="!config.myEmail"
/>
</form>
</section>
<section class="list-my-polls" *ngIf="!config.loading">
<ul class="poll-list" *ngFor="let poll of config.myPolls">
<li> poll</li>
</ul>
<div class="no-polls" *ngIf="! config.myPolls || !config.myPolls.length">
Aucun sondage.
</div>
</section>
<div class="loading" *ngIf="config.loading">
<i class="fa fa-refresh fa-spin fa-3x fa-fw"></i>
</div>
</div>

View File

@ -1,7 +1,6 @@
import {Component, OnInit} from '@angular/core';
import {BaseComponent} from "../base-page/base.component";
import {ConfigService} from "../../config.service";
import {PollServiceService} from "../../services/poll-service.service";
import {ConfigService} from "../../services/config.service";
@Component({
selector: 'framadate-create-or-retrieve',
@ -10,15 +9,22 @@ import {PollServiceService} from "../../services/poll-service.service";
})
export class CreateOrRetrieveComponent extends BaseComponent implements OnInit {
constructor(public config: ConfigService, public pollService: PollServiceService) {
loadedMyPolls: boolean = false;
constructor(public config: ConfigService) {
super(config);
}
ngOnInit() {
this.findMyPollsByEmail('tktest@tktest.com')
}
findMyPollsByEmail(email: string) {
this.pollService.findPollsByEmail(email);
if (!email) {
return
}
this.config.findPollsByEmail(email);
this.loadedMyPolls = true;
}
}

View File

@ -89,7 +89,7 @@
<input
[(ngModel)]="choice.literal"
name="timeChoices_{{id}}"
type="text"
type="name"
>
<button (click)="config.timeList.splice(id, 1)" class="btn btn-warning">X</button>
</div>
@ -133,7 +133,7 @@
<input
[(ngModel)]="time.literal"
name="dateTime_{{id}}_Choices_{{idTime}}"
type="text"
type="name"
>
<button
(click)="choice.timeList.splice(idTime, 1)"

View File

@ -1,5 +1,5 @@
import {ChangeDetectorRef, Component, Inject, OnInit} from '@angular/core';
import {ConfigService} from '../../config.service';
import {ConfigService} from '../../services/config.service';
import {BaseComponent} from '../base-page/base.component';
import {DOCUMENT} from '@angular/common';

View File

@ -1,7 +1,7 @@
import {Component, OnInit} from '@angular/core';
import {BaseComponent} from '../base-page/base.component';
import {ConfigService} from '../../config.service';
import {HttpClient} from '@angular/common/http';
import {ConfigService} from "../../services/config.service";
@Component({
selector: 'framadate-end-confirmation',

View File

@ -36,7 +36,7 @@
{{"creation.choose_title"|translate}}
</label>
<input
type="text"
type="name"
id="poll_title"
name="poll_title"
placeholder="{{'creation.choose_title_placeholder'|translate}}"
@ -49,7 +49,7 @@
{{"creation.name"|translate}} :
</label>
<input
type="text"
type="name"
name="my_name"
id="my_name"
placeholder="{{'creation.name_placeholder'|translate}}"

View File

@ -1,5 +1,5 @@
import {Component, OnInit} from '@angular/core';
import {ConfigService} from "../../config.service";
import {ConfigService} from "../../services/config.service";
import {BaseComponent} from "../base-page/base.component";
@Component({

View File

@ -104,9 +104,9 @@
<label for="">Un label pour les labelliser tous</label>
<h3>Input text</h3>
<input type="text" name="" id=""><br>
<input type="text" name="" id="" value="texte">
<h3>Input name</h3>
<input type="name" name="" id=""><br>
<input type="name" name="" id="" value="texte">
<h3>Input email</h3>
<input type="email" name="" id=""><br>
@ -198,9 +198,9 @@
</article>
<article>
<h2>Label + input text</h2>
<h2>Label + input name</h2>
<label for="test-text">Ceci est un label un peu long mais pas trop</label>
<input type="text" name="test-text" id="test-text">
<input type="name" name="test-text" id="test-text">
</article>
<article>
@ -220,7 +220,7 @@
</article>
<article>
<h2>Input text with info</h2>
<h2>Input name with info</h2>
<a href="https://sketch.cloud/s/00A80/a/MAl5q7">like here</a>
</article>

View File

@ -1,6 +1,6 @@
import {Component, OnInit} from '@angular/core';
import {BaseComponent} from '../base-page/base.component';
import {ConfigService} from '../../config.service';
import {ConfigService} from '../../services/config.service';
@Component({
selector: 'framadate-page-kind',

View File

@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import {BaseComponent} from "../base-page/base.component";
import {ConfigService} from "../../config.service";
import {ConfigService} from "../../services/config.service";
@Component({
selector: 'framadate-password',

View File

@ -1,5 +1,5 @@
import {Component, OnInit} from '@angular/core';
import {ConfigService} from '../../config.service';
import {ConfigService} from '../../services/config.service';
import {BaseComponent} from '../base-page/base.component';
@Component({

View File

@ -0,0 +1,47 @@
<div class="poll">
<h1>{{pollConfigFetched.data.title}}</h1>
<p>{{pollConfigFetched.data.description}}</p>
<p class="creationDate">{{pollConfigFetched.data.creationDate.date}}</p>
<p class="expiracyDate">{{pollConfigFetched.data.creationDate.date}}</p>
<p class="votants">
{{pollConfigFetched.stacks_count}} votants,
{{pollConfigFetched.choices_count}} choix,
</p>
</div>
<section class="row name">
<label for="name">Votre nom :</label>
<input type="text" name="name" id="name" [(ngModel)]="config.myName">
</section>
<div class="list-of-choices">
<div *ngFor="let choice of pollConfigFetched.choices">
<framadate-vote-choice [choice]="choice"></framadate-vote-choice>
</div>
</div>
<framadate-voting-graph></framadate-voting-graph>
<framadate-voting-summary></framadate-voting-summary>
<div class="comments">
<h2 class="margin-top-x7">Laisser un commentaire</h2>
<label for="crname">Votre nom :</label>
<input type="text" class="margin-btm-x3" name="crname" id="crname">
<div>
<label for="comment">Votre commentaire :</label>
<textarea name="comment" id="comment">
</textarea>
</div>
<input type="submit" name="add-comment" class="btn btn--primary btn--outline" value="Ajouter mon commentaire">
<framadate-voting-comment [comment]="c" *ngFor="let c of comments"></framadate-voting-comment>
</div>
<div class="sharing">
<h3 class="margin-top-x8">Partager le sondage</h3>
<label class="nobold text-14" for="copyLink">Pour partager le sondage, vous pouvez diffuser ce lien :
<code>
{{config.urlAdmin}}
</code>
</label>
<input type="submit" name="copy-link" class=" btn btn--primary btn--outline" value="Copier le lien" id="copyLink">
<h3 class="margin-top-x6 margin-btm-x3">Exporter/Imprimer</h3>
<input type="submit" name="export" class="margin-btm-x3 btn btn--primary btn--outline" value="Exporter en .csv" (click)="exportCSV()">
<input type="submit" name="copy-link" class="btn btn--primary btn--outline" value="Imprimer le sondage">
</div>

View File

@ -0,0 +1,88 @@
@import "../../../assets/scss/variables";
form {
display: flex;
margin: auto;
flex-direction: column;
align-items: center;
justify-content: flex-start;
}
.popup {
display: flex;
flex-direction: column;
z-index: 2222222222;
}
.row {
flex-direction: row;
}
label {
font-weight: 600;
font-size: 18px;
}
.comment, .prefered {
border-left: 6px solid $ugly-purple;
padding-left: 5px;
margin-top: 25px;
margin-bottom: 25px;
flex-wrap: wrap;
}
.comment {
display: flex;
}
.commeny span {
flex-direction: row;
}
.cname {
padding-left: 17px;
font-weight: bold;
}
.btn {
max-width: 300px;
}
.next {
max-width: 200px;
}
input[type=text], textarea {
max-width: 350px;
}
li {
list-style-type: none;
}
h2 {
}
.next {
align-self: flex-end;
margin-bottom: 50px;
}
textarea {
height: 213px;
margin-bottom: 20px;
}
.name {
margin-bottom: 50px;
margin-top: 50px;
}
label {
align-items: flex-start;
}
.nobold {
font-weight: normal;
}

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PollDisplayComponent } from './poll-display.component';
describe('PollDisplayComponent', () => {
let component: PollDisplayComponent;
let fixture: ComponentFixture<PollDisplayComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PollDisplayComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PollDisplayComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,29 @@
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";
@Component({
selector: 'framadate-poll-display',
templateUrl: './poll-display.component.html',
styleUrls: ['./poll-display.component.scss']
})
export class PollDisplayComponent extends BaseComponent implements OnInit {
private pollConfigFetched = mockPoll3;
private comments = mockComments;
constructor(public config: ConfigService) {
super(config);
}
ngOnInit() {
// fetch poll with its ID or slug.
// store it in the poll property here
}
exportCSV() {
// TODO
}
}

View File

@ -1,6 +1,6 @@
import {Component, OnInit} from '@angular/core';
import {BaseComponent} from '../base-page/base.component';
import {ConfigService} from '../../config.service';
import {ConfigService} from '../../services/config.service';
@Component({
selector: 'framadate-resume',

View File

@ -103,7 +103,7 @@
{{"visibility.access_url_key"|translate}}
</label>
<br>
<input type="text"
<input type="name"
class="input-lg"
name="url"
id="url"
@ -133,7 +133,7 @@
min="8"
*ngIf="!showCustomPassword"
[(ngModel)]="config.password">
<input type="text"
<input type="name"
name="password_visible"
id="password_visible"
min="8"

View File

@ -1,6 +1,6 @@
import {Component, OnInit} from '@angular/core';
import {BaseComponent} from '../base-page/base.component';
import {ConfigService} from '../../config.service';
import {ConfigService} from '../../services/config.service';
@Component({
selector: 'framadate-visibility',

View File

@ -1 +0,0 @@
<p>voting-graph works!</p>