parent
b6e703b6ca
commit
f9b847b305
@ -1,116 +1,116 @@
|
||||
{
|
||||
"name": "framadate-funky-frontend",
|
||||
"version": "1.0.0",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build:prod": "ng build --prod",
|
||||
"build:prod:stats": "ng build --prod --stats-json",
|
||||
"build:prod:gitlabpage": "ng build --prod --baseHref=/framadate/funky-framadate-front/",
|
||||
"build:prod:demobliss": "ng build --prod --baseHref=https://framadate-api.cipherbliss.com",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"test:ci": "jest --ci",
|
||||
"lint": "prettier --write \"src/**/*.{js,jsx,ts,tsx,md,html,css,scss}\"",
|
||||
"e2e": "ng e2e",
|
||||
"format:check": "prettier --list-different \"src/{app,environments,assets}/**/*{.ts,.js,.json,.css,.scss}\"",
|
||||
"format:all": "prettier --write \"src/**/*.{js,jsx,ts,tsx,md,html,css,scss}\"",
|
||||
"trans": "ng xi18n --output-path=src/locale --i18n-locale=fr",
|
||||
"compodoc": "compodoc -p tsconfig.app.json",
|
||||
"mock:server": "json-server --port 8000 --watch ./mocks/db.json --routes ./mocks/routes.json",
|
||||
"start:proxy": "ng serve --proxy-config proxy.conf.json",
|
||||
"start:proxymock": "concurrently --kill-others \"yarn mock:server\" \"yarn start:proxy\""
|
||||
},
|
||||
"private": false,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^9.1.1",
|
||||
"@angular/cdk": "^9.2.2",
|
||||
"@angular/common": "^9.0.7",
|
||||
"@angular/compiler": "^9.0.7",
|
||||
"@angular/core": "^9.0.7",
|
||||
"@angular/forms": "^9.0.7",
|
||||
"@angular/localize": "^9.1.1",
|
||||
"@angular/platform-browser": "^9.0.7",
|
||||
"@angular/platform-browser-dynamic": "^9.0.7",
|
||||
"@angular/router": "^9.0.7",
|
||||
"@fullcalendar/core": "^4.4.0",
|
||||
"@ngx-translate/core": "^12.1.2",
|
||||
"@ngx-translate/http-loader": "^4.0.0",
|
||||
"angular-date-value-accessor": "^1.0.2",
|
||||
"axios": "^0.19.2",
|
||||
"bulma": "^0.9.0",
|
||||
"bulma-switch": "^2.0.0",
|
||||
"chart.js": "^2.9.3",
|
||||
"fork-awesome": "^1.1.7",
|
||||
"ng2-charts": "^2.3.0",
|
||||
"ngx-clipboard": "^13.0.0",
|
||||
"ngx-markdown": "^9.0.0",
|
||||
"ngx-webstorage": "^5.0.0",
|
||||
"primeng": "^9.0.6",
|
||||
"quill": "^1.3.7",
|
||||
"rxjs": "^6.5.5",
|
||||
"rxjs-compat": "^6.5.5",
|
||||
"tslib": "<2.0.0",
|
||||
"uuid": "^8.0.0",
|
||||
"zone.js": "^0.10.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-builders/jest": "^9.0.1",
|
||||
"@angular-devkit/build-angular": "^0.901.2",
|
||||
"@angular/cli": "^9.1.2",
|
||||
"@angular/compiler-cli": "^9.1.1",
|
||||
"@angular/language-service": "^9.0.7",
|
||||
"@babel/core": "^7.9.0",
|
||||
"@babel/preset-env": "^7.9.5",
|
||||
"@babel/preset-typescript": "^7.9.0",
|
||||
"@compodoc/compodoc": "^1.1.11",
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/node": "^14.0.1",
|
||||
"@types/uuid": "^8.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^3.0.0",
|
||||
"@typescript-eslint/parser": "^3.0.0",
|
||||
"babel-jest": "^26.0.0",
|
||||
"concurrently": "^5.2.0",
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-plugin-prettier": "^3.1.3",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^26.0.0",
|
||||
"jest-environment-jsdom-sixteen": "^1.0.3",
|
||||
"jest-preset-angular": "^8.1.3",
|
||||
"json-server": "^0.16.1",
|
||||
"lint-staged": "^10.1.7",
|
||||
"prettier": "^2.0.5",
|
||||
"protractor": "~7.0.0",
|
||||
"ts-jest": "^26.0.0",
|
||||
"ts-mockito": "^2.5.0",
|
||||
"ts-node": "^8.10.1",
|
||||
"typescript": "<3.9.0"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"src/**/*.{js,jsx,ts,tsx,md,html,css,scss}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
],
|
||||
"*.js": [
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"jest": {
|
||||
"preset": "jest-preset-angular",
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/src/jest.setup.ts"
|
||||
],
|
||||
"testEnvironment": "jest-environment-jsdom-sixteen",
|
||||
"transform": {
|
||||
"^.+\\.(ts|html)$": "ts-jest",
|
||||
"^.+\\.jsx?$": "babel-jest"
|
||||
}
|
||||
}
|
||||
"name": "framadate-funky-frontend",
|
||||
"version": "1.0.0",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build:prod": "ng build --prod",
|
||||
"build:prod:stats": "ng build --prod --stats-json",
|
||||
"build:prod:gitlabpage": "ng build --prod --baseHref=/framadate/funky-framadate-front/",
|
||||
"build:prod:demobliss": "ng build --prod --baseHref=https://framadate-api.cipherbliss.com",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"test:ci": "jest --ci",
|
||||
"lint": "prettier --write \"src/**/*.{js,jsx,ts,tsx,md,html,css,scss}\"",
|
||||
"e2e": "ng e2e",
|
||||
"format:check": "prettier --list-different \"src/{app,environments,assets}/**/*{.ts,.js,.json,.css,.scss}\"",
|
||||
"format:all": "prettier --write \"src/**/*.{js,jsx,ts,tsx,md,html,css,scss}\"",
|
||||
"trans": "ng xi18n --output-path=src/locale --i18n-locale=fr",
|
||||
"compodoc": "compodoc -p tsconfig.app.json",
|
||||
"mock:server": "json-server --port 8000 --watch ./mocks/db.json --routes ./mocks/routes.json",
|
||||
"start:proxy": "ng serve --proxy-config proxy.conf.json",
|
||||
"start:proxymock": "concurrently --kill-others \"yarn mock:server\" \"yarn start:proxy\""
|
||||
},
|
||||
"private": false,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^9.1.1",
|
||||
"@angular/cdk": "^9.2.2",
|
||||
"@angular/common": "^9.0.7",
|
||||
"@angular/compiler": "^9.0.7",
|
||||
"@angular/core": "^9.0.7",
|
||||
"@angular/forms": "^9.0.7",
|
||||
"@angular/localize": "^9.1.1",
|
||||
"@angular/material": "^9.2.4",
|
||||
"@angular/platform-browser": "^9.0.7",
|
||||
"@angular/platform-browser-dynamic": "^9.0.7",
|
||||
"@angular/router": "^9.0.7",
|
||||
"@fullcalendar/core": "^4.4.0",
|
||||
"@ngx-translate/core": "^12.1.2",
|
||||
"@ngx-translate/http-loader": "^5.0.0",
|
||||
"angular-date-value-accessor": "^1.0.2",
|
||||
"axios": "^0.19.2",
|
||||
"bulma": "^0.9.0",
|
||||
"bulma-switch": "^2.0.0",
|
||||
"chart.js": "^2.9.3",
|
||||
"fork-awesome": "^1.1.7",
|
||||
"ng2-charts": "^2.3.0",
|
||||
"ngx-clipboard": "^13.0.0",
|
||||
"ngx-markdown": "^9.0.0",
|
||||
"ngx-webstorage": "^5.0.0",
|
||||
"primeng": "^9.0.6",
|
||||
"quill": "^1.3.7",
|
||||
"rxjs": "^6.5.5",
|
||||
"rxjs-compat": "^6.5.5",
|
||||
"short-unique-id": "^3.0.3",
|
||||
"tslib": "<2.0.0",
|
||||
"zone.js": "^0.10.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-builders/jest": "^9.0.1",
|
||||
"@angular-devkit/build-angular": "^0.901.2",
|
||||
"@angular/cli": "^9.1.2",
|
||||
"@angular/compiler-cli": "^9.1.1",
|
||||
"@angular/language-service": "^9.0.7",
|
||||
"@babel/core": "^7.9.0",
|
||||
"@babel/preset-env": "^7.9.5",
|
||||
"@babel/preset-typescript": "^7.9.0",
|
||||
"@compodoc/compodoc": "^1.1.11",
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/node": "^14.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^3.0.0",
|
||||
"@typescript-eslint/parser": "^3.0.0",
|
||||
"babel-jest": "^26.0.0",
|
||||
"concurrently": "^5.2.0",
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-plugin-prettier": "^3.1.3",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^26.0.0",
|
||||
"jest-environment-jsdom-sixteen": "^1.0.3",
|
||||
"jest-preset-angular": "^8.1.3",
|
||||
"json-server": "^0.16.1",
|
||||
"lint-staged": "^10.1.7",
|
||||
"prettier": "^2.0.5",
|
||||
"protractor": "~7.0.0",
|
||||
"ts-jest": "^26.0.0",
|
||||
"ts-mockito": "^2.5.0",
|
||||
"ts-node": "^8.10.1",
|
||||
"typescript": "<3.9.0"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"src/**/*.{js,jsx,ts,tsx,md,html,css,scss}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
],
|
||||
"*.js": [
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"jest": {
|
||||
"preset": "jest-preset-angular",
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/src/jest.setup.ts"
|
||||
],
|
||||
"testEnvironment": "jest-environment-jsdom-sixteen",
|
||||
"transform": {
|
||||
"^.+\\.(ts|html)$": "ts-jest",
|
||||
"^.+\\.jsx?$": "babel-jest"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,19 @@
|
||||
<div id="big_container" [class]="themeClass">
|
||||
<div class="container">
|
||||
<app-header [isSidebarOpened]="isSidebarOpened" (toggleSidebarEE)="toggleSidebar($event)"></app-header>
|
||||
<main>
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
<app-footer></app-footer>
|
||||
<app-feedback></app-feedback>
|
||||
</div>
|
||||
</div>
|
||||
<mat-sidenav-container (backdropClick)="sidenav.toggle()">
|
||||
<mat-sidenav #sidenav mode="side">
|
||||
<app-navigation></app-navigation>
|
||||
</mat-sidenav>
|
||||
|
||||
<p-toast position="bottom-center"></p-toast>
|
||||
<p-sidebar [(visible)]="isSidebarOpened">
|
||||
<app-navigation></app-navigation>
|
||||
</p-sidebar>
|
||||
<mat-sidenav-content>
|
||||
<div id="big_container" [class]="themeClass">
|
||||
<div class="container">
|
||||
<mat-slide-toggle (change)="sidenav.toggle()">Dev Menu</mat-slide-toggle>
|
||||
<app-header></app-header>
|
||||
<main>
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
<app-footer></app-footer>
|
||||
<app-feedback></app-feedback>
|
||||
</div>
|
||||
</div>
|
||||
</mat-sidenav-content>
|
||||
</mat-sidenav-container>
|
||||
|
@ -0,0 +1,52 @@
|
||||
<nav class="navbar" role="navigation" aria-label="main navigation">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item" role="button" (click)="toggleSidebarOpening()"> Dev menu </a>
|
||||
|
||||
<a
|
||||
role="button"
|
||||
class="navbar-burger burger"
|
||||
aria-label="menu"
|
||||
aria-expanded="false"
|
||||
data-target="navbarBasicExample"
|
||||
>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="navbarBasicExample" class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link"> Modules </a>
|
||||
<div class="navbar-dropdown">
|
||||
<a class="navbar-item" routerLink="oldstuff" routerLinkActive="is-active">
|
||||
Old stuff
|
||||
</a>
|
||||
<a class="navbar-item" routerLink="administration" routerLinkActive="is-active">
|
||||
Administration
|
||||
</a>
|
||||
<a class="navbar-item" routerLink="consultation" routerLinkActive="is-active">
|
||||
Consultation
|
||||
</a>
|
||||
<a class="navbar-item" routerLink="participation" routerLinkActive="is-active">
|
||||
Participation
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link"> Tous les sondages </a>
|
||||
<div class="navbar-dropdown">
|
||||
<a
|
||||
class="navbar-item"
|
||||
*ngFor="let slug of slugsAvailables"
|
||||
routerLink="{{ '/consultation/poll/' + slug }}"
|
||||
routerLinkActive="is-active"
|
||||
>
|
||||
« {{ slug }} »
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
@ -1,19 +1,19 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PollEditComponent } from './poll-edit.component';
|
||||
import { DevNavbarComponent } from './dev-navbar.component';
|
||||
|
||||
describe('PollEditComponent', () => {
|
||||
let component: PollEditComponent;
|
||||
let fixture: ComponentFixture<PollEditComponent>;
|
||||
describe('DevNavbarComponent', () => {
|
||||
let component: DevNavbarComponent;
|
||||
let fixture: ComponentFixture<DevNavbarComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [PollEditComponent],
|
||||
declarations: [DevNavbarComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PollEditComponent);
|
||||
fixture = TestBed.createComponent(DevNavbarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
@ -0,0 +1,35 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { User } from '../../models/user.model';
|
||||
import { ApiService } from '../../services/api.service';
|
||||
import { UserService } from '../../services/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dev-navbar',
|
||||
templateUrl: './dev-navbar.component.html',
|
||||
styleUrls: ['./dev-navbar.component.scss'],
|
||||
})
|
||||
export class DevNavbarComponent implements OnInit {
|
||||
@Input() isSidebarOpened: boolean;
|
||||
@Output() toggleSidebarEE = new EventEmitter<boolean>();
|
||||
|
||||
public _user: Observable<User> = this.userService.user;
|
||||
|
||||
public slugsAvailables: string[] = [];
|
||||
|
||||
constructor(private apiService: ApiService, private userService: UserService) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.getSlugs();
|
||||
}
|
||||
|
||||
public async getSlugs(): Promise<void> {
|
||||
this.slugsAvailables = await this.apiService.getAllPollsSlugs();
|
||||
}
|
||||
|
||||
public toggleSidebarOpening(): void {
|
||||
this.isSidebarOpened = !this.isSidebarOpened;
|
||||
this.toggleSidebarEE.emit(this.isSidebarOpened);
|
||||
}
|
||||
}
|
@ -1,19 +1,58 @@
|
||||
<nav>
|
||||
<a class="button" routerLink="oldstuff/home" routerLinkActive="active">
|
||||
<nav class="has-background-light">
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link"> Tous les sondages </a>
|
||||
<div class="navbar-dropdown">
|
||||
<a
|
||||
class="navbar-item"
|
||||
*ngFor="let slug of slugsAvailables"
|
||||
routerLink="{{ '/consultation/poll/' + slug }}"
|
||||
routerLinkActive="is-active"
|
||||
>
|
||||
« {{ slug }} »
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link"> Modules </a>
|
||||
<div class="navbar-dropdown">
|
||||
<a class="navbar-item" routerLink="oldstuff" routerLinkActive="is-active">
|
||||
Old stuff
|
||||
</a>
|
||||
<a class="navbar-item" routerLink="administration" routerLinkActive="is-active">
|
||||
Administration
|
||||
</a>
|
||||
<a class="navbar-item" routerLink="consultation" routerLinkActive="is-active">
|
||||
Consultation
|
||||
</a>
|
||||
<a class="navbar-item" routerLink="participation" routerLinkActive="is-active">
|
||||
Participation
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<a class="button is-block" routerLink="oldstuff/step/home" routerLinkActive="active">
|
||||
<i class="fa fa-home" aria-hidden="true"></i> Accueil
|
||||
</a>
|
||||
<a class="button" routerLink="oldstuff/step/creation" routerLinkActive="active"> Création </a>
|
||||
<a class="button" routerLink="oldstuff/step/date" routerLinkActive="active"> Les Dates </a>
|
||||
<a class="button" routerLink="oldstuff/step/answers" routerLinkActive="active"> Réponses </a>
|
||||
<a class="button" routerLink="oldstuff/step/visibility" routerLinkActive="active"> Visibilité </a>
|
||||
<a class="button" routerLink="oldstuff/step/resume" routerLinkActive="active"> Résumé </a>
|
||||
<a class="button" routerLink="oldstuff/step/end" routerLinkActive="active"> Confirmation </a>
|
||||
<a class="button" routerLink="oldstuff/step/admin"> Administration </a>
|
||||
<a class="button is-block" routerLink="oldstuff/step/creation" routerLinkActive="active"> Création </a>
|
||||
<a class="button is-block" routerLink="oldstuff/step/date" routerLinkActive="active"> Les Dates </a>
|
||||
<a class="button is-block" routerLink="oldstuff/step/answers" routerLinkActive="active"> Réponses </a>
|
||||
<a class="button is-block" routerLink="oldstuff/step/visibility" routerLinkActive="active"> Visibilité </a>
|
||||
<a class="button is-block" routerLink="oldstuff/step/resume" routerLinkActive="active"> Résumé </a>
|
||||
<a class="button is-block" routerLink="oldstuff/step/end" routerLinkActive="active"> Confirmation </a>
|
||||
<a class="button is-block" routerLink="oldstuff/step/admin"> Administration </a>
|
||||
|
||||
<hr />
|
||||
|
||||
<a class="button" routerLink="oldstuff/step/kind" routerLinkActive="active"> Page démo </a>
|
||||
<a class="button" routerLink="oldstuff/vote/poll/id/1" routerLinkActive="active"> Sondage 1 </a>
|
||||
<a class="button" routerLink="oldstuff/vote/poll/id/2" routerLinkActive="active"> Sondage 2 </a>
|
||||
<a class="button" routerLink="oldstuff/vote/poll/id/3" routerLinkActive="active"> Sondage 3 (dessins animés) </a>
|
||||
<a class="button" routerLink="oldstuff/graphic/toto" routerLinkActive="active"> Graphique </a>
|
||||
<a class="button is-block" routerLink="oldstuff/step/kind" routerLinkActive="active"> Page démo </a>
|
||||
<a class="button is-block" routerLink="oldstuff/vote/poll/id/1" routerLinkActive="active"> Sondage 1 </a>
|
||||
<a class="button is-block" routerLink="oldstuff/vote/poll/id/2" routerLinkActive="active"> Sondage 2 </a>
|
||||
<a class="button is-block" routerLink="oldstuff/vote/poll/id/3" routerLinkActive="active">
|
||||
Sondage 3 (dessins animés)
|
||||
</a>
|
||||
<a class="button is-block" routerLink="oldstuff/graphic/toto" routerLinkActive="active"> Graphique </a>
|
||||
</nav>
|
||||
|
@ -1,12 +1,23 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import { ApiService } from '../../../services/api.service';
|
||||
import { UserService } from '../../../services/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-navigation',
|
||||
templateUrl: './navigation.component.html',
|
||||
styleUrls: ['./navigation.component.scss'],
|
||||
})
|
||||
export class NavigationComponent implements OnInit {
|
||||
constructor() {}
|
||||
public slugsAvailables: string[] = [];
|
||||
|
||||
constructor(private apiService: ApiService, private userService: UserService) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.getSlugs();
|
||||
}
|
||||
|
||||
ngOnInit(): void {}
|
||||
public async getSlugs(): Promise<void> {
|
||||
this.slugsAvailables = await this.apiService.getAllPollsSlugs();
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,22 @@
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { DateUtilsService } from '../utils/date-utils.service';
|
||||
import { DateService } from '../services/date.service';
|
||||
|
||||
export class Configuration {
|
||||
constructor(
|
||||
public isAboutDate: boolean = false,
|
||||
public isProtectedByPassword: boolean = false,
|
||||
public isOwnerNotifiedByEmail: { onNewVote: boolean; onNewComment: boolean } = {
|
||||
onNewVote: false,
|
||||
onNewComment: false,
|
||||
},
|
||||
public isOwnerNotifiedByEmailOnNewVote: boolean = false,
|
||||
public isOwnerNotifiedByEmailOnNewComment: boolean = false,
|
||||
public isMaybeAnswerAvailable: boolean = false,
|
||||
public areResultsPublic: boolean = false,
|
||||
public areResultsPublic: boolean = true,
|
||||
public dateCreated: Date = new Date(Date.now()),
|
||||
public expires: Date = DateUtilsService.addDaysToDate(
|
||||
public expires: Date = DateService.addDaysToDate(
|
||||
environment.poll.defaultConfig.expiracyInDays,
|
||||
new Date(Date.now())
|
||||
)
|
||||
) {}
|
||||
|
||||
public static isArchived(configuration: Configuration): boolean {
|
||||
return DateUtilsService.isDateInPast(configuration.expires);
|
||||
return DateService.isDateInPast(configuration.expires);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DateUtilsService } from './date-utils.service';
|
||||
import { DateService } from './date.service';
|
||||
|
||||
describe('DateUtilsService', () => {
|
||||
let service: DateUtilsService;
|
||||
let service: DateService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(DateUtilsService);
|
||||
service = TestBed.inject(DateService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
@ -1,19 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MessageService } from 'primeng/api';
|
||||
|
||||
import { MessageSeverity } from '../enums/message-severity.enum';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class MessageDisplayerService {
|
||||
constructor(private messageService: MessageService) {}
|
||||
|
||||
public display(severity: MessageSeverity, summary?: string, detail?: string): void {
|
||||
this.messageService.add({
|
||||
severity,
|
||||
summary,
|
||||
detail,
|
||||
});
|
||||
}
|
||||
}
|
@ -1,26 +1,20 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { DialogService } from 'primeng';
|
||||
|
||||
import { ChoiceDetailsComponent } from '../../shared/components/choice-details/choice-details.component';
|
||||
import { SettingsComponent } from '../../shared/components/settings/settings.component';
|
||||
import { Choice } from '../models/choice.model';
|
||||
import { ComponentType } from '@angular/cdk/portal';
|
||||
import { Injectable, TemplateRef } from '@angular/core';
|
||||
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ModalService {
|
||||
constructor(public dialogService: DialogService) {}
|
||||
constructor(public dialog: MatDialog) {}
|
||||
|
||||
public openSettingsComponent(): void {
|
||||
this.dialogService.open(SettingsComponent, { header: 'Paramètres', dismissableMask: true });
|
||||
public openModal_OLD<T, K>(componentOrTemplateRef: ComponentType<T> | TemplateRef<T>, data?: K): void {
|
||||
this.dialog.open(componentOrTemplateRef, { data: data });
|
||||
}
|
||||
|
||||
public openChoiceDetailsComponent(choice: Choice): void {
|
||||
this.dialogService.open(ChoiceDetailsComponent, {
|
||||
header: 'Détails des votes',
|
||||
dismissableMask: true,
|
||||
data: choice,
|
||||
width: '70%',
|
||||
});
|
||||
public openModal<T, D = any>(
|
||||
componentOrTemplateRef: ComponentType<T> | TemplateRef<T>,
|
||||
config?: MatDialogConfig<D>
|
||||
): void {
|
||||
this.dialog.open<T, D>(componentOrTemplateRef, config);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MessageDisplayerService } from './message-displayer.service';
|
||||
import { ToastService } from './toast.service';
|
||||
|
||||
describe('MessageService', () => {
|
||||
let service: MessageDisplayerService;
|
||||
let service: ToastService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(MessageDisplayerService);
|
||||
service = TestBed.inject(ToastService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
@ -0,0 +1,14 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ToastService {
|
||||
constructor(private _snackBar: MatSnackBar) {}
|
||||
|
||||
public display(message: string, action?: string): void {
|
||||
const config: MatSnackBarConfig = { duration: 2000 };
|
||||
this._snackBar.open(message, action, config);
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PollUtilsService } from './poll-utils.service';
|
||||
import { UuidService } from './uuid.service';
|
||||
|
||||
describe('PollUtilsService', () => {
|
||||
let service: PollUtilsService;
|
||||
describe('UuidService', () => {
|
||||
let service: UuidService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(PollUtilsService);
|
||||
service = TestBed.inject(UuidService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
@ -0,0 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import ShortUniqueId from 'short-unique-id';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class UuidService {
|
||||
private uid = new ShortUniqueId();
|
||||
|
||||
public getUUID(): string {
|
||||
return this.uid();
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class PollUtilsService {
|
||||
public makeUuid(): string {
|
||||
// TODO: how to be sure the uuid generated in front is available in backend ?
|
||||
// It could be a better way to generate uuids in backend.
|
||||
return uuidv4();
|
||||
}
|
||||
|
||||
/**
|
||||
* make a uniq slug for the current poll creation
|
||||
* @param str
|
||||
*/
|
||||
public makeSlug(config: any): string {
|
||||
let str = '';
|
||||
str =
|
||||
config.creationDate.getFullYear() +
|
||||
'_' +
|
||||
(config.creationDate.getMonth() + 1) +
|
||||
'_' +
|
||||
config.creationDate.getDate() +
|
||||
'_' +
|
||||
config.myName +
|
||||
'_' +
|
||||
config.title;
|
||||
str = str.replace(/^\s+|\s+$/g, ''); // trim
|
||||
str = str.toLowerCase();
|
||||
|
||||
// remove accents, swap ñ for n, etc
|
||||
const from = 'àáäâèéëêìíïîòóöôùúüûñç·/_,:;';
|
||||
const to = 'aaaaeeeeiiiioooouuuunc------';
|
||||
for (let i = 0, l = from.length; i < l; i++) {
|
||||
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
|
||||
}
|
||||
|
||||
str = str
|
||||
.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
|
||||
.replace(/\s+/g, '-') // collapse whitespace and replace by -
|
||||
.replace(/-+/g, '-'); // collapse dashes
|
||||
|
||||
return str;
|
||||
}
|
||||
}
|
@ -1,12 +1,21 @@
|
||||
<div class="container has-text-centered">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<app-stepper></app-stepper>
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column has-text-centered">
|
||||
<h1>Administration</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<app-spinner *ngIf="_isLoading | async"></app-spinner>
|
||||
|
||||
<ng-container *ngIf="!(_isLoading | async)">
|
||||
<ng-container *ngIf="!(_poll | async)">
|
||||
<app-page-not-found [message]="'PAGE_NOT_FOUND.POLL'"></app-page-not-found>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="_poll | async as poll">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<app-stepper [poll]="poll"></app-stepper>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
@ -1 +0,0 @@
|
||||
<p>edit-configuration works!</p>
|
@ -1,24 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { EditConfigurationComponent } from './edit-configuration.component';
|
||||
|
||||
describe('EditConfigurationComponent', () => {
|
||||
let component: EditConfigurationComponent;
|
||||
let fixture: ComponentFixture<EditConfigurationComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [EditConfigurationComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(EditConfigurationComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -1,12 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-configuration',
|
||||
templateUrl: './edit-configuration.component.html',
|
||||
styleUrls: ['./edit-configuration.component.scss'],
|
||||
})
|
||||
export class EditConfigurationComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
<div [ngClass]="{ 'is-success': pollForm.status == 'VALID' }" class="info form-status pull-right debug">
|
||||
<p>Form Status: {{ pollForm.status }}</p>
|
||||
</div>
|
||||
<br />
|
||||
<form [formGroup]="pollForm" (ngSubmit)="onSubmit()">
|
||||
<div class="control is-expanded">
|
||||
<div class="field">
|
||||
<label for="primeType">Sondage concerne des dates ?</label>
|
||||
<p-inputSwitch id="primeType" formControlName="type"></p-inputSwitch>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control is-expanded">
|
||||
<label class="label" for="title">
|
||||
Intitulé
|
||||
<input class="input" formControlName="title" id="title" placeholder="Intitulé" type="text" />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="control is-expanded">
|
||||
<label class="label" for="description">
|
||||
Description
|
||||
<textarea
|
||||
formControlName="description"
|
||||
id="description"
|
||||
pInputTextarea
|
||||
placeholder="Description"
|
||||
></textarea>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="control is-expanded">
|
||||
<label class="label" for="slug">
|
||||
Url personnalisée
|
||||
<input class="input" formControlName="slug" id="slug" placeholder="Url" type="text" />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<button class="button is-fullwidth is-primary" type="submit" [disabled]="!pollForm.valid">Créer</button>
|
||||
</form>
|
@ -1,24 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { EditDescriptionComponent } from './edit-description.component';
|
||||
|
||||
describe('EditDescriptionComponent', () => {
|
||||
let component: EditDescriptionComponent;
|
||||
let fixture: ComponentFixture<EditDescriptionComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [EditDescriptionComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(EditDescriptionComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -1,41 +0,0 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
|
||||
import { Poll } from '../../../core/models/poll.model';
|
||||
import { PollUtilsService } from '../../../core/utils/poll-utils.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-description',
|
||||
templateUrl: './edit-description.component.html',
|
||||
styleUrls: ['./edit-description.component.scss'],
|
||||
})
|
||||
export class EditDescriptionComponent implements OnInit {
|
||||
@Input()
|
||||
public poll?: Poll;
|
||||
public pollForm: FormGroup;
|
||||
|
||||
constructor(private fb: FormBuilder, private pollUtilsService: PollUtilsService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.pollForm = this.fb.group({
|
||||
type: [this.poll ? this.poll.configuration.isAboutDate : false, |