From 18a7d4781ac44f820b870269f5134b305758e722 Mon Sep 17 00:00:00 2001 From: seraph Date: Tue, 14 Apr 2020 11:28:33 +0200 Subject: [PATCH] reformat all files + move routes.ts to AppRoutingModule --- package.json | 1 - src/app/app-routing.module.ts | 50 +- src/app/app.component.html | 32 +- src/app/app.component.spec.ts | 48 +- src/app/app.component.ts | 55 +- src/app/app.module.ts | 115 +- src/app/config/DateUtilities.ts | 17 +- src/app/config/PollConfig.ts | 19 +- src/app/config/PollUtilities.ts | 38 +- src/app/config/Routes.ts | 79 +- src/app/config/defaultConfigs.ts | 89 +- src/app/config/graph-canevas-options.ts | 20 +- src/app/config/mocks/choice.ts | 18 +- src/app/config/mocks/mock-comments.ts | 25 +- src/app/config/mocks/mock-graph.ts | 38 +- src/app/config/mocks/mock-poll3.ts | 878 ++++++----- src/app/config/mocks/mock-success-vote.ts | 1328 ++++++++--------- src/app/config/mocks/mockmypolls.ts | 87 +- .../date-value-accessor.ts | 18 +- .../custom-lib/date-value-accessor/index.ts | 1 - .../custom-lib/date-value-accessor/module.ts | 6 +- src/app/debugger/debugger.component.html | 70 +- src/app/debugger/debugger.component.spec.ts | 31 +- src/app/debugger/debugger.component.ts | 14 +- src/app/header/header.component.spec.ts | 31 +- src/app/header/header.component.ts | 13 +- src/app/pages/admin/admin.component.html | 120 +- src/app/pages/admin/admin.component.scss | 60 +- src/app/pages/admin/admin.component.spec.ts | 31 +- src/app/pages/admin/admin.component.ts | 14 +- src/app/pages/answers/answers.component.html | 126 +- .../pages/answers/answers.component.spec.ts | 31 +- src/app/pages/answers/answers.component.ts | 52 +- src/app/pages/base-page/base.component.html | 2 +- .../pages/base-page/base.component.spec.ts | 31 +- src/app/pages/base-page/base.component.ts | 14 +- .../create-or-retrieve.component.html | 121 +- .../create-or-retrieve.component.scss | 34 +- .../create-or-retrieve.component.spec.ts | 31 +- .../create-or-retrieve.component.ts | 15 +- src/app/pages/dates/dates.component.html | 303 ++-- src/app/pages/dates/dates.component.scss | 4 +- src/app/pages/dates/dates.component.spec.ts | 31 +- src/app/pages/dates/dates.component.ts | 65 +- .../end-confirmation.component.html | 114 +- .../end-confirmation.component.spec.ts | 31 +- .../end-confirmation.component.ts | 26 +- src/app/pages/home/home.component.html | 152 +- src/app/pages/home/home.component.spec.ts | 31 +- src/app/pages/home/home.component.ts | 13 +- src/app/pages/kind/kind.component.html | 452 +++--- src/app/pages/kind/kind.component.scss | 1 - src/app/pages/kind/kind.component.spec.ts | 31 +- src/app/pages/kind/kind.component.ts | 13 +- .../pages/password/password.component.html | 12 +- .../pages/password/password.component.scss | 18 +- .../pages/password/password.component.spec.ts | 31 +- src/app/pages/password/password.component.ts | 15 +- .../pages/pictures/pictures.component.html | 3 +- .../pages/pictures/pictures.component.spec.ts | 31 +- src/app/pages/pictures/pictures.component.ts | 13 +- .../poll-display/poll-display.component.html | 116 +- .../poll-display/poll-display.component.scss | 4 +- .../poll-display.component.spec.ts | 31 +- .../poll-display/poll-display.component.ts | 40 +- src/app/pages/resume/resume.component.html | 164 +- src/app/pages/resume/resume.component.spec.ts | 31 +- src/app/pages/resume/resume.component.ts | 15 +- .../visibility/visibility.component.html | 288 ++-- .../visibility/visibility.component.spec.ts | 31 +- .../pages/visibility/visibility.component.ts | 21 +- .../choices-list/choices-list.component.html | 41 +- .../choices-list.component.spec.ts | 31 +- .../choices-list/choices-list.component.ts | 12 +- .../comments-list.component.html | 85 +- .../comments-list.component.spec.ts | 34 +- .../comments-list/comments-list.component.ts | 12 +- .../voting-choice.component.html | 269 ++-- .../voting-choice.component.scss | 33 +- .../voting-choice.component.spec.ts | 41 +- .../voting-choice/voting-choice.component.ts | 28 +- .../voting-comment.component.html | 24 +- .../voting-comment.component.spec.ts | 9 +- .../voting-comment.component.ts | 14 +- .../voting-graph.component.spec.ts | 31 +- .../voting-graph/voting-graph.component.ts | 15 +- .../voting-navigation.component.html | 57 +- .../voting-navigation.component.spec.ts | 31 +- .../voting-navigation.component.ts | 11 +- .../voting-summary.component.html | 269 ++-- .../voting-summary.component.scss | 2 +- .../voting-summary.component.spec.ts | 31 +- .../voting-summary.component.ts | 24 +- src/app/pages/voting/voting.component.html | 7 - src/app/pages/voting/voting.component.spec.ts | 31 +- src/app/pages/voting/voting.component.ts | 15 +- .../poll-graphic/poll-graphic.component.html | 35 +- .../poll-graphic.component.spec.ts | 31 +- .../poll-graphic/poll-graphic.component.ts | 72 +- src/app/services/config.service.ts | 1222 ++++++++------- src/app/services/poll-service.service.spec.ts | 10 +- src/app/services/poll.service.ts | 12 +- src/app/services/progression.service.spec.ts | 10 +- src/app/ui/copy-text/copy-text.component.html | 18 +- .../ui/copy-text/copy-text.component.spec.ts | 9 +- src/app/ui/copy-text/copy-text.component.ts | 17 +- .../resettable-input.directive.spec.ts | 8 +- .../directives/resettable-input.directive.ts | 9 +- .../erasable-input.component.html | 9 +- .../erasable-input.component.spec.ts | 31 +- .../erasable-input.component.ts | 11 +- .../master-head/master-head.component.html | 9 +- .../master-head/master-head.component.spec.ts | 31 +- .../master-head/master-head.component.ts | 13 +- .../ui/navigation/navigation.component.html | 126 +- .../ui/navigation/navigation.component.scss | 1 - .../navigation/navigation.component.spec.ts | 31 +- src/app/ui/navigation/navigation.component.ts | 20 +- .../selector/language/language.component.html | 20 +- .../language/language.component.spec.ts | 31 +- .../selector/language/language.component.ts | 36 +- src/app/ui/selector/selector.component.html | 11 +- .../ui/selector/selector.component.spec.ts | 31 +- src/app/ui/selector/selector.component.ts | 25 +- .../theme-selector.component.html | 43 +- .../theme-selector.component.spec.ts | 31 +- .../theme-selector.component.ts | 12 +- src/assets/css/bootstrap-reboot-4.3.1.css | 74 +- src/assets/scss/atoms/_buttons.scss | 14 +- src/assets/scss/atoms/_fonts.scss | 70 +- src/assets/scss/atoms/_forms.scss | 20 +- src/assets/scss/atoms/_links.scss | 3 +- src/assets/scss/atoms/_lists.scss | 2 +- src/assets/scss/atoms/_main.scss | 1 - src/assets/scss/default.scss | 32 +- src/assets/scss/molecules/_debug.scss | 24 +- src/assets/scss/molecules/_flex-line.scss | 2 +- src/assets/scss/molecules/_logo.scss | 3 +- src/assets/scss/themes/_all.scss | 6 +- src/assets/scss/themes/_dark.scss | 13 +- src/assets/scss/themes/_light.scss | 1 - src/assets/scss/themes/_red.scss | 5 +- src/assets/scss/variables.scss | 18 +- src/environments/environment.ts | 8 +- src/index.html | 24 +- src/main.ts | 7 +- src/polyfills.ts | 3 +- src/stories/0-Welcome.stories.ts | 10 +- src/stories/1-Button.stories.ts | 48 +- src/styles.scss | 34 +- src/test.ts | 10 +- 151 files changed, 4347 insertions(+), 5151 deletions(-) diff --git a/package.json b/package.json index 57e2e151..da5c6f07 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "ng": "ng", "start": "ng serve", "compodoc": "compodoc -p tsconfig.json", - "serve": "ng serve", "build": "ng build --crossOrigin=anonymous --prod", "package": "cat dist/framadate/*.js > dist/framadate/framadate-scripts-bundled.js && ls -l dist/framadate", "bld:pkg": "npm run build && npm run package", diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 7df9717d..4ec1729b 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,12 +1,48 @@ -import {NgModule} from '@angular/core'; -import {RouterModule, Routes} from '@angular/router'; +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { AdminComponent } from './pages/admin/admin.component'; +import { AnswersComponent } from './pages/answers/answers.component'; +import { BaseComponent } from './pages/base-page/base.component'; +import { CreateOrRetrieveComponent } from './pages/create-or-retrieve/create-or-retrieve.component'; +import { DatesComponent } from './pages/dates/dates.component'; +import { EndConfirmationComponent } from './pages/end-confirmation/end-confirmation.component'; +import { HomeComponent } from './pages/home/home.component'; +import { KindComponent } from './pages/kind/kind.component'; +import { PasswordComponent } from './pages/password/password.component'; +import { PicturesComponent } from './pages/pictures/pictures.component'; +import { PollDisplayComponent } from './pages/poll-display/poll-display.component'; +import { ResumeComponent } from './pages/resume/resume.component'; +import { VisibilityComponent } from './pages/visibility/visibility.component'; +import { VotingChoiceComponent } from './pages/voting/voting-choice/voting-choice.component'; +import { VotingComponent } from './pages/voting/voting.component'; +import { PollGraphicComponent } from './poll-graphic/poll-graphic.component'; -const routes: Routes = []; +const routes: Routes = [ + { path: '', redirectTo: 'step/creation', pathMatch: 'full' }, + { path: 'home', component: HomeComponent }, + { path: 'base', component: BaseComponent }, + { path: 'step/base', component: BaseComponent }, + { path: 'step/creation', component: CreateOrRetrieveComponent }, + { path: 'step/date', component: DatesComponent }, + { path: 'step/kind', component: KindComponent }, + { path: 'step/answers', component: AnswersComponent }, + { path: 'step/admin', component: AdminComponent }, + { path: 'step/pictures', component: PicturesComponent }, + { path: 'step/visibility', component: VisibilityComponent }, + { path: 'step/resume', component: ResumeComponent }, + { path: 'step/end', component: EndConfirmationComponent }, + { path: 'graphic/:poll', component: PollGraphicComponent }, + { path: 'vote/poll/id/:poll', component: PollDisplayComponent }, + { path: 'vote/poll/slug/:pollSlug', component: PollDisplayComponent }, + { path: 'votingchoice', component: VotingChoiceComponent }, + { path: 'voting', component: VotingComponent }, + { path: 'step/password', component: PasswordComponent }, + { path: '**', redirectTo: '/home', pathMatch: 'full' }, +]; @NgModule({ - imports: [RouterModule.forRoot(routes, {useHash: true, anchorScrolling: 'enabled',})], - exports: [RouterModule] + imports: [RouterModule.forRoot(routes, { useHash: true, anchorScrolling: 'enabled' })], + exports: [RouterModule], }) -export class AppRoutingModule { -} +export class AppRoutingModule {} diff --git a/src/app/app.component.html b/src/app/app.component.html index 1f42dce2..f91c69fe 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,47 +1,31 @@ -
- -
-
-
-
+
+
+
+
+
-
-
+
-
-
- - + +
-
-
-
diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 50b56d40..38e853e4 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -3,33 +3,29 @@ import { RouterTestingModule } from '@angular/router/testing'; import { AppComponent } from './app.component'; describe('AppComponent', () => { - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - RouterTestingModule - ], - declarations: [ - AppComponent - ], - }).compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [RouterTestingModule], + declarations: [AppComponent], + }).compileComponents(); + })); - it('should create the app', () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app).toBeTruthy(); - }); + it('should create the app', () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app).toBeTruthy(); + }); - it(`should have as title 'framadate'`, () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app.title).toEqual('framadate'); - }); + it(`should have as title 'framadate'`, () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app.title).toEqual('framadate'); + }); - it('should render title in a h1 tag', () => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('h1').textContent).toContain('Welcome to framadate!'); - }); + it('should render title in a h1 tag', () => { + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + const compiled = fixture.debugElement.nativeElement; + expect(compiled.querySelector('h1').textContent).toContain('Welcome to framadate!'); + }); }); diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 65021cd8..fca5999d 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,46 +1,43 @@ -import {Component, Inject} from '@angular/core'; -import {TranslateService} from '@ngx-translate/core'; -import {NavigationStart, Router} from '@angular/router'; -import {DOCUMENT} from '@angular/common'; -import {filter} from 'rxjs/operators'; -import {ConfigService} from './services/config.service'; -import {environment} from '../environments/environment'; +import { Component, Inject } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; +import { NavigationStart, Router } from '@angular/router'; +import { DOCUMENT } from '@angular/common'; +import { filter } from 'rxjs/operators'; +import { ConfigService } from './services/config.service'; +import { environment } from '../environments/environment'; @Component({ selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + styleUrls: ['./app.component.scss'], }) export class AppComponent { - step: string; - isDevelopmentEnv=false; + isDevelopmentEnv = false; - constructor(private translate: TranslateService, - public config: ConfigService, - @Inject(DOCUMENT) private document, - private route: Router) { + constructor( + private translate: TranslateService, + public config: ConfigService, + @Inject(DOCUMENT) private document, + private route: Router + ) { this.detectCurrentTabOnRouteChange(); - this.isDevelopmentEnv = !environment.production - + this.isDevelopmentEnv = !environment.production; } detectCurrentTabOnRouteChange() { - this.route.events.subscribe((event: any) => { - - - }); - this.route.events.pipe(filter(event => event instanceof NavigationStart)).subscribe((event: NavigationStart) => { - this.scrollGoToTop(); - this.updateCurrentTab(event); - // only if there is a poll ID - this.config.fetchPollFromRoute(event); - }) - + this.route.events.subscribe((event: any) => {}); + this.route.events + .pipe(filter((event) => event instanceof NavigationStart)) + .subscribe((event: NavigationStart) => { + this.scrollGoToTop(); + this.updateCurrentTab(event); + // only if there is a poll ID + this.config.fetchPollFromRoute(event); + }); } - scrollGoToTop() { this.document.documentElement.scrollTop = 0; } @@ -55,6 +52,4 @@ export class AppComponent { } } } - - } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 5d6f5c5a..cedd678b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,65 +1,63 @@ -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'; -import {KindComponent} from './pages/kind/kind.component'; -import {HeaderComponent} from './header/header.component'; -import {FormsModule} from '@angular/forms'; -import {NavigationComponent} from './ui/navigation/navigation.component'; -import {RouterModule} from '@angular/router'; -import {Routes} from './config/Routes'; -import {CommonModule, registerLocaleData} from '@angular/common'; -import {DatesComponent} from './pages/dates/dates.component'; -import {DebuggerComponent} from './debugger/debugger.component'; -import {VisibilityComponent} from './pages/visibility/visibility.component'; -import {ResumeComponent} from './pages/resume/resume.component'; -import {PicturesComponent} from './pages/pictures/pictures.component'; -import {AnswersComponent} from './pages/answers/answers.component'; -import {EndConfirmationComponent} from './pages/end-confirmation/end-confirmation.component'; -import {CreateOrRetrieveComponent} from './pages/create-or-retrieve/create-or-retrieve.component'; -import localeFr from '@angular/common/locales/fr'; +import { CommonModule, registerLocaleData } from '@angular/common'; +import { HttpClient, HttpClientModule } from '@angular/common/http'; import localeEn from '@angular/common/locales/en'; -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 {HttpClient, HttpClientModule} from '@angular/common/http'; -import {MarkdownModule} from 'ngx-markdown'; +import localeFr from '@angular/common/locales/fr'; +import { NgModule } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { BrowserModule } from '@angular/platform-browser'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MissingTranslationHandler, MissingTranslationHandlerParams, TranslateLoader, TranslateModule, - TranslateService + TranslateService, } from '@ngx-translate/core'; -import {TranslateHttpLoader} from '@ngx-translate/http-loader'; -import {PollGraphicComponent} from './poll-graphic/poll-graphic.component'; +import { TranslateHttpLoader } from '@ngx-translate/http-loader'; +import { ClipboardModule } from 'ngx-clipboard'; +import { MarkdownModule } from 'ngx-markdown'; +import { ConfirmationService, MessageModule, MessageService } from 'primeng'; +import { ConfirmDialogModule } from 'primeng/confirmdialog'; +import { DialogModule } from 'primeng/dialog'; +import { ToastModule } from 'primeng/toast'; -import {AdminComponent} from './pages/admin/admin.component'; -import {SelectorComponent} from './ui/selector/selector.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 {ConfirmationService, MessageModule, 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'; -import {ResettableInputDirective} from './ui/directives/resettable-input.directive'; -import {ClipboardModule} from 'ngx-clipboard'; -import {ErasableInputComponent} from './ui/erasable-input/erasable-input.component'; -import {ConfirmDialogModule} from 'primeng/confirmdialog'; -import {DialogModule} from 'primeng/dialog'; -import {DateValueAccessorModule} from './custom-lib/date-value-accessor'; -import {CopyTextComponent} from './ui/copy-text/copy-text.component'; -import {CommentsListComponent} from './pages/voting/comments-list/comments-list.component'; -import {ChoicesListComponent} from './pages/voting/choices-list/choices-list.component'; -import {VotingNavigationComponent} from './pages/voting/voting-navigation/voting-navigation.component'; -import { ThemeSelectorComponent } from './ui/theme-selector/theme-selector.component'; +import { AppRoutingModule } from './app-routing.module'; +import { AppComponent } from './app.component'; +import { DateValueAccessorModule } from './custom-lib/date-value-accessor'; +import { DebuggerComponent } from './debugger/debugger.component'; +import { HeaderComponent } from './header/header.component'; +import { AdminComponent } from './pages/admin/admin.component'; +import { AnswersComponent } from './pages/answers/answers.component'; +import { BaseComponent } from './pages/base-page/base.component'; +import { CreateOrRetrieveComponent } from './pages/create-or-retrieve/create-or-retrieve.component'; +import { DatesComponent } from './pages/dates/dates.component'; +import { EndConfirmationComponent } from './pages/end-confirmation/end-confirmation.component'; +import { HomeComponent } from './pages/home/home.component'; +import { KindComponent } from './pages/kind/kind.component'; +import { PasswordComponent } from './pages/password/password.component'; +import { PicturesComponent } from './pages/pictures/pictures.component'; +import { PollDisplayComponent } from './pages/poll-display/poll-display.component'; +import { ResumeComponent } from './pages/resume/resume.component'; +import { VisibilityComponent } from './pages/visibility/visibility.component'; +import { ChoicesListComponent } from './pages/voting/choices-list/choices-list.component'; +import { CommentsListComponent } from './pages/voting/comments-list/comments-list.component'; +import { VotingChoiceComponent } from './pages/voting/voting-choice/voting-choice.component'; +import { VotingCommentComponent } from './pages/voting/voting-comment/voting-comment.component'; +import { VotingGraphComponent } from './pages/voting/voting-graph/voting-graph.component'; +import { VotingNavigationComponent } from './pages/voting/voting-navigation/voting-navigation.component'; +import { VotingSummaryComponent } from './pages/voting/voting-summary/voting-summary.component'; +import { VotingComponent } from './pages/voting/voting.component'; +import { PollGraphicComponent } from './poll-graphic/poll-graphic.component'; +import { ConfigService } from './services/config.service'; +import { PollService } from './services/poll.service'; +import { CopyTextComponent } from './ui/copy-text/copy-text.component'; +import { ResettableInputDirective } from './ui/directives/resettable-input.directive'; +import { ErasableInputComponent } from './ui/erasable-input/erasable-input.component'; import { MasterHeadComponent } from './ui/navigation/master-head/master-head.component'; +import { NavigationComponent } from './ui/navigation/navigation.component'; import { LanguageComponent } from './ui/selector/language/language.component'; +import { SelectorComponent } from './ui/selector/selector.component'; +import { ThemeSelectorComponent } from './ui/theme-selector/theme-selector.component'; export class MyMissingTranslationHandler implements MissingTranslationHandler { handle(params: MissingTranslationHandlerParams) { @@ -70,7 +68,7 @@ export class MyMissingTranslationHandler implements MissingTranslationHandler { registerLocaleData(localeFr, 'fr'); registerLocaleData(localeEn, 'en'); -export function HttpLoaderFactory(http: HttpClient) { +export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader { return new TranslateHttpLoader(http); } @@ -109,7 +107,6 @@ export function HttpLoaderFactory(http: HttpClient) { ThemeSelectorComponent, MasterHeadComponent, LanguageComponent, - ], imports: [ ConfirmDialogModule, @@ -132,15 +129,13 @@ export function HttpLoaderFactory(http: HttpClient) { loader: { provide: TranslateLoader, useFactory: HttpLoaderFactory, - deps: [HttpClient] - } + deps: [HttpClient], + }, }), HttpClientModule, FormsModule, - RouterModule.forRoot(Routes, {useHash: true}) ], providers: [TranslateService, ConfigService, PollService, MessageService, ConfirmationService], - bootstrap: [AppComponent] + bootstrap: [AppComponent], }) -export class AppModule { -} +export class AppModule {} diff --git a/src/app/config/DateUtilities.ts b/src/app/config/DateUtilities.ts index a996b6b0..6e3d8607 100644 --- a/src/app/config/DateUtilities.ts +++ b/src/app/config/DateUtilities.ts @@ -1,10 +1,9 @@ -import {Injectable} from "@angular/core"; +import { Injectable } from '@angular/core'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class DateUtilities { - /** * add some days to a date, to compute intervals * @param days @@ -14,7 +13,7 @@ export class DateUtilities { date = new Date(date.valueOf()); date.setDate(date.getDate() + days); return date; - }; + } /** * @@ -29,9 +28,9 @@ export class DateUtilities { while (+d1 < +d2) { dates.push({ literal: this.formateDate(d1), - date_object: d1 + date_object: d1, }); - d1.setDate(d1.getDate() + interval) + d1.setDate(d1.getDate() + interval); } return dates.slice(0); } @@ -42,7 +41,7 @@ export class DateUtilities { * @param d2 */ dayDiff(d1: Date, d2: Date): Number { - return Number(((d2.getTime()) - (d1.getTime()) / 31536000000)); + return Number(d2.getTime() - d1.getTime() / 31536000000); } /** @@ -55,10 +54,10 @@ export class DateUtilities { date.getFullYear(), this.getDoubleDigits(date.getMonth() + 1), this.getDoubleDigits(date.getDate()), - ].join('-') + ].join('-'); } getDoubleDigits(str) { - return ("00" + str).slice(-2); + return ('00' + str).slice(-2); } } diff --git a/src/app/config/PollConfig.ts b/src/app/config/PollConfig.ts index 763253fc..096332d1 100644 --- a/src/app/config/PollConfig.ts +++ b/src/app/config/PollConfig.ts @@ -1,8 +1,8 @@ /** * une option de date dans les sondages spéciaux */ -import {environment} from '../../environments/environment'; -import {DateChoice, defaultAnswers, otherDefaultDates, PollAnswer} from './defaultConfigs'; +import { environment } from '../../environments/environment'; +import { DateChoice, defaultAnswers, otherDefaultDates, PollAnswer } from './defaultConfigs'; export interface DateOption { timeList: any; @@ -18,22 +18,17 @@ const baseConfigValues = { myEmail: '', }; - - - /** * configuration of the poll, add new fields at will */ export class PollConfig { - - menuVisible = true; expiracyDateDefaultInDays = 60; deletionDateAfterLastModification = 180; step = 0; // step in the progress of creating a poll stepMax = 3; // step max in the progress of creating a poll - pollType = 'dates';// classic or dates + pollType = 'dates'; // classic or dates title: string = environment.production ? '' : 'titre'; description: string = environment.production ? '' : 'ma description'; @@ -43,7 +38,7 @@ export class PollConfig { myVoteStack: any; myTempVoteStack = 0; myEmail: string = environment.production ? '' : 'tktest@tktest.com'; - myPolls: any = [];// list of retrieved polls from the backend api + myPolls: any = []; // 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 */ @@ -66,9 +61,9 @@ export class PollConfig { urlAdmin = environment.baseHref + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345'; adminKey = ''; // key to change config of the poll owner_modifier_token = ''; // key to change a vote stack - canModifyAnswers = true;// bool for the frontend selector - whoModifiesAnswers = 'everybody';// everybody, self, nobody (= just admin) - whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin) + canModifyAnswers = true; // bool for the frontend selector + whoModifiesAnswers = 'everybody'; // everybody, self, nobody (= just admin) + whoCanChangeAnswers = 'everybody'; // everybody, self, nobody (= just admin) dateList: any = otherDefaultDates; // sets of days as strings, config to set identical time for days in a special days poll timeList: DateChoice[] = otherDefaultDates; // ranges of time expressed as strings diff --git a/src/app/config/PollUtilities.ts b/src/app/config/PollUtilities.ts index f99bf966..5e09e2e5 100644 --- a/src/app/config/PollUtilities.ts +++ b/src/app/config/PollUtilities.ts @@ -1,9 +1,9 @@ -import {HttpHeaders} from "@angular/common/http"; -import {PollConfig} from "./PollConfig"; -import {Injectable} from "@angular/core"; +import { HttpHeaders } from '@angular/common/http'; +import { PollConfig } from './PollConfig'; +import { Injectable } from '@angular/core'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class PollUtilities { // utils functions @@ -12,7 +12,8 @@ export class PollUtilities { */ makeUuid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); + var r = (Math.random() * 16) | 0, + v = c == 'x' ? r : (r & 0x3) | 0x8; return v.toString(16); }); } @@ -23,18 +24,28 @@ export class PollUtilities { */ makeSlug(config: PollConfig) { let str = ''; - str = config.creationDate.getFullYear() + '_' + (config.creationDate.getMonth() + 1) + '_' + config.creationDate.getDate() + '_' + config.myName + '_' + config.title; + 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 - var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;"; - var to = "aaaaeeeeiiiioooouuuunc------"; + var from = 'àáäâèéëêìíïîòóöôùúüûñç·/_,:;'; + var to = 'aaaaeeeeiiiioooouuuunc------'; for (var 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 + str = str + .replace(/[^a-z0-9 -]/g, '') // remove invalid chars .replace(/\s+/g, '-') // collapse whitespace and replace by - .replace(/-+/g, '-'); // collapse dashes @@ -46,18 +57,17 @@ export class PollUtilities { * @param bodyContent */ makeHeaders(bodyContent?: any) { - const headerDict = { - 'Charset': 'UTF-8', + Charset: 'UTF-8', 'Content-Type': 'application/json', - 'Accept': 'application/json', + Accept: 'application/json', 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', - 'Access-Control-Allow-Origin': '*' + 'Access-Control-Allow-Origin': '*', }; const requestOptions = { headers: new HttpHeaders(headerDict), - body: bodyContent + body: bodyContent, }; return requestOptions; diff --git a/src/app/config/Routes.ts b/src/app/config/Routes.ts index 4e8c2de6..78455a40 100644 --- a/src/app/config/Routes.ts +++ b/src/app/config/Routes.ts @@ -1,45 +1,42 @@ -import {KindComponent} from '../pages/kind/kind.component'; -import {DatesComponent} from '../pages/dates/dates.component'; -import {VisibilityComponent} from '../pages/visibility/visibility.component'; -import {ResumeComponent} from '../pages/resume/resume.component'; -import {PicturesComponent} from '../pages/pictures/pictures.component'; -import {EndConfirmationComponent} from '../pages/end-confirmation/end-confirmation.component'; -import {AnswersComponent} from '../pages/answers/answers.component'; -import {AdminComponent} from '../pages/admin/admin.component'; -import {CreateOrRetrieveComponent} from '../pages/create-or-retrieve/create-or-retrieve.component'; -import {BaseComponent} from '../pages/base-page/base.component'; -import {HomeComponent} from "../pages/home/home.component"; -import {PollGraphicComponent} from '../poll-graphic/poll-graphic.component'; -import {PollDisplayComponent} from "../pages/poll-display/poll-display.component"; - -import {VotingComponent} from "../pages/voting/voting.component"; -import {PasswordComponent} from "../pages/password/password.component"; -import {VotingChoiceComponent} from "../pages/voting/voting-choice/voting-choice.component"; +import { AdminComponent } from '../pages/admin/admin.component'; +import { AnswersComponent } from '../pages/answers/answers.component'; +import { BaseComponent } from '../pages/base-page/base.component'; +import { CreateOrRetrieveComponent } from '../pages/create-or-retrieve/create-or-retrieve.component'; +import { DatesComponent } from '../pages/dates/dates.component'; +import { EndConfirmationComponent } from '../pages/end-confirmation/end-confirmation.component'; +import { HomeComponent } from '../pages/home/home.component'; +import { KindComponent } from '../pages/kind/kind.component'; +import { PasswordComponent } from '../pages/password/password.component'; +import { PicturesComponent } from '../pages/pictures/pictures.component'; +import { PollDisplayComponent } from '../pages/poll-display/poll-display.component'; +import { ResumeComponent } from '../pages/resume/resume.component'; +import { VisibilityComponent } from '../pages/visibility/visibility.component'; +import { VotingChoiceComponent } from '../pages/voting/voting-choice/voting-choice.component'; +import { VotingComponent } from '../pages/voting/voting.component'; +import { PollGraphicComponent } from '../poll-graphic/poll-graphic.component'; /** * each step in the form is a component */ -export const Routes = - [ - {path: '', redirectTo: 'step/creation', pathMatch: 'full'}, - {path: 'home', component: HomeComponent}, - {path: 'base', component: BaseComponent}, - {path: 'step/base', component: BaseComponent}, - {path: 'step/creation', component: CreateOrRetrieveComponent}, - {path: 'step/date', component: DatesComponent}, - {path: 'step/kind', component: KindComponent}, - {path: 'step/answers', component: AnswersComponent}, - {path: 'step/admin', component: AdminComponent}, - {path: 'step/pictures', component: PicturesComponent}, - {path: 'step/visibility', component: VisibilityComponent}, - {path: 'step/resume', component: ResumeComponent}, - {path: 'step/end', component: EndConfirmationComponent}, - {path: 'graphic/:poll', component: PollGraphicComponent}, - {path: 'vote/poll/id/:poll', component: PollDisplayComponent}, - {path: 'vote/poll/slug/:pollSlug', component: PollDisplayComponent}, - {path: 'votingchoice', component: VotingChoiceComponent}, - {path: 'voting', component: VotingComponent}, - {path: 'step/password', component: PasswordComponent}, - {path: '**', redirectTo: '/home', pathMatch: 'full'}, - ] -; +export const Routes = [ + { path: '', redirectTo: 'step/creation', pathMatch: 'full' }, + { path: 'home', component: HomeComponent }, + { path: 'base', component: BaseComponent }, + { path: 'step/base', component: BaseComponent }, + { path: 'step/creation', component: CreateOrRetrieveComponent }, + { path: 'step/date', component: DatesComponent }, + { path: 'step/kind', component: KindComponent }, + { path: 'step/answers', component: AnswersComponent }, + { path: 'step/admin', component: AdminComponent }, + { path: 'step/pictures', component: PicturesComponent }, + { path: 'step/visibility', component: VisibilityComponent }, + { path: 'step/resume', component: ResumeComponent }, + { path: 'step/end', component: EndConfirmationComponent }, + { path: 'graphic/:poll', component: PollGraphicComponent }, + { path: 'vote/poll/id/:poll', component: PollDisplayComponent }, + { path: 'vote/poll/slug/:pollSlug', component: PollDisplayComponent }, + { path: 'votingchoice', component: VotingChoiceComponent }, + { path: 'voting', component: VotingComponent }, + { path: 'step/password', component: PasswordComponent }, + { path: '**', redirectTo: '/home', pathMatch: 'full' }, +]; diff --git a/src/app/config/defaultConfigs.ts b/src/app/config/defaultConfigs.ts index 9cdfcbdf..24125ea6 100644 --- a/src/app/config/defaultConfigs.ts +++ b/src/app/config/defaultConfigs.ts @@ -1,106 +1,107 @@ export interface DateChoice { - literal: string, - timeList: TimeSlices[], - date_object: Date + literal: string; + timeList: TimeSlices[]; + date_object: Date; } export interface TimeSlices { - literal: string + literal: string; } export interface PollAnswer { - id: number, - text: string, - url: string, - file: string, - literal: string, - date_object: Date, - timeList: TimeSlices[] + id: number; + text: string; + url: string; + file: string; + literal: string; + date_object: Date; + timeList: TimeSlices[]; } const currentYear = new Date().getFullYear(); const currentMonth = new Date().getMonth(); const currentDay = new Date().getDate(); -export const basicSlicesOfDay: TimeSlices[] = [ - {literal: 'matin'}, - {literal: 'midi'}, - {literal: 'soir'} -]; +export const basicSlicesOfDay: TimeSlices[] = [{ literal: 'matin' }, { literal: 'midi' }, { literal: 'soir' }]; export const otherSlicesOfDay: TimeSlices[] = [ - {literal: 'aux aurores'}, - {literal: 'au petit dej'}, - {literal: 'au deuxième petit dej des hobbits'} + { literal: 'aux aurores' }, + { literal: 'au petit dej' }, + { literal: 'au deuxième petit dej des hobbits' }, ]; export const defaultTimeOfDay: TimeSlices[] = (() => { - return [...basicSlicesOfDay] + return [...basicSlicesOfDay]; })(); export const otherTimeOfDay: TimeSlices[] = (() => { - return [...otherSlicesOfDay] + return [...otherSlicesOfDay]; })(); export const moreTimeOfDay: TimeSlices[] = (() => { - return [...otherSlicesOfDay] + return [...otherSlicesOfDay]; })(); export const defaultDates: DateChoice[] = [ { literal: `${currentYear}-${currentMonth}-${currentDay}`, date_object: new Date(), - timeList: defaultTimeOfDay + timeList: defaultTimeOfDay, }, { literal: `${currentYear}-${currentMonth}-${currentDay + 1}`, date_object: new Date(), - timeList: defaultTimeOfDay + timeList: defaultTimeOfDay, }, { literal: `${currentYear}-${currentMonth}-${currentDay + 2}`, date_object: new Date(), - timeList: defaultTimeOfDay - } + timeList: defaultTimeOfDay, + }, ]; export const otherDefaultDates: DateChoice[] = [ { literal: `${currentYear}-${currentMonth}-${currentDay}`, date_object: new Date(), - timeList: defaultTimeOfDay + timeList: defaultTimeOfDay, }, { literal: `${currentYear}-${currentMonth}-${currentDay + 1}`, date_object: new Date(currentYear, currentMonth, currentDay + 1), - timeList: otherTimeOfDay + timeList: otherTimeOfDay, }, { literal: `${currentYear}-${currentMonth}-${currentDay + 2}`, date_object: new Date(), - timeList: moreTimeOfDay - } + timeList: moreTimeOfDay, + }, ]; -export const defaultAnswers: PollAnswer[] = [{ - id: 0, - text: 'réponse de démo 1', - file: '', - url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', - literal: `${currentYear}-${currentMonth}-${currentDay}`, - date_object: new Date(), - timeList: otherSlicesOfDay -}, +export const defaultAnswers: PollAnswer[] = [ + { + id: 0, + text: 'réponse de démo 1', + file: '', + url: + 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', + literal: `${currentYear}-${currentMonth}-${currentDay}`, + date_object: new Date(), + timeList: otherSlicesOfDay, + }, { id: 1, text: 'réponse 2', file: '', - url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', + url: + 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', literal: `${currentYear}-${currentMonth}-${currentDay + 1}`, date_object: new Date(), - timeList: basicSlicesOfDay + timeList: basicSlicesOfDay, }, { id: 2, text: 'la réponse D', file: '', - url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', + url: + 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', literal: `${currentYear}-${currentMonth}-${currentDay + 2}`, date_object: new Date(), - timeList: otherSlicesOfDay - }]; + timeList: otherSlicesOfDay, + }, +]; diff --git a/src/app/config/graph-canevas-options.ts b/src/app/config/graph-canevas-options.ts index 3297b6c4..e620ec56 100644 --- a/src/app/config/graph-canevas-options.ts +++ b/src/app/config/graph-canevas-options.ts @@ -1,24 +1,24 @@ export var graphOptions = { - legend: {display: false}, + legend: { display: false }, scales: { xAxes: [ { - gridLines: {drawBorder: false, display: false}, + gridLines: { drawBorder: false, display: false }, display: false, stacked: true, ticks: { beginAtZero: true, maxRotation: 0, - minRotation: 0 - } - } + minRotation: 0, + }, + }, ], yAxes: [ { - gridLines: {drawBorder: true, display: false}, + gridLines: { drawBorder: true, display: false }, display: true, - stacked: true - } - ] - } + stacked: true, + }, + ], + }, }; diff --git a/src/app/config/mocks/choice.ts b/src/app/config/mocks/choice.ts index 0b913838..07518e06 100644 --- a/src/app/config/mocks/choice.ts +++ b/src/app/config/mocks/choice.ts @@ -1,11 +1,11 @@ -export const mockChoice = { - "id": 11, - "date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" +export const mockChoice = { + id: 11, + date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "text": "Les mondes engloutis", - "url": null, - "answer": null, + text: 'Les mondes engloutis', + url: null, + answer: null, }; diff --git a/src/app/config/mocks/mock-comments.ts b/src/app/config/mocks/mock-comments.ts index ba82f8fd..1d7d1edc 100644 --- a/src/app/config/mocks/mock-comments.ts +++ b/src/app/config/mocks/mock-comments.ts @@ -1,20 +1,21 @@ export const mockComments = [ { - pseudo: "Bulbizarre", - "date": { - "date": "2020-01-22 16:00:22.000000", - "timezone_type": 3, - "timezone": "Europe/Paris" + pseudo: 'Bulbizarre', + date: { + date: '2020-01-22 16:00:22.000000', + timezone_type: 3, + timezone: 'Europe/Paris', }, - 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", + 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', }, { - pseudo: "Marylin", - "date": { - "date": "2020-01-22 16:00:22.000000", - "timezone_type": 3, - "timezone": "Europe/Paris" + pseudo: 'Marylin', + date: { + date: '2020-01-22 16:00:22.000000', + timezone_type: 3, + timezone: 'Europe/Paris', }, text: "j'ai vu de la lumière o_o", }, diff --git a/src/app/config/mocks/mock-graph.ts b/src/app/config/mocks/mock-graph.ts index 8eb6ad04..ec870c6b 100644 --- a/src/app/config/mocks/mock-graph.ts +++ b/src/app/config/mocks/mock-graph.ts @@ -1,52 +1,52 @@ export const mockGraphConfig = { step: 0, stepMax: 3, - pollType: "special dates", - title: "", - description: "", - myName: "", - visibility: "link_only", + pollType: 'special dates', + title: '', + description: '', + myName: '', + visibility: 'link_only', // date specific poll - allowSeveralHours: "true", - dateLgfgfgfgist: ["jeudi", "vendredi", "samedi"], // sets of days as strings - timeList: ["08:00", "08:30", "09:00"], // ranges of time expressed as strings + allowSeveralHours: 'true', + dateLgfgfgfgist: ['jeudi', 'vendredi', 'samedi'], // sets of days as strings + timeList: ['08:00', '08:30', '09:00'], // ranges of time expressed as strings answers: [ { id: 0, - text: "no" + text: 'no', }, { id: 1, - text: "yes" + text: 'yes', }, { id: 2, - text: "maybe" + text: 'maybe', }, { id: 3, - text: "maybe" + text: 'maybe', }, { id: 4, - text: "maybe" + text: 'maybe', }, { id: 5, - text: "maybe" + text: 'maybe', }, { id: 6, - text: "maybe" + text: 'maybe', }, { id: 7, - text: "maybe" + text: 'maybe', }, { id: 8, - text: "maybe" - } - ] + text: 'maybe', + }, + ], }; diff --git a/src/app/config/mocks/mock-poll3.ts b/src/app/config/mocks/mock-poll3.ts index 13510bdc..d6272594 100644 --- a/src/app/config/mocks/mock-poll3.ts +++ b/src/app/config/mocks/mock-poll3.ts @@ -1,569 +1,529 @@ export const mockPoll3 = { - "message": "your poll config", - "poll": { - "id": 4, - "title": "dessin animé préféré", - "customUrl": null, - "description": "choisissez votre animé préféré", - "creationDate": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + message: 'your poll config', + poll: { + id: 4, + title: 'dessin animé préféré', + customUrl: null, + description: 'choisissez votre animé préféré', + creationDate: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "expiracyDate": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + expiracyDate: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "owner": { - "__initializer__": null, - "__cloner__": null, - "__isInitialized__": true, - "pseudo": "tk_TEST", - "email": "tktest@tktest.com" + owner: { + __initializer__: null, + __cloner__: null, + __isInitialized__: true, + pseudo: 'tk_TEST', + email: 'tktest@tktest.com', }, - "kind": "text", - "allowedAnswers": [ + kind: 'text', + allowedAnswers: [ // "yes", "maybe", "no" - "yes", + 'yes', ], - "modificationPolicy": "everybody", - "mailOnComment": null, - "mailOnVote": null, - "hideResults": null, - "showResultEvenIfPasswords": null, - "votes": {}, - "stacksOfVotes": {}, - "choices": {}, - "choices_count": { - "counts": { - "10": { - "choice_id": 10, - "choice_text": "Les mystérieuses cités d'or", - "id": 4, - "score": 2.5, - "yes": { - "count": 2, - "people": [ - "voting_people_TEST", - "voting_people_TEST" - ] + modificationPolicy: 'everybody', + mailOnComment: null, + mailOnVote: null, + hideResults: null, + showResultEvenIfPasswords: null, + votes: {}, + stacksOfVotes: {}, + choices: {}, + choices_count: { + counts: { + '10': { + choice_id: 10, + choice_text: "Les mystérieuses cités d'or", + id: 4, + score: 2.5, + yes: { + count: 2, + people: ['voting_people_TEST', 'voting_people_TEST'], }, - "maybe": { - "count": 1, - "people": [ - "Nikolas Edison" - ] + maybe: { + count: 1, + people: ['Nikolas Edison'], + }, + no: { + count: 1, + people: ['voting_people_TEST'], }, - "no": { - "count": 1, - "people": [ - "voting_people_TEST" - ] - } }, - "9": { - "choice_id": 9, - "choice_text": "Boumbo petite automobile", - "id": 5, - "score": 2.5, - "yes": { - "count": 2, - "people": [ - "voting_people_TEST", - "Billie Jean" - ] + '9': { + choice_id: 9, + choice_text: 'Boumbo petite automobile', + id: 5, + score: 2.5, + yes: { + count: 2, + people: ['voting_people_TEST', 'Billie Jean'], }, - "maybe": { - "count": 1, - "people": [ - "voting_people_TEST" - ] + maybe: { + count: 1, + people: ['voting_people_TEST'], + }, + no: { + count: 0, + people: [], }, - "no": { - "count": 0, - "people": [] - } }, - "12": { - "choice_id": 12, - "choice_text": "Foot 2 rue", - "id": 14, - "score": 0.5, - "yes": { - "count": 0, - "people": [] + '12': { + choice_id: 12, + choice_text: 'Foot 2 rue', + id: 14, + score: 0.5, + yes: { + count: 0, + people: [], }, - "maybe": { - "count": 1, - "people": [ - "Nikolas Edison" - ] + maybe: { + count: 1, + people: ['Nikolas Edison'], + }, + no: { + count: 0, + people: [], }, - "no": { - "count": 0, - "people": [] - } }, - "11": { - "choice_id": 11, - "choice_text": "Les mondes engloutis", - "id": 15, - "score": 1.5, - "yes": { - "count": 1, - "people": [ - "Billie Jean" - ] + '11': { + choice_id: 11, + choice_text: 'Les mondes engloutis', + id: 15, + score: 1.5, + yes: { + count: 1, + people: ['Billie Jean'], }, - "maybe": { - "count": 1, - "people": [ - "Wulfila" - ] + maybe: { + count: 1, + people: ['Wulfila'], + }, + no: { + count: 0, + people: [], }, - "no": { - "count": 0, - "people": [] - } }, - "13": { - "choice_id": 13, - "choice_text": "Le chat, la vache, et l'océan", - "id": 16, - "score": 1, - "yes": { - "count": 1, - "people": [ - "Wulfila" - ] + '13': { + choice_id: 13, + choice_text: "Le chat, la vache, et l'océan", + id: 16, + score: 1, + yes: { + count: 1, + people: ['Wulfila'], }, - "maybe": { - "count": 0, - "people": [] + maybe: { + count: 0, + people: [], }, - "no": { - "count": 0, - "people": [] - } - } + no: { + count: 0, + people: [], + }, + }, }, - "maxScore": 2.5 + maxScore: 2.5, }, - "comments": {}, - "defaultExpiracyDaysFromNow": 60 + comments: {}, + defaultExpiracyDaysFromNow: 60, }, - "stacks_count": 5, - "stacks": [ + stacks_count: 5, + stacks: [ { - "id": 3, - "pseudo": "voting_people_TEST", - "creation_date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + id: 3, + pseudo: 'voting_people_TEST', + creation_date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "votes": { - "8": { - "choice_id": 8 + votes: { + '8': { + choice_id: 8, }, - "9": { - "id": 3, - "vote_id": 5, - "value": "maybe", - "choice_id": 9, - "text": "Boumbo petite automobile" + '9': { + id: 3, + vote_id: 5, + value: 'maybe', + choice_id: 9, + text: 'Boumbo petite automobile', }, - "10": { - "id": 3, - "vote_id": 4, - "value": "yes", - "choice_id": 10, - "text": "Les mystérieuses cités d'or" + '10': { + id: 3, + vote_id: 4, + value: 'yes', + choice_id: 10, + text: "Les mystérieuses cités d'or", }, - "11": { - "choice_id": 11 + '11': { + choice_id: 11, }, - "12": { - "choice_id": 12 + '12': { + choice_id: 12, }, - "13": { - "choice_id": 13 + '13': { + choice_id: 13, }, - "14": { - "choice_id": 14 - } - } + '14': { + choice_id: 14, + }, + }, }, { - "id": 4, - "pseudo": "voting_people_TEST", - "creation_date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + id: 4, + pseudo: 'voting_people_TEST', + creation_date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "votes": { - "8": { - "choice_id": 8 + votes: { + '8': { + choice_id: 8, }, - "9": { - "id": 4, - "vote_id": 6, - "value": "yes", - "choice_id": 9, - "text": "Boumbo petite automobile" + '9': { + id: 4, + vote_id: 6, + value: 'yes', + choice_id: 9, + text: 'Boumbo petite automobile', }, - "10": { - "id": 4, - "vote_id": 8, - "value": "no", - "choice_id": 10, - "text": "Les mystérieuses cités d'or" + '10': { + id: 4, + vote_id: 8, + value: 'no', + choice_id: 10, + text: "Les mystérieuses cités d'or", }, - "11": { - "choice_id": 11 + '11': { + choice_id: 11, }, - "12": { - "choice_id": 12 + '12': { + choice_id: 12, }, - "13": { - "choice_id": 13 + '13': { + choice_id: 13, }, - "14": { - "choice_id": 14 - } - } + '14': { + choice_id: 14, + }, + }, }, { - "id": 7, - "pseudo": "Nikolas Edison", - "creation_date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + id: 7, + pseudo: 'Nikolas Edison', + creation_date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "votes": { - "8": { - "choice_id": 8 + votes: { + '8': { + choice_id: 8, }, - "9": { - "choice_id": 9 + '9': { + choice_id: 9, }, - "10": { - "id": 7, - "vote_id": 13, - "value": "maybe", - "choice_id": 10, - "text": "Les mystérieuses cités d'or" + '10': { + id: 7, + vote_id: 13, + value: 'maybe', + choice_id: 10, + text: "Les mystérieuses cités d'or", }, - "11": { - "choice_id": 11 + '11': { + choice_id: 11, }, - "12": { - "id": 7, - "vote_id": 14, - "value": "maybe", - "choice_id": 12, - "text": "Foot 2 rue" + '12': { + id: 7, + vote_id: 14, + value: 'maybe', + choice_id: 12, + text: 'Foot 2 rue', }, - "13": { - "choice_id": 13 + '13': { + choice_id: 13, }, - "14": { - "choice_id": 14 - } - } + '14': { + choice_id: 14, + }, + }, }, { - "id": 8, - "pseudo": "Wulfila", - "creation_date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + id: 8, + pseudo: 'Wulfila', + creation_date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "votes": { - "8": { - "choice_id": 8 + votes: { + '8': { + choice_id: 8, }, - "9": { - "choice_id": 9 + '9': { + choice_id: 9, }, - "10": { - "choice_id": 10 + '10': { + choice_id: 10, }, - "11": { - "id": 8, - "vote_id": 15, - "value": "maybe", - "choice_id": 11, - "text": "Les mondes engloutis" + '11': { + id: 8, + vote_id: 15, + value: 'maybe', + choice_id: 11, + text: 'Les mondes engloutis', }, - "12": { - "choice_id": 12 + '12': { + choice_id: 12, }, - "13": { - "id": 8, - "vote_id": 16, - "value": "yes", - "choice_id": 13, - "text": "Le chat, la vache, et l'océan" + '13': { + id: 8, + vote_id: 16, + value: 'yes', + choice_id: 13, + text: "Le chat, la vache, et l'océan", }, - "14": { - "choice_id": 14 - } - } + '14': { + choice_id: 14, + }, + }, }, { - "id": 9, - "pseudo": "Billie Jean", - "creation_date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + id: 9, + pseudo: 'Billie Jean', + creation_date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "votes": { - "8": { - "choice_id": 8 + votes: { + '8': { + choice_id: 8, }, - "9": { - "id": 9, - "vote_id": 17, - "value": "yes", - "choice_id": 9, - "text": "Boumbo petite automobile" + '9': { + id: 9, + vote_id: 17, + value: 'yes', + choice_id: 9, + text: 'Boumbo petite automobile', }, - "10": { - "choice_id": 10 + '10': { + choice_id: 10, }, - "11": { - "id": 9, - "vote_id": 18, - "value": "yes", - "choice_id": 11, - "text": "Les mondes engloutis" + '11': { + id: 9, + vote_id: 18, + value: 'yes', + choice_id: 11, + text: 'Les mondes engloutis', }, - "12": { - "choice_id": 12 + '12': { + choice_id: 12, }, - "13": { - "choice_id": 13 + '13': { + choice_id: 13, }, - "14": { - "choice_id": 14 - } - } - } + '14': { + choice_id: 14, + }, + }, + }, ], - "choices_count": { - "counts": { - "10": { - "choice_id": 10, - "choice_text": "Les mystérieuses cités d'or", - "id": 4, - "score": 2.5, - "yes": { - "count": 2, - "people": [ - "voting_people_TEST", - "voting_people_TEST" - ] + choices_count: { + counts: { + '10': { + choice_id: 10, + choice_text: "Les mystérieuses cités d'or", + id: 4, + score: 2.5, + yes: { + count: 2, + people: ['voting_people_TEST', 'voting_people_TEST'], }, - "maybe": { - "count": 1, - "people": [ - "Nikolas Edison" - ] + maybe: { + count: 1, + people: ['Nikolas Edison'], + }, + no: { + count: 1, + people: ['voting_people_TEST'], }, - "no": { - "count": 1, - "people": [ - "voting_people_TEST" - ] - } }, - "9": { - "choice_id": 9, - "choice_text": "Boumbo petite automobile", - "id": 5, - "score": 2.5, - "yes": { - "count": 2, - "people": [ - "voting_people_TEST", - "Billie Jean" - ] + '9': { + choice_id: 9, + choice_text: 'Boumbo petite automobile', + id: 5, + score: 2.5, + yes: { + count: 2, + people: ['voting_people_TEST', 'Billie Jean'], }, - "maybe": { - "count": 1, - "people": [ - "voting_people_TEST" - ] + maybe: { + count: 1, + people: ['voting_people_TEST'], + }, + no: { + count: 0, + people: [], }, - "no": { - "count": 0, - "people": [] - } }, - "12": { - "choice_id": 12, - "choice_text": "Foot 2 rue", - "id": 14, - "score": 0.5, - "yes": { - "count": 0, - "people": [] + '12': { + choice_id: 12, + choice_text: 'Foot 2 rue', + id: 14, + score: 0.5, + yes: { + count: 0, + people: [], }, - "maybe": { - "count": 1, - "people": [ - "Nikolas Edison" - ] + maybe: { + count: 1, + people: ['Nikolas Edison'], + }, + no: { + count: 0, + people: [], }, - "no": { - "count": 0, - "people": [] - } }, - "11": { - "choice_id": 11, - "choice_text": "Les mondes engloutis", - "id": 15, - "score": 1.5, - "yes": { - "count": 1, - "people": [ - "Billie Jean" - ] + '11': { + choice_id: 11, + choice_text: 'Les mondes engloutis', + id: 15, + score: 1.5, + yes: { + count: 1, + people: ['Billie Jean'], }, - "maybe": { - "count": 1, - "people": [ - "Wulfila" - ] + maybe: { + count: 1, + people: ['Wulfila'], + }, + no: { + count: 0, + people: [], }, - "no": { - "count": 0, - "people": [] - } }, - "13": { - "choice_id": 13, - "choice_text": "Le chat, la vache, et l'océan", - "id": 16, - "score": 1, - "yes": { - "count": 1, - "people": [ - "Wulfila" - ] + '13': { + choice_id: 13, + choice_text: "Le chat, la vache, et l'océan", + id: 16, + score: 1, + yes: { + count: 1, + people: ['Wulfila'], }, - "maybe": { - "count": 0, - "people": [] + maybe: { + count: 0, + people: [], }, - "no": { - "count": 0, - "people": [] - } - } + no: { + count: 0, + people: [], + }, + }, }, - "maxScore": 2.5 + maxScore: 2.5, }, - "choices": [ + choices: [ { - "id": 8, - "date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + id: 8, + date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "text": "Vic le viking", - "url": null + text: 'Vic le viking', + url: null, }, { - "id": 9, - "date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + id: 9, + date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "text": "Boumbo petite automobile", - "url": null + text: 'Boumbo petite automobile', + url: null, }, { - "id": 10, - "date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + id: 10, + date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "text": "Les mystérieuses cités d'or", - "url": null + text: "Les mystérieuses cités d'or", + url: null, }, { - "id": 11, - "date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + id: 11, + date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "text": "Les mondes engloutis", - "url": null + text: 'Les mondes engloutis', + url: null, }, { - "id": 12, - "date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + id: 12, + date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "text": "Foot 2 rue", - "url": null + text: 'Foot 2 rue', + url: null, }, { - "id": 13, - "date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + id: 13, + date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "text": "Le chat, la vache, et l'océan", - "url": null + text: "Le chat, la vache, et l'océan", + url: null, }, { - "id": 14, - "date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + id: 14, + date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "text": "Digimon", - "url": null - } + text: 'Digimon', + url: null, + }, ], - "comments": [ + comments: [ { - "id": 3, - "text": "allez boumbo!", - "pseudo": "tk_TEST_commentateur", - "date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - } + id: 3, + text: 'allez boumbo!', + pseudo: 'tk_TEST_commentateur', + date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, }, { - "id": 4, - "text": "je suis pour la team rocket de digimon", - "pseudo": "tk_TEST", - "date": { - "date": "2020-01-30 12:25:13.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - } - } + id: 4, + text: 'je suis pour la team rocket de digimon', + pseudo: 'tk_TEST', + date: { + date: '2020-01-30 12:25:13.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + }, ], - "comments_count": 2 + comments_count: 2, }; diff --git a/src/app/config/mocks/mock-success-vote.ts b/src/app/config/mocks/mock-success-vote.ts index 9971ccab..6491af69 100644 --- a/src/app/config/mocks/mock-success-vote.ts +++ b/src/app/config/mocks/mock-success-vote.ts @@ -1,684 +1,658 @@ export const mockSuccessVote = { - "message": "you created a vote stack from an existing owner : tktest@tktest.com", - "poll": { - "id": 4, - "title": "dessin animé préféré", - "customUrl": null, - "description": "choisissez votre animé préféré", - "creationDate": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + message: 'you created a vote stack from an existing owner : tktest@tktest.com', + poll: { + id: 4, + title: 'dessin animé préféré', + customUrl: null, + description: 'choisissez votre animé préféré', + creationDate: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "expiracyDate": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" + expiracyDate: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', }, - "owner": { - "__initializer__": null, - "__cloner__": null, - "__isInitialized__": true, - "pseudo": "tk_TEST", - "email": "tktest@tktest.com" + owner: { + __initializer__: null, + __cloner__: null, + __isInitialized__: true, + pseudo: 'tk_TEST', + email: 'tktest@tktest.com', }, - "kind": "text", - "allowedAnswers": [ - "yes" + kind: 'text', + allowedAnswers: ['yes'], + modificationPolicy: 'everybody', + mailOnComment: null, + mailOnVote: null, + hideResults: null, + showResultEvenIfPasswords: null, + votes: {}, + stacksOfVotes: {}, + choices: {}, + comments: {}, + defaultExpiracyDaysFromNow: 60, + }, + vote_stack: { + id: 10, + modifier_token: + 'V46C6b58c456B39kTI19KSfp1y8Zz7Wyg500xMdjNB823st221Gb509VX1AOsnhV93fhol1f8P30OblKFoI76u54T94rH92x5c95TdW1W2eH0hb55q8', + pseudo: 'tk_TEST', + creation_date: { + date: '2020-02-04 12:36:07.530846', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + votes: { + '8': { + id: 22, + value: 'yes', + choice_id: 8, + text: 'Vic le viking', + stack_id: 10, + }, + '9': { + choice_id: 9, + }, + '10': { + choice_id: 10, + }, + '11': { + choice_id: 11, + }, + '12': { + choice_id: 12, + }, + '13': { + choice_id: 13, + }, + '14': { + choice_id: 14, + }, + '5': { + id: 19, + value: 'yes', + choice_id: 5, + text: '2020-02-04 12:35:37', + stack_id: 10, + }, + '6': { + id: 20, + value: 'yes', + choice_id: 6, + text: '2020-02-04 12:35:37', + stack_id: 10, + }, + '7': { + id: 21, + value: 'yes', + choice_id: 7, + text: '2020-02-04 12:35:37', + stack_id: 10, + }, + }, + }, + stacks: [ + { + id: 3, + modifier_token: '5e39570956e5d', + pseudo: 'voting_people_TEST', + creation_date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + votes: { + '8': { + choice_id: 8, + }, + '9': { + id: 5, + value: 'maybe', + choice_id: 9, + text: 'Boumbo petite automobile', + stack_id: 3, + }, + '10': { + id: 4, + value: 'yes', + choice_id: 10, + text: "Les mystérieuses cités d'or", + stack_id: 3, + }, + '11': { + choice_id: 11, + }, + '12': { + choice_id: 12, + }, + '13': { + choice_id: 13, + }, + '14': { + choice_id: 14, + }, + }, + }, + { + id: 4, + modifier_token: '5e39570956e5d', + pseudo: 'voting_people_TEST', + creation_date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + votes: { + '8': { + choice_id: 8, + }, + '9': { + id: 6, + value: 'yes', + choice_id: 9, + text: 'Boumbo petite automobile', + stack_id: 4, + }, + '10': { + id: 8, + value: 'no', + choice_id: 10, + text: "Les mystérieuses cités d'or", + stack_id: 4, + }, + '11': { + choice_id: 11, + }, + '12': { + choice_id: 12, + }, + '13': { + choice_id: 13, + }, + '14': { + choice_id: 14, + }, + }, + }, + { + id: 7, + modifier_token: '5e3957095ca23', + pseudo: 'Nikolas Edison', + creation_date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + votes: { + '8': { + choice_id: 8, + }, + '9': { + choice_id: 9, + }, + '10': { + id: 13, + value: 'maybe', + choice_id: 10, + text: "Les mystérieuses cités d'or", + stack_id: 7, + }, + '11': { + choice_id: 11, + }, + '12': { + id: 14, + value: 'maybe', + choice_id: 12, + text: 'Foot 2 rue', + stack_id: 7, + }, + '13': { + choice_id: 13, + }, + '14': { + choice_id: 14, + }, + }, + }, + { + id: 8, + modifier_token: '5e3957095ca2d', + pseudo: 'Wulfila', + creation_date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + votes: { + '8': { + choice_id: 8, + }, + '9': { + choice_id: 9, + }, + '10': { + choice_id: 10, + }, + '11': { + id: 15, + value: 'maybe', + choice_id: 11, + text: 'Les mondes engloutis', + stack_id: 8, + }, + '12': { + choice_id: 12, + }, + '13': { + id: 16, + value: 'yes', + choice_id: 13, + text: "Le chat, la vache, et l'océan", + stack_id: 8, + }, + '14': { + choice_id: 14, + }, + }, + }, + { + id: 9, + modifier_token: '5e3957095ca34', + pseudo: 'Billie Jean', + creation_date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + votes: { + '8': { + choice_id: 8, + }, + '9': { + id: 17, + value: 'yes', + choice_id: 9, + text: 'Boumbo petite automobile', + stack_id: 9, + }, + '10': { + choice_id: 10, + }, + '11': { + id: 18, + value: 'yes', + choice_id: 11, + text: 'Les mondes engloutis', + stack_id: 9, + }, + '12': { + choice_id: 12, + }, + '13': { + choice_id: 13, + }, + '14': { + choice_id: 14, + }, + }, + }, + { + id: 10, + modifier_token: + 'V46C6b58c456B39kTI19KSfp1y8Zz7Wyg500xMdjNB823st221Gb509VX1AOsnhV93fhol1f8P30OblKFoI76u54T94rH92x5c95TdW1W2eH0hb55q8', + pseudo: 'tk_TEST', + creation_date: { + date: '2020-02-04 12:36:07.530846', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + votes: { + '8': { + id: 22, + value: 'yes', + choice_id: 8, + text: 'Vic le viking', + stack_id: 10, + }, + '9': { + choice_id: 9, + }, + '10': { + choice_id: 10, + }, + '11': { + choice_id: 11, + }, + '12': { + choice_id: 12, + }, + '13': { + choice_id: 13, + }, + '14': { + choice_id: 14, + }, + '5': { + id: 19, + value: 'yes', + choice_id: 5, + text: '2020-02-04 12:35:37', + stack_id: 10, + }, + '6': { + id: 20, + value: 'yes', + choice_id: 6, + text: '2020-02-04 12:35:37', + stack_id: 10, + }, + '7': { + id: 21, + value: 'yes', + choice_id: 7, + text: '2020-02-04 12:35:37', + stack_id: 10, + }, + }, + }, + ], + comments: [ + { + id: 3, + text: 'allez boumbo!', + pseudo: 'tk_TEST_commentateur', + date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + }, + { + id: 4, + text: 'je suis pour la team rocket de digimon', + pseudo: 'tk_TEST', + date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + }, + ], + choices: [ + { + id: 8, + date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + text: 'Vic le viking', + url: null, + }, + { + id: 9, + date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + text: 'Boumbo petite automobile', + url: null, + }, + { + id: 10, + date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + text: "Les mystérieuses cités d'or", + url: null, + }, + { + id: 11, + date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + text: 'Les mondes engloutis', + url: null, + }, + { + id: 12, + date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + text: 'Foot 2 rue', + url: null, + }, + { + id: 13, + date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + text: "Le chat, la vache, et l'océan", + url: null, + }, + { + id: 14, + date: { + date: '2020-02-04 12:35:37.000000', + timezone_type: 3, + timezone: 'Europe/Berlin', + }, + text: 'Digimon', + url: null, + }, + ], + choices_count: { + counts: { + '10': { + choice_id: 10, + choice_text: "Les mystérieuses cités d'or", + id: 4, + score: 2.5, + yes: { + count: 2, + people: ['voting_people_TEST', 'voting_people_TEST'], + }, + maybe: { + count: 1, + people: ['Nikolas Edison'], + }, + no: { + count: 1, + people: ['voting_people_TEST'], + }, + }, + '9': { + choice_id: 9, + choice_text: 'Boumbo petite automobile', + id: 5, + score: 2.5, + yes: { + count: 2, + people: ['voting_people_TEST', 'Billie Jean'], + }, + maybe: { + count: 1, + people: ['voting_people_TEST'], + }, + no: { + count: 0, + people: [], + }, + }, + '12': { + choice_id: 12, + choice_text: 'Foot 2 rue', + id: 14, + score: 0.5, + yes: { + count: 0, + people: [], + }, + maybe: { + count: 1, + people: ['Nikolas Edison'], + }, + no: { + count: 0, + people: [], + }, + }, + '11': { + choice_id: 11, + choice_text: 'Les mondes engloutis', + id: 15, + score: 1.5, + yes: { + count: 1, + people: ['Billie Jean'], + }, + maybe: { + count: 1, + people: ['Wulfila'], + }, + no: { + count: 0, + people: [], + }, + }, + '13': { + choice_id: 13, + choice_text: "Le chat, la vache, et l'océan", + id: 16, + score: 1, + yes: { + count: 1, + people: ['Wulfila'], + }, + maybe: { + count: 0, + people: [], + }, + no: { + count: 0, + people: [], + }, + }, + '5': { + choice_id: 5, + choice_text: '2020-02-04 12:35:37', + id: 19, + score: 1, + yes: { + count: 1, + people: ['tk_TEST'], + }, + maybe: { + count: 0, + people: [], + }, + no: { + count: 0, + people: [], + }, + }, + '6': { + choice_id: 6, + choice_text: '2020-02-04 12:35:37', + id: 20, + score: 1, + yes: { + count: 1, + people: ['tk_TEST'], + }, + maybe: { + count: 0, + people: [], + }, + no: { + count: 0, + people: [], + }, + }, + '7': { + choice_id: 7, + choice_text: '2020-02-04 12:35:37', + id: 21, + score: 1, + yes: { + count: 1, + people: ['tk_TEST'], + }, + maybe: { + count: 0, + people: [], + }, + no: { + count: 0, + people: [], + }, + }, + '8': { + choice_id: 8, + choice_text: 'Vic le viking', + id: 22, + score: 1, + yes: { + count: 1, + people: ['tk_TEST'], + }, + maybe: { + count: 0, + people: [], + }, + no: { + count: 0, + people: [], + }, + }, + }, + maxScore: 2.5, + }, + vote_count: 6, + owner: { + __initializer__: null, + __cloner__: null, + __isInitialized__: true, + pseudo: 'tk_TEST', + email: 'tktest@tktest.com', + }, + owner_modifier_token: + 'V46C6b58c456B39kTI19KSfp1y8Zz7Wyg500xMdjNB823st221Gb509VX1AOsnhV93fhol1f8P30OblKFoI76u54T94rH92x5c95TdW1W2eH0hb55q8', + admin_key: + '9uE27daM8dG1P9z74B89z299W0JF0ne15eER37g2v3d86mk123318v516UUbey4z3C87Wbo65V3c7cHsBTELvhl8b82d61WBMR2U66USNc7idS8810f', + json_you_sent: { + pseudo: 'mon pseudo', + email: 'tktest@tktest.com', + votes: [ + { + choice_id: 5, + value: 'yes', + }, + { + choice_id: 6, + value: 'yes', + }, + { + choice_id: 7, + value: 'yes', + }, + { + choice_id: 8, + value: 'yes', + }, ], - "modificationPolicy": "everybody", - "mailOnComment": null, - "mailOnVote": null, - "hideResults": null, - "showResultEvenIfPasswords": null, - "votes": {}, - "stacksOfVotes": {}, - "choices": {}, - "comments": {}, - "defaultExpiracyDaysFromNow": 60 }, - "vote_stack": { - "id": 10, - "modifier_token": "V46C6b58c456B39kTI19KSfp1y8Zz7Wyg500xMdjNB823st221Gb509VX1AOsnhV93fhol1f8P30OblKFoI76u54T94rH92x5c95TdW1W2eH0hb55q8", - "pseudo": "tk_TEST", - "creation_date": { - "date": "2020-02-04 12:36:07.530846", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "votes": { - "8": { - "id": 22, - "value": "yes", - "choice_id": 8, - "text": "Vic le viking", - "stack_id": 10 - }, - "9": { - "choice_id": 9 - }, - "10": { - "choice_id": 10 - }, - "11": { - "choice_id": 11 - }, - "12": { - "choice_id": 12 - }, - "13": { - "choice_id": 13 - }, - "14": { - "choice_id": 14 - }, - "5": { - "id": 19, - "value": "yes", - "choice_id": 5, - "text": "2020-02-04 12:35:37", - "stack_id": 10 - }, - "6": { - "id": 20, - "value": "yes", - "choice_id": 6, - "text": "2020-02-04 12:35:37", - "stack_id": 10 - }, - "7": { - "id": 21, - "value": "yes", - "choice_id": 7, - "text": "2020-02-04 12:35:37", - "stack_id": 10 - } - } - }, - "stacks": [ - { - "id": 3, - "modifier_token": "5e39570956e5d", - "pseudo": "voting_people_TEST", - "creation_date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "votes": { - "8": { - "choice_id": 8 - }, - "9": { - "id": 5, - "value": "maybe", - "choice_id": 9, - "text": "Boumbo petite automobile", - "stack_id": 3 - }, - "10": { - "id": 4, - "value": "yes", - "choice_id": 10, - "text": "Les mystérieuses cités d'or", - "stack_id": 3 - }, - "11": { - "choice_id": 11 - }, - "12": { - "choice_id": 12 - }, - "13": { - "choice_id": 13 - }, - "14": { - "choice_id": 14 - } - } - }, - { - "id": 4, - "modifier_token": "5e39570956e5d", - "pseudo": "voting_people_TEST", - "creation_date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "votes": { - "8": { - "choice_id": 8 - }, - "9": { - "id": 6, - "value": "yes", - "choice_id": 9, - "text": "Boumbo petite automobile", - "stack_id": 4 - }, - "10": { - "id": 8, - "value": "no", - "choice_id": 10, - "text": "Les mystérieuses cités d'or", - "stack_id": 4 - }, - "11": { - "choice_id": 11 - }, - "12": { - "choice_id": 12 - }, - "13": { - "choice_id": 13 - }, - "14": { - "choice_id": 14 - } - } - }, - { - "id": 7, - "modifier_token": "5e3957095ca23", - "pseudo": "Nikolas Edison", - "creation_date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "votes": { - "8": { - "choice_id": 8 - }, - "9": { - "choice_id": 9 - }, - "10": { - "id": 13, - "value": "maybe", - "choice_id": 10, - "text": "Les mystérieuses cités d'or", - "stack_id": 7 - }, - "11": { - "choice_id": 11 - }, - "12": { - "id": 14, - "value": "maybe", - "choice_id": 12, - "text": "Foot 2 rue", - "stack_id": 7 - }, - "13": { - "choice_id": 13 - }, - "14": { - "choice_id": 14 - } - } - }, - { - "id": 8, - "modifier_token": "5e3957095ca2d", - "pseudo": "Wulfila", - "creation_date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "votes": { - "8": { - "choice_id": 8 - }, - "9": { - "choice_id": 9 - }, - "10": { - "choice_id": 10 - }, - "11": { - "id": 15, - "value": "maybe", - "choice_id": 11, - "text": "Les mondes engloutis", - "stack_id": 8 - }, - "12": { - "choice_id": 12 - }, - "13": { - "id": 16, - "value": "yes", - "choice_id": 13, - "text": "Le chat, la vache, et l'océan", - "stack_id": 8 - }, - "14": { - "choice_id": 14 - } - } - }, - { - "id": 9, - "modifier_token": "5e3957095ca34", - "pseudo": "Billie Jean", - "creation_date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "votes": { - "8": { - "choice_id": 8 - }, - "9": { - "id": 17, - "value": "yes", - "choice_id": 9, - "text": "Boumbo petite automobile", - "stack_id": 9 - }, - "10": { - "choice_id": 10 - }, - "11": { - "id": 18, - "value": "yes", - "choice_id": 11, - "text": "Les mondes engloutis", - "stack_id": 9 - }, - "12": { - "choice_id": 12 - }, - "13": { - "choice_id": 13 - }, - "14": { - "choice_id": 14 - } - } - }, - { - "id": 10, - "modifier_token": "V46C6b58c456B39kTI19KSfp1y8Zz7Wyg500xMdjNB823st221Gb509VX1AOsnhV93fhol1f8P30OblKFoI76u54T94rH92x5c95TdW1W2eH0hb55q8", - "pseudo": "tk_TEST", - "creation_date": { - "date": "2020-02-04 12:36:07.530846", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "votes": { - "8": { - "id": 22, - "value": "yes", - "choice_id": 8, - "text": "Vic le viking", - "stack_id": 10 - }, - "9": { - "choice_id": 9 - }, - "10": { - "choice_id": 10 - }, - "11": { - "choice_id": 11 - }, - "12": { - "choice_id": 12 - }, - "13": { - "choice_id": 13 - }, - "14": { - "choice_id": 14 - }, - "5": { - "id": 19, - "value": "yes", - "choice_id": 5, - "text": "2020-02-04 12:35:37", - "stack_id": 10 - }, - "6": { - "id": 20, - "value": "yes", - "choice_id": 6, - "text": "2020-02-04 12:35:37", - "stack_id": 10 - }, - "7": { - "id": 21, - "value": "yes", - "choice_id": 7, - "text": "2020-02-04 12:35:37", - "stack_id": 10 - } - } - } - ], - "comments": [ - { - "id": 3, - "text": "allez boumbo!", - "pseudo": "tk_TEST_commentateur", - "date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - } - }, - { - "id": 4, - "text": "je suis pour la team rocket de digimon", - "pseudo": "tk_TEST", - "date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - } - } - ], - "choices": [ - { - "id": 8, - "date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "text": "Vic le viking", - "url": null - }, - { - "id": 9, - "date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "text": "Boumbo petite automobile", - "url": null - }, - { - "id": 10, - "date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "text": "Les mystérieuses cités d'or", - "url": null - }, - { - "id": 11, - "date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "text": "Les mondes engloutis", - "url": null - }, - { - "id": 12, - "date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "text": "Foot 2 rue", - "url": null - }, - { - "id": 13, - "date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "text": "Le chat, la vache, et l'océan", - "url": null - }, - { - "id": 14, - "date": { - "date": "2020-02-04 12:35:37.000000", - "timezone_type": 3, - "timezone": "Europe/Berlin" - }, - "text": "Digimon", - "url": null - } - ], - "choices_count": { - "counts": { - "10": { - "choice_id": 10, - "choice_text": "Les mystérieuses cités d'or", - "id": 4, - "score": 2.5, - "yes": { - "count": 2, - "people": [ - "voting_people_TEST", - "voting_people_TEST" - ] - }, - "maybe": { - "count": 1, - "people": [ - "Nikolas Edison" - ] - }, - "no": { - "count": 1, - "people": [ - "voting_people_TEST" - ] - } - }, - "9": { - "choice_id": 9, - "choice_text": "Boumbo petite automobile", - "id": 5, - "score": 2.5, - "yes": { - "count": 2, - "people": [ - "voting_people_TEST", - "Billie Jean" - ] - }, - "maybe": { - "count": 1, - "people": [ - "voting_people_TEST" - ] - }, - "no": { - "count": 0, - "people": [] - } - }, - "12": { - "choice_id": 12, - "choice_text": "Foot 2 rue", - "id": 14, - "score": 0.5, - "yes": { - "count": 0, - "people": [] - }, - "maybe": { - "count": 1, - "people": [ - "Nikolas Edison" - ] - }, - "no": { - "count": 0, - "people": [] - } - }, - "11": { - "choice_id": 11, - "choice_text": "Les mondes engloutis", - "id": 15, - "score": 1.5, - "yes": { - "count": 1, - "people": [ - "Billie Jean" - ] - }, - "maybe": { - "count": 1, - "people": [ - "Wulfila" - ] - }, - "no": { - "count": 0, - "people": [] - } - }, - "13": { - "choice_id": 13, - "choice_text": "Le chat, la vache, et l'océan", - "id": 16, - "score": 1, - "yes": { - "count": 1, - "people": [ - "Wulfila" - ] - }, - "maybe": { - "count": 0, - "people": [] - }, - "no": { - "count": 0, - "people": [] - } - }, - "5": { - "choice_id": 5, - "choice_text": "2020-02-04 12:35:37", - "id": 19, - "score": 1, - "yes": { - "count": 1, - "people": [ - "tk_TEST" - ] - }, - "maybe": { - "count": 0, - "people": [] - }, - "no": { - "count": 0, - "people": [] - } - }, - "6": { - "choice_id": 6, - "choice_text": "2020-02-04 12:35:37", - "id": 20, - "score": 1, - "yes": { - "count": 1, - "people": [ - "tk_TEST" - ] - }, - "maybe": { - "count": 0, - "people": [] - }, - "no": { - "count": 0, - "people": [] - } - }, - "7": { - "choice_id": 7, - "choice_text": "2020-02-04 12:35:37", - "id": 21, - "score": 1, - "yes": { - "count": 1, - "people": [ - "tk_TEST" - ] - }, - "maybe": { - "count": 0, - "people": [] - }, - "no": { - "count": 0, - "people": [] - } - }, - "8": { - "choice_id": 8, - "choice_text": "Vic le viking", - "id": 22, - "score": 1, - "yes": { - "count": 1, - "people": [ - "tk_TEST" - ] - }, - "maybe": { - "count": 0, - "people": [] - }, - "no": { - "count": 0, - "people": [] - } - } - }, - "maxScore": 2.5 - }, - "vote_count": 6, - "owner": { - "__initializer__": null, - "__cloner__": null, - "__isInitialized__": true, - "pseudo": "tk_TEST", - "email": "tktest@tktest.com" - }, - "owner_modifier_token": "V46C6b58c456B39kTI19KSfp1y8Zz7Wyg500xMdjNB823st221Gb509VX1AOsnhV93fhol1f8P30OblKFoI76u54T94rH92x5c95TdW1W2eH0hb55q8", - "admin_key": "9uE27daM8dG1P9z74B89z299W0JF0ne15eER37g2v3d86mk123318v516UUbey4z3C87Wbo65V3c7cHsBTELvhl8b82d61WBMR2U66USNc7idS8810f", - "json_you_sent": { - "pseudo": "mon pseudo", - "email": "tktest@tktest.com", - "votes": [ - { - "choice_id": 5, - "value": "yes" - }, - { - "choice_id": 6, - "value": "yes" - }, - { - "choice_id": 7, - "value": "yes" - }, - { - "choice_id": 8, - "value": "yes" - } - ] - } }; diff --git a/src/app/config/mocks/mockmypolls.ts b/src/app/config/mocks/mockmypolls.ts index 4bf1f435..4e74f63e 100644 --- a/src/app/config/mocks/mockmypolls.ts +++ b/src/app/config/mocks/mockmypolls.ts @@ -1,43 +1,44 @@ -export const mockMyPolls = - [{ - "id": 1000001, - "title": "blehehehe heh hehhe e test1", - "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 - }, { - "id": 1000002, - "title": "bleh z zr erth tuyjikioy yylil test2", - "customUrl": null, - "description": "maaaaaaaaaaah 2", - "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 - }] -; +export const mockMyPolls = [ + { + id: 1000001, + title: 'blehehehe heh hehhe e test1', + 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, + }, + { + id: 1000002, + title: 'bleh z zr erth tuyjikioy yylil test2', + customUrl: null, + description: 'maaaaaaaaaaah 2', + 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/custom-lib/date-value-accessor/date-value-accessor.ts b/src/app/custom-lib/date-value-accessor/date-value-accessor.ts index 7fb59d2c..42cf785f 100644 --- a/src/app/custom-lib/date-value-accessor/date-value-accessor.ts +++ b/src/app/custom-lib/date-value-accessor/date-value-accessor.ts @@ -1,10 +1,10 @@ -import {Directive, ElementRef, forwardRef, HostListener, Renderer2} from '@angular/core'; -import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms'; +import { Directive, ElementRef, forwardRef, HostListener, Renderer2 } from '@angular/core'; +import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; export const DATE_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DateValueAccessor), - multi: true + multi: true, }; /** @@ -19,17 +19,13 @@ export const DATE_VALUE_ACCESSOR: any = { // this selector is an opt-in version selector: '[useValueAsDate]', - providers: [DATE_VALUE_ACCESSOR] + providers: [DATE_VALUE_ACCESSOR], }) export class DateValueAccessor implements ControlValueAccessor { + @HostListener('input', ['$event.target.valueAsDate']) onChange = (_: any) => {}; + @HostListener('blur', []) onTouched = () => {}; - @HostListener('input', ['$event.target.valueAsDate']) onChange = (_: any) => { - }; - @HostListener('blur', []) onTouched = () => { - }; - - constructor(private _renderer: Renderer2, private _elementRef: ElementRef) { - } + constructor(private _renderer: Renderer2, private _elementRef: ElementRef) {} writeValue(value: Date): void { if (!value) { diff --git a/src/app/custom-lib/date-value-accessor/index.ts b/src/app/custom-lib/date-value-accessor/index.ts index 0205cf75..45839385 100644 --- a/src/app/custom-lib/date-value-accessor/index.ts +++ b/src/app/custom-lib/date-value-accessor/index.ts @@ -1,3 +1,2 @@ export * from './module'; export * from './date-value-accessor'; - diff --git a/src/app/custom-lib/date-value-accessor/module.ts b/src/app/custom-lib/date-value-accessor/module.ts index 9c3973d9..b2a657fe 100644 --- a/src/app/custom-lib/date-value-accessor/module.ts +++ b/src/app/custom-lib/date-value-accessor/module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { DateValueAccessor } from './date-value-accessor'; @NgModule({ - declarations: [DateValueAccessor], - exports: [DateValueAccessor] + declarations: [DateValueAccessor], + exports: [DateValueAccessor], }) -export class DateValueAccessorModule { } +export class DateValueAccessorModule {} diff --git a/src/app/debugger/debugger.component.html b/src/app/debugger/debugger.component.html index 406e1b4a..d26334bd 100644 --- a/src/app/debugger/debugger.component.html +++ b/src/app/debugger/debugger.component.html @@ -1,52 +1,30 @@ -
- -

+
+ +

infos de debug - environement de Dev -

- - {{"config.demo"|translate}} - -
-
    -
  • - étape actuelle {{config.step}} / {{config.stepMax}} -
  • -
  • - formulaire valide : {{formIsValid}} -
  • -
  • - type de formulaire: {{config.pollType}} -
  • -
-

+ + {{ 'config.demo' | translate }} + +
+
    +
  • étape actuelle {{ config.step }} / {{ config.stepMax }}
  • +
  • formulaire valide : {{ formIsValid }}
  • +
  • type de formulaire: {{ config.pollType }}
  • +
+ - + - + - + - + + See example of vote page - -
+ +
diff --git a/src/app/debugger/debugger.component.spec.ts b/src/app/debugger/debugger.component.spec.ts index 1d643e98..2362c090 100644 --- a/src/app/debugger/debugger.component.spec.ts +++ b/src/app/debugger/debugger.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { DebuggerComponent } from './debugger.component'; describe('DebuggerComponent', () => { - let component: DebuggerComponent; - let fixture: ComponentFixture; + let component: DebuggerComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ DebuggerComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [DebuggerComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(DebuggerComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(DebuggerComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/debugger/debugger.component.ts b/src/app/debugger/debugger.component.ts index 2cb828ff..b02496de 100644 --- a/src/app/debugger/debugger.component.ts +++ b/src/app/debugger/debugger.component.ts @@ -1,19 +1,17 @@ -import {Component, OnInit} from '@angular/core'; -import {ConfigService} from '../services/config.service'; +import { Component, OnInit } from '@angular/core'; +import { ConfigService } from '../services/config.service'; @Component({ selector: 'framadate-debugger', templateUrl: './debugger.component.html', - styleUrls: ['./debugger.component.scss'] + styleUrls: ['./debugger.component.scss'], }) export class DebuggerComponent implements OnInit { formIsValid = true; - constructor(public config: ConfigService) { - } + constructor(public config: ConfigService) {} - ngOnInit() { - } + ngOnInit() {} selectOption(key: string, val: any) { if (!this.config[key]) { @@ -25,6 +23,6 @@ export class DebuggerComponent implements OnInit { } launchToast() { - this.config.handleError({message: "hop"}) + this.config.handleError({ message: 'hop' }); } } diff --git a/src/app/header/header.component.spec.ts b/src/app/header/header.component.spec.ts index 2d0479d7..b513ef54 100644 --- a/src/app/header/header.component.spec.ts +++ b/src/app/header/header.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { HeaderComponent } from './header.component'; describe('HeaderComponent', () => { - let component: HeaderComponent; - let fixture: ComponentFixture; + let component: HeaderComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ HeaderComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [HeaderComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(HeaderComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(HeaderComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/header/header.component.ts b/src/app/header/header.component.ts index b192e066..a1b0ba07 100644 --- a/src/app/header/header.component.ts +++ b/src/app/header/header.component.ts @@ -1,15 +1,12 @@ import { Component, OnInit } from '@angular/core'; @Component({ - selector: 'framadate-header', - templateUrl: './header.component.html', - styleUrls: ['./header.component.scss'] + selector: 'framadate-header', + templateUrl: './header.component.html', + styleUrls: ['./header.component.scss'], }) export class HeaderComponent implements OnInit { + constructor() {} - constructor() { } - - ngOnInit() { - } - + ngOnInit() {} } diff --git a/src/app/pages/admin/admin.component.html b/src/app/pages/admin/admin.component.html index cafcbe25..6175bd5c 100644 --- a/src/app/pages/admin/admin.component.html +++ b/src/app/pages/admin/admin.component.html @@ -2,153 +2,147 @@

Nom du sondage

-

{{"admin.info_section_title"|translate}}

+

{{ 'admin.info_section_title' | translate }}

- + - + -

{{"admin.settings_section_title"|translate}}

-

{{"visibility.title"|translate}}

+

{{ 'admin.settings_section_title' | translate }}

+

{{ 'visibility.title' | translate }}

-

{{"visibility.votes"|translate}}

+

{{ 'visibility.votes' | translate }}

- +
- + {{ 'admin.votes_deletion_btn' | translate }} + + -

{{"admin.comments_deletion_title"|translate}}

+

{{ 'admin.comments_deletion_title' | translate }}

- + {{ 'admin.comments_deletion_btn' | translate }} + + -

{{"admin.archiving_title"|translate}}

+

{{ 'admin.archiving_title' | translate }}

- +
-

{{"visibility.access"|translate}}

+

{{ 'visibility.access' | translate }}

-

{{"admin.deletion"|translate}}

- - +

{{ 'admin.deletion' | translate }}

+ + -

{{"admin.link"|translate}}

-

{{"admin.link_admin"|translate}}

+

{{ 'admin.link' | translate }}

+

{{ 'admin.link_admin' | translate }}

- - + + -

{{"admin.polled_people"|translate}}

+

{{ 'admin.polled_people' | translate }}

- - - -

{{"admin.email_links"|translate}}

- - - + {{ 'admin.polled_people_desc' | translate }} + {{ config.urlPublic }} + + +

{{ 'admin.email_links' | translate }}

+ + + diff --git a/src/app/pages/admin/admin.component.scss b/src/app/pages/admin/admin.component.scss index 0909d584..f2359c88 100644 --- a/src/app/pages/admin/admin.component.scss +++ b/src/app/pages/admin/admin.component.scss @@ -1,39 +1,41 @@ -form{ - display:flex; - flex-direction: column; - width:340px; -margin:auto; +form { + display: flex; + flex-direction: column; + width: 340px; + margin: auto; } -.row{ - flex-direction: row; - flex-wrap: wrap; - padding-bottom: 65px; +.row { + flex-direction: row; + flex-wrap: wrap; + padding-bottom: 65px; } -textarea{ - height:115px; - margin-bottom: 50px; +textarea { + height: 115px; + margin-bottom: 50px; } -label{ - padding-bottom: 10px; - flex-wrap: wrap; +label { + padding-bottom: 10px; + flex-wrap: wrap; } -h2,h1{ - margin-bottom: 40px; +h2, +h1 { + margin-bottom: 40px; } -h2{ - margin-top: 40px; - padding-left:16px; +h2 { + margin-top: 40px; + padding-left: 16px; } -.btn--alert{ - font-weight: 600; +.btn--alert { + font-weight: 600; } -h3{ - padding-left: 28px; - padding-bottom:15px; +h3 { + padding-left: 28px; + padding-bottom: 15px; } -select,input[type=date]{ - max-width: 130px; +select, +input[type='date'] { + max-width: 130px; } -.btn--outline{ - margin-bottom: 70px; +.btn--outline { + margin-bottom: 70px; } diff --git a/src/app/pages/admin/admin.component.spec.ts b/src/app/pages/admin/admin.component.spec.ts index 72e742ff..3658454e 100644 --- a/src/app/pages/admin/admin.component.spec.ts +++ b/src/app/pages/admin/admin.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { AdminComponent } from './admin.component'; describe('AdminComponent', () => { - let component: AdminComponent; - let fixture: ComponentFixture; + let component: AdminComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ AdminComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [AdminComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(AdminComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(AdminComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/admin/admin.component.ts b/src/app/pages/admin/admin.component.ts index a99c9db7..dfe5a381 100644 --- a/src/app/pages/admin/admin.component.ts +++ b/src/app/pages/admin/admin.component.ts @@ -1,17 +1,13 @@ -import {Component, OnInit} from '@angular/core'; -import {ConfigService} from '../../services/config.service'; +import { Component, OnInit } from '@angular/core'; +import { ConfigService } from '../../services/config.service'; @Component({ selector: 'framadate-admin', templateUrl: './admin.component.html', - styleUrls: ['./admin.component.scss'] + styleUrls: ['./admin.component.scss'], }) export class AdminComponent implements OnInit { + constructor(public config: ConfigService) {} - constructor(public config: ConfigService) { - } - - ngOnInit() { - } - + ngOnInit() {} } diff --git a/src/app/pages/answers/answers.component.html b/src/app/pages/answers/answers.component.html index 5c81b5ae..cfd023b1 100644 --- a/src/app/pages/answers/answers.component.html +++ b/src/app/pages/answers/answers.component.html @@ -1,102 +1,76 @@ -
-

+
+

Choisir les propositions -

+

-

+

Vous pouvez utiliser la syntaxe markdown, et naviguer entre les inputs avec les flèches du clavier. -

+

-
    -
  1. - -
  2. +
-
+ +
-
- -
+ +
diff --git a/src/app/pages/answers/answers.component.spec.ts b/src/app/pages/answers/answers.component.spec.ts index 25ce7b36..c4f1086f 100644 --- a/src/app/pages/answers/answers.component.spec.ts +++ b/src/app/pages/answers/answers.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { AnswersComponent } from './answers.component'; describe('AnswersComponent', () => { - let component: AnswersComponent; - let fixture: ComponentFixture; + let component: AnswersComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ AnswersComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [AnswersComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(AnswersComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(AnswersComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/answers/answers.component.ts b/src/app/pages/answers/answers.component.ts index 1b664619..7039c6fa 100644 --- a/src/app/pages/answers/answers.component.ts +++ b/src/app/pages/answers/answers.component.ts @@ -1,41 +1,36 @@ -import {AfterViewInit, ChangeDetectorRef, Component, Inject, OnChanges, OnInit} from '@angular/core'; -import {BaseComponent} from '../base-page/base.component'; -import {ConfigService} from '../../services/config.service'; +import { AfterViewInit, ChangeDetectorRef, Component, Inject, OnChanges, OnInit } from '@angular/core'; +import { BaseComponent } from '../base-page/base.component'; +import { ConfigService } from '../../services/config.service'; -import {DOCUMENT} from '@angular/common'; +import { DOCUMENT } from '@angular/common'; @Component({ selector: 'framadate-answers', templateUrl: './answers.component.html', - styleUrls: ['./answers.component.scss'] + styleUrls: ['./answers.component.scss'], }) export class AnswersComponent extends BaseComponent implements OnInit, AfterViewInit, OnChanges { - allAnswersAreValid = false; answerList = []; - currentHeader: any = ""; + currentHeader: any = ''; display: boolean; - constructor(public config: ConfigService, - @Inject(DOCUMENT) private document: any, - private cd: ChangeDetectorRef) { + constructor(public config: ConfigService, @Inject(DOCUMENT) private document: any, private cd: ChangeDetectorRef) { super(config); this.answerList = this.config.answers; } // todo, manage validation of each page in a common way - ngOnInit() { - } + ngOnInit() {} ngOnChanges() { - this.checkValidAnswers(); } checkValidAnswers() { this.allAnswersAreValid = true; - this.config.answers.forEach(answer => { + this.config.answers.forEach((answer) => { if (!answer.text.length) { this.allAnswersAreValid = false; return; @@ -53,18 +48,17 @@ export class AnswersComponent extends BaseComponent implements OnInit, AfterView } addAnswer() { - this.config.answers.push( - { - id: this.config.answers.length + 1, - text: '', - url: '', - file: '', - literal: '', - date_object: null, - timeList: [] - }); + this.config.answers.push({ + id: this.config.answers.length + 1, + text: '', + url: '', + file: '', + literal: '', + date_object: null, + timeList: [], + }); this.cd.detectChanges(); // to refresh the view before focusing on the new input - this.focusOnAnswer(this.config.answers.length - 1) + this.focusOnAnswer(this.config.answers.length - 1); } focusOnAnswer(i) { @@ -79,13 +73,13 @@ export class AnswersComponent extends BaseComponent implements OnInit, AfterView } navigateOrDelete(event: KeyboardEvent, i) { - if (event.ctrlKey && event.key == "d") { - this.config.answers.splice(i, 1) + if (event.ctrlKey && event.key == 'd') { + this.config.answers.splice(i, 1); } - if (event.key == "ArrowUp" && i > 0) { + if (event.key == 'ArrowUp' && i > 0) { this.focusOnAnswer(i - 1); } - if (event.key == "ArrowDown" && i < this.config.answers.length) { + if (event.key == 'ArrowDown' && i < this.config.answers.length) { this.focusOnAnswer(i + 1); } } diff --git a/src/app/pages/base-page/base.component.html b/src/app/pages/base-page/base.component.html index 5567fdea..a8907cd9 100644 --- a/src/app/pages/base-page/base.component.html +++ b/src/app/pages/base-page/base.component.html @@ -1,4 +1,4 @@

Ce composant est celui de base pour les pages

- {{"config.perfect"|translate}} + {{ 'config.perfect' | translate }} diff --git a/src/app/pages/base-page/base.component.spec.ts b/src/app/pages/base-page/base.component.spec.ts index 5fb761d4..3bd1a943 100644 --- a/src/app/pages/base-page/base.component.spec.ts +++ b/src/app/pages/base-page/base.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { BaseComponent } from './base.component'; describe('BaseComponent', () => { - let component: BaseComponent; - let fixture: ComponentFixture; + let component: BaseComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ BaseComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [BaseComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(BaseComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(BaseComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/base-page/base.component.ts b/src/app/pages/base-page/base.component.ts index d55c7b54..09de6fa9 100644 --- a/src/app/pages/base-page/base.component.ts +++ b/src/app/pages/base-page/base.component.ts @@ -1,22 +1,18 @@ -import {Component, OnInit} from '@angular/core'; -import {ConfigService} from '../../services/config.service'; +import { Component, OnInit } from '@angular/core'; +import { ConfigService } from '../../services/config.service'; @Component({ selector: 'framadate-base-page', templateUrl: './base.component.html', - styleUrls: ['./base.component.scss'] + styleUrls: ['./base.component.scss'], }) /** * base page is aware of the state of the filling */ export class BaseComponent implements OnInit { + constructor(public config: ConfigService) {} - constructor(public config: ConfigService) { - } - - ngOnInit() { - } - + ngOnInit() {} checkValidity() { // TODO with form controls diff --git a/src/app/pages/create-or-retrieve/create-or-retrieve.component.html b/src/app/pages/create-or-retrieve/create-or-retrieve.component.html index 9eb67b9d..442ec447 100644 --- a/src/app/pages/create-or-retrieve/create-or-retrieve.component.html +++ b/src/app/pages/create-or-retrieve/create-or-retrieve.component.html @@ -1,46 +1,33 @@ -
+
- -
-

- {{"creation.title"|translate}} -

-

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

-
- - - -
-
+
+

+ {{ 'creation.title' | translate }} +

+

+ {{ 'config.description' | translate }} +

+
+ +
+
-
-

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

-
- +
+

+ {{ 'config.find_my_polls' | translate }} +

+ + - -
-
-

+ +

+
+

Mes Sondages trouvés: -

- + + -
+
Aucun sondage. -
-
-
- -
+
+ +
+ +
- - - - -
+
diff --git a/src/app/pages/create-or-retrieve/create-or-retrieve.component.scss b/src/app/pages/create-or-retrieve/create-or-retrieve.component.scss index cdae3b7f..a2734f1d 100644 --- a/src/app/pages/create-or-retrieve/create-or-retrieve.component.scss +++ b/src/app/pages/create-or-retrieve/create-or-retrieve.component.scss @@ -1,7 +1,7 @@ -.container{ - display:flex; - flex-direction: column; - margin:auto; +.container { + display: flex; + flex-direction: column; + margin: auto; } h1 { display: inline-block; @@ -9,19 +9,19 @@ h1 { font-size: 2.6rem; &::after { - content: ""; - display: block; - width: 27.4%; - height: 2px; - margin-top: 5px; - margin-right: auto; - margin-left: auto; - // background-color: $primary_color; + content: ''; + display: block; + width: 27.4%; + height: 2px; + margin-top: 5px; + margin-right: auto; + margin-left: auto; + // background-color: $primary_color; } - } -label{ - float:left; } -input[type=email]{ - display:block; +label { + float: left; +} +input[type='email'] { + display: block; } diff --git a/src/app/pages/create-or-retrieve/create-or-retrieve.component.spec.ts b/src/app/pages/create-or-retrieve/create-or-retrieve.component.spec.ts index e261a564..6df51b23 100644 --- a/src/app/pages/create-or-retrieve/create-or-retrieve.component.spec.ts +++ b/src/app/pages/create-or-retrieve/create-or-retrieve.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { CreateOrRetrieveComponent } from './create-or-retrieve.component'; describe('CreateOrRetrieveComponent', () => { - let component: CreateOrRetrieveComponent; - let fixture: ComponentFixture; + let component: CreateOrRetrieveComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CreateOrRetrieveComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [CreateOrRetrieveComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(CreateOrRetrieveComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(CreateOrRetrieveComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); 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 ec87f8d8..fd68a04f 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 @@ -1,17 +1,15 @@ -import {Component, OnInit} from '@angular/core'; -import {BaseComponent} from "../base-page/base.component"; -import {ConfigService} from "../../services/config.service"; +import { Component, OnInit } from '@angular/core'; +import { BaseComponent } from '../base-page/base.component'; +import { ConfigService } from '../../services/config.service'; @Component({ selector: 'framadate-create-or-retrieve', templateUrl: './create-or-retrieve.component.html', - styleUrls: ['./create-or-retrieve.component.scss'] + styleUrls: ['./create-or-retrieve.component.scss'], }) export class CreateOrRetrieveComponent extends BaseComponent implements OnInit { - loadedMyPolls: boolean = false; - constructor(public config: ConfigService) { super(config); } @@ -20,12 +18,11 @@ export class CreateOrRetrieveComponent extends BaseComponent implements OnInit { // if (!environment.production) { // this.findMyPollsByEmail('tktest@tktest.com') // } - } findMyPollsByEmail(email: string) { if (!email) { - return + return; } this.config.findPollsByEmail(email); this.loadedMyPolls = true; @@ -33,5 +30,5 @@ export class CreateOrRetrieveComponent extends BaseComponent implements OnInit { trackFunction(index: number, item: any): number { return item.id; - }; + } } diff --git a/src/app/pages/dates/dates.component.html b/src/app/pages/dates/dates.component.html index 223f029a..af868107 100644 --- a/src/app/pages/dates/dates.component.html +++ b/src/app/pages/dates/dates.component.html @@ -1,223 +1,168 @@ -

- {{"dates.title"|translate}} -

+

{{ 'dates.title' | translate }}

-
- -
+
+ +
+ - + + {{ 'dates.add_interval' | translate }} + - -
+ +
-
-

{{"dates.add_interval"|translate}}

-

- {{"dates.interval_propose"|translate}} - - {{"dates.interval_span"|translate}} - -
- -

- -
-
-
-
-
-
- - {{config.timeList.length}} - - - {{"dates.count_time"|translate}} +
+

{{ 'dates.add_interval' | translate }}

+

+ {{ 'dates.interval_propose' | translate }} + + {{ 'dates.interval_span' | translate }} + +
+

+ +
+
+
+
+
+
+ + {{ config.timeList.length }} + + + {{ 'dates.count_time' | translate }} (pour chaque jour) - - -
-
+ +
+
+ + {{ 'dates.add_time' | translate }} + + -
+ +
-
-
- +
+
+ - -
-
-
- - {{config.dateList.length}} - - - {{"dates.count_dates"|translate}} - - -
- {{id}}) + id="timeChoices_{{ id }}" + /> + +
+
+
+ + {{ config.dateList.length }} + + + {{ 'dates.count_dates' | translate }} + + +
+ {{ id }}) - + /> + -
-
+ {{ 'dates.add_time' | translate }} + +
+
- -
-
-
-
-
-
- -
-
+ /> + +
+
+
+ + +
+ +
+ - + C'est parfait! - - + + diff --git a/src/app/pages/dates/dates.component.scss b/src/app/pages/dates/dates.component.scss index 3881e06f..52b5dfbf 100644 --- a/src/app/pages/dates/dates.component.scss +++ b/src/app/pages/dates/dates.component.scss @@ -12,10 +12,10 @@ } :host { - input, button { + input, + button { + button { margin-left: 1em; } } - } diff --git a/src/app/pages/dates/dates.component.spec.ts b/src/app/pages/dates/dates.component.spec.ts index e5affef8..87e8acfc 100644 --- a/src/app/pages/dates/dates.component.spec.ts +++ b/src/app/pages/dates/dates.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { DatesComponent } from './dates.component'; describe('DatesComponent', () => { - let component: DatesComponent; - let fixture: ComponentFixture; + let component: DatesComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ DatesComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [DatesComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(DatesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(DatesComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/dates/dates.component.ts b/src/app/pages/dates/dates.component.ts index 0bffae95..c9c69d8c 100644 --- a/src/app/pages/dates/dates.component.ts +++ b/src/app/pages/dates/dates.component.ts @@ -1,15 +1,15 @@ -import {ChangeDetectorRef, Component, Inject, OnInit} from '@angular/core'; -import {ConfigService} from '../../services/config.service'; -import {BaseComponent} from '../base-page/base.component'; -import {DOCUMENT} from '@angular/common'; -import {MessageService} from "primeng/api"; -import {otherDefaultDates} from "../../config/defaultConfigs"; -import {DateUtilities} from "../../config/DateUtilities"; +import { ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core'; +import { ConfigService } from '../../services/config.service'; +import { BaseComponent } from '../base-page/base.component'; +import { DOCUMENT } from '@angular/common'; +import { MessageService } from 'primeng/api'; +import { otherDefaultDates } from '../../config/defaultConfigs'; +import { DateUtilities } from '../../config/DateUtilities'; @Component({ selector: 'framadate-dates', templateUrl: './dates.component.html', - styleUrls: ['./dates.component.scss'] + styleUrls: ['./dates.component.scss'], }) export class DatesComponent extends BaseComponent implements OnInit { showDateInterval: boolean = false; @@ -18,11 +18,12 @@ export class DatesComponent extends BaseComponent implements OnInit { intervalDaysDefault: number = 7; endDateInterval: any; - constructor(public config: ConfigService, - private cd: ChangeDetectorRef, - private messageService: MessageService, - private dateUtilities: DateUtilities, - @Inject(DOCUMENT) private document: any + constructor( + public config: ConfigService, + private cd: ChangeDetectorRef, + private messageService: MessageService, + private dateUtilities: DateUtilities, + @Inject(DOCUMENT) private document: any ) { super(config); } @@ -30,7 +31,7 @@ export class DatesComponent extends BaseComponent implements OnInit { countDays() { // compute the number of days in the date interval if (this.endDateInterval && this.startDateInterval) { - this.intervalDays = (this.dateUtilities.dayDiff(this.endDateInterval, this.startDateInterval)).toFixed(0) + this.intervalDays = this.dateUtilities.dayDiff(this.endDateInterval, this.startDateInterval).toFixed(0); } } @@ -41,14 +42,17 @@ export class DatesComponent extends BaseComponent implements OnInit { let dateCurrent = new Date(); const dateJson = dateCurrent.toISOString(); this.startDateInterval = dateJson.substring(0, 10); - this.endDateInterval = this.dateUtilities.addDaysToDate(this.intervalDaysDefault, dateCurrent).toISOString().substring(0, 10); + this.endDateInterval = this.dateUtilities + .addDaysToDate(this.intervalDaysDefault, dateCurrent) + .toISOString() + .substring(0, 10); } addDate() { this.config.dateList.push({ literal: '', date_object: new Date(), - timeList: [] + timeList: [], }); let selector = '[ng-reflect-name="dateChoices_' + (this.config.dateList.length - 1) + '"]'; this.cd.detectChanges(); @@ -62,13 +66,11 @@ export class DatesComponent extends BaseComponent implements OnInit { * change time spans */ addTime() { - this.config.timeList.push( - { - literal: '', - timeList: [], - date_object: new Date() - } - ); + this.config.timeList.push({ + literal: '', + timeList: [], + date_object: new Date(), + }); } removeAllTimes() { @@ -79,7 +81,6 @@ export class DatesComponent extends BaseComponent implements OnInit { this.config.timeList = otherDefaultDates; } - /** * add a time period to a specific date choice, * focus on the new input @@ -87,7 +88,7 @@ export class DatesComponent extends BaseComponent implements OnInit { * @param id */ addTimeToDate(config: any, id: number) { - config.timeList.push({literal: ''}); + config.timeList.push({ literal: '' }); let selector = '[ng-reflect-name="dateTime_' + id + '_Choices_' + (config.timeList.length - 1) + '"]'; this.cd.detectChanges(); const elem = this.document.querySelector(selector); @@ -100,17 +101,16 @@ export class DatesComponent extends BaseComponent implements OnInit { * remove all input contents, does not reset to default */ emptyAll() { - this.config.dateList.forEach(element => { + this.config.dateList.forEach((element) => { element.literal = ''; element.date_object = new Date(); element.timeList = ['', '', '']; }); - this.config.timeList.forEach(element => { + this.config.timeList.forEach((element) => { element.literal = ''; }); } - /** * add all the dates between the start and end dates in the interval section */ @@ -118,11 +118,11 @@ export class DatesComponent extends BaseComponent implements OnInit { let newIntervalArray = this.dateUtilities.getDatesInRange(this.startDateInterval, this.endDateInterval, 1); const converted = []; - newIntervalArray.forEach(element => { + newIntervalArray.forEach((element) => { converted.push({ literal: element.literal, date_object: element.date_object, - timeList: [] + timeList: [], }); }); this.config.dateList = [...new Set(converted)]; // add only dates that are not already present with a Set of unique items @@ -131,10 +131,7 @@ export class DatesComponent extends BaseComponent implements OnInit { this.messageService.add({ severity: 'success', summary: 'Dates ajoutées', - detail: `les dates ont été ajoutées aux réponses possibles` + detail: `les dates ont été ajoutées aux réponses possibles`, }); - } - - } diff --git a/src/app/pages/end-confirmation/end-confirmation.component.html b/src/app/pages/end-confirmation/end-confirmation.component.html index a0a60d6c..232062c3 100644 --- a/src/app/pages/end-confirmation/end-confirmation.component.html +++ b/src/app/pages/end-confirmation/end-confirmation.component.html @@ -1,74 +1,56 @@ -

- {{"resume.title"|translate}} -

-
-

{{"resume.admins"|translate}}

-

+

+ {{ 'resume.title' | translate }} +

+
+

{{ 'resume.admins' | translate }}

+

+ Votre sondage « + + {{ config.title }} + + » a bien été créé ! +

+

+ Voici les liens d’accès au sondage, conservez-les soigneusement ! (Si vous les perdez vous pourrez toujours les + recevoir par email) +

- Votre sondage «  - - {{config.title}} - -  » a bien été créé ! -

-

- Voici les liens d’accès au sondage, conservez-les soigneusement ! - (Si vous les perdez vous pourrez toujours les recevoir par email) -

- -

+

Pour accéder au sondage et à tous ses paramètres : - {{config.urlAdmin}} - -

- - + {{ config.urlAdmin }} +

+ + Voir le sondage coté administrateur·ice - -

- Note : Le sondage sera supprimé {{config.deletionDateAfterLastModification}} jours après la date de sa dernière - modification. -

- -
-
- -

{{"resume.users"|translate}}

-

+ +

+ Note : Le sondage sera supprimé {{ config.deletionDateAfterLastModification }} jours après la date de sa + dernière modification. +

+
+
+

{{ 'resume.users' | translate }}

+

Pour accéder au sondage : - {{config.urlPublic}} - - -

- - + {{ config.urlPublic }} +

+ + Voir le sondage - -
-
+ +
+
+

{{ 'resume.links_mail' | translate }}

+

+ Pour être sur de retrouver ces liens, nous pouvons vous les envoyer sur votre mail mail : + +

-

{{"resume.links_mail"|translate}}

-

- Pour être sur de retrouver ces liens, nous pouvons vous les envoyer sur votre mail - - mail : - - -

- - - + + Voir le sondage - - -
- + +
diff --git a/src/app/pages/end-confirmation/end-confirmation.component.spec.ts b/src/app/pages/end-confirmation/end-confirmation.component.spec.ts index eb5d31b9..d198f3db 100644 --- a/src/app/pages/end-confirmation/end-confirmation.component.spec.ts +++ b/src/app/pages/end-confirmation/end-confirmation.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { EndConfirmationComponent } from './end-confirmation.component'; describe('EndConfirmationComponent', () => { - let component: EndConfirmationComponent; - let fixture: ComponentFixture; + let component: EndConfirmationComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ EndConfirmationComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [EndConfirmationComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(EndConfirmationComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(EndConfirmationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/end-confirmation/end-confirmation.component.ts b/src/app/pages/end-confirmation/end-confirmation.component.ts index effc1d9b..1c988ef9 100644 --- a/src/app/pages/end-confirmation/end-confirmation.component.ts +++ b/src/app/pages/end-confirmation/end-confirmation.component.ts @@ -1,37 +1,31 @@ -import {Component, OnInit} from '@angular/core'; -import {BaseComponent} from '../base-page/base.component'; -import {HttpClient} from '@angular/common/http'; -import {ConfigService} from "../../services/config.service"; -import {MessageService} from 'primeng/api'; +import { Component, OnInit } from '@angular/core'; +import { BaseComponent } from '../base-page/base.component'; +import { HttpClient } from '@angular/common/http'; +import { ConfigService } from '../../services/config.service'; +import { MessageService } from 'primeng/api'; @Component({ selector: 'framadate-end-confirmation', templateUrl: './end-confirmation.component.html', - styleUrls: ['./end-confirmation.component.scss'] + styleUrls: ['./end-confirmation.component.scss'], }) export class EndConfirmationComponent extends BaseComponent implements OnInit { mailToRecieve = ''; - constructor(public config: ConfigService, - public http: HttpClient, - private messageService: MessageService - ) { + constructor(public config: ConfigService, public http: HttpClient, private messageService: MessageService) { super(config); this.mailToRecieve = this.config.myEmail; } - ngOnInit() { - } + ngOnInit() {} copyLink(str: any) { this.messageService.add({ severity: 'success', summary: 'Lien copié', - detail: str + detail: str, }); } - sendToEmail() { - - } + sendToEmail() {} } diff --git a/src/app/pages/home/home.component.html b/src/app/pages/home/home.component.html index 49d5f062..c0e575ea 100644 --- a/src/app/pages/home/home.component.html +++ b/src/app/pages/home/home.component.html @@ -1,84 +1,58 @@ -
- +
+ -

- {{"creation.title"|translate}} -

- - {{"creation.want"|translate}} - - - + + - - + -
- - +
+ - -
+ /> + +
-
- +
+ - -
+ /> + +
-
- -
+
+ +
-
-
-
+
+ + - -
+ +
- - + - -
-
+ +
+
diff --git a/src/app/pages/home/home.component.spec.ts b/src/app/pages/home/home.component.spec.ts index 490e81bd..2dafb79d 100644 --- a/src/app/pages/home/home.component.spec.ts +++ b/src/app/pages/home/home.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { HomeComponent } from './home.component'; describe('HomeComponent', () => { - let component: HomeComponent; - let fixture: ComponentFixture; + let component: HomeComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ HomeComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [HomeComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(HomeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index a605b44b..c482378b 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -1,20 +1,17 @@ -import {Component, OnInit} from '@angular/core'; -import {ConfigService} from "../../services/config.service"; -import {BaseComponent} from "../base-page/base.component"; +import { Component, OnInit } from '@angular/core'; +import { ConfigService } from '../../services/config.service'; +import { BaseComponent } from '../base-page/base.component'; @Component({ selector: 'framadate-home', templateUrl: './home.component.html', - styleUrls: ['./home.component.scss'] + styleUrls: ['./home.component.scss'], }) export class HomeComponent extends BaseComponent implements OnInit { - nextStep = '/step/answers'; constructor(public config: ConfigService) { super(config); } - ngOnInit() { - } - + ngOnInit() {} } diff --git a/src/app/pages/kind/kind.component.html b/src/app/pages/kind/kind.component.html index 7ae00308..d6f8cd9a 100644 --- a/src/app/pages/kind/kind.component.html +++ b/src/app/pages/kind/kind.component.html @@ -1,343 +1,265 @@ -

page de démo

-

cette étape est en cours de développement.
S'inspirer de la page de Home pour réaliser d'autres pages -

-C'est parfait! -

Atoms

-
-
-

Headings

+

page de démo

+

+ cette étape est en cours de développement.
+ S'inspirer de la page de Home pour réaliser d'autres pages +

+C'est parfait! +

Atoms

+
+
+

Headings

-

Ceci est un h1

-

Ceci est un h2

-

Ceci est un h3

-
+

Ceci est un h1

+

Ceci est un h2

+

Ceci est un h3

+
- -
-

Buttons

+
+

Buttons

- + -
+
- + -
+
- + primary - outline - default - + -
+
- + -
+
- + -
+
- + -
+
- + -
+
- + -

+

- + - + - + - + +
-
+
+

Forms element

-
-

Forms element

+

Labels

-

Labels

+ - +

Input name

+
+ -

Input name

-
- +

Input email

+
+ -

Input email

-
- +

Input password

+
+ -

Input password

-
- +

Input date

+
+ -

Input date

-
- - -

Select

- + - + - + - + + -

Textarea

- -
+

Textarea

+ +
-
-

Paragraphs

+
+

Paragraphs

-

Lorem, ipsum dolor sit amet consectetur adipisicing elit. Magnam perspiciatis minus libero error dolores. +

+ Lorem, ipsum dolor sit amet consectetur adipisicing elit. Magnam perspiciatis minus libero error dolores. Corrupti repellat vero repellendus reiciendis assumenda minus. Nobis, quaerat ut nihil minima sed animi - delectus beatae!

-
+ delectus beatae! +

+
-
-

Lists

+
+

Lists

-

Unordered list

-
    -
  • +

    Unordered list

    +
      +
    • plop -
    • -
    • +
    • +
    • plop -
    • -
    • +
    • +
    • plop -
    • -
    +
  • +
-

Ordered list

-
    -
  1. +

    Ordered list

    +
      +
    1. plop -
    2. -
    3. +
    4. +
    5. plop -
    6. -
    7. +
    8. +
    9. plop -
    10. -
    -
+ + +
-
-

Images

- -
-
+
+

Images

+ +
+ -
-

Molecules

- - -
-

Label + input name

- - -
+
+

Label + input name

+ + +
-
-

Label + select

- - + - + - + - -
+ + + - + -
-

Commentaries

-
-
+
+

Commentaries

+
+ -
-

Components

+
+

Components

-
-

Images list

- that -
+
+

Images list

+ that +
-
-

Calendar

-
+
+

Calendar

+
-
-

Modale

-
+
+

Modale

+
-
-

Way to vote

- that -
+
+

Way to vote

+ that +
- + -
-

Graphics

- that -
-
+
+

Graphics

+ that +
+
diff --git a/src/app/pages/kind/kind.component.scss b/src/app/pages/kind/kind.component.scss index 2ac50a89..d627fcb2 100644 --- a/src/app/pages/kind/kind.component.scss +++ b/src/app/pages/kind/kind.component.scss @@ -8,7 +8,6 @@ section { + section { margin: 0 !important; } - } article { diff --git a/src/app/pages/kind/kind.component.spec.ts b/src/app/pages/kind/kind.component.spec.ts index c6e60909..e3ed420e 100644 --- a/src/app/pages/kind/kind.component.spec.ts +++ b/src/app/pages/kind/kind.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { KindComponent } from './kind.component'; describe('KindComponent', () => { - let component: KindComponent; - let fixture: ComponentFixture; + let component: KindComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ KindComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [KindComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(KindComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(KindComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/kind/kind.component.ts b/src/app/pages/kind/kind.component.ts index 52a03bb5..59416386 100644 --- a/src/app/pages/kind/kind.component.ts +++ b/src/app/pages/kind/kind.component.ts @@ -1,19 +1,16 @@ -import {Component, OnInit} from '@angular/core'; -import {BaseComponent} from '../base-page/base.component'; -import {ConfigService} from '../../services/config.service'; +import { Component, OnInit } from '@angular/core'; +import { BaseComponent } from '../base-page/base.component'; +import { ConfigService } from '../../services/config.service'; @Component({ selector: 'framadate-page-kind', templateUrl: './kind.component.html', - styleUrls: ['./kind.component.scss'] + styleUrls: ['./kind.component.scss'], }) export class KindComponent extends BaseComponent implements OnInit { - constructor(public config: ConfigService) { super(config); } - ngOnInit() { - } - + ngOnInit() {} } diff --git a/src/app/pages/password/password.component.html b/src/app/pages/password/password.component.html index 1a792b2e..df997f2a 100644 --- a/src/app/pages/password/password.component.html +++ b/src/app/pages/password/password.component.html @@ -2,11 +2,11 @@

Ce sondage est protégé par un mot de passe

- -
- - -
+ +
+ + +
- +
diff --git a/src/app/pages/password/password.component.scss b/src/app/pages/password/password.component.scss index da52dbf5..ed8b01e4 100644 --- a/src/app/pages/password/password.component.scss +++ b/src/app/pages/password/password.component.scss @@ -1,12 +1,12 @@ -form{ - display:flex; - flex-direction: column; +form { + display: flex; + flex-direction: column; } -label{ - font-weight: 600; - font-size: 18px; +label { + font-weight: 600; + font-size: 18px; } -h1{ - display:flex; - align-self: center; +h1 { + display: flex; + align-self: center; } diff --git a/src/app/pages/password/password.component.spec.ts b/src/app/pages/password/password.component.spec.ts index 49227f21..d55dc422 100644 --- a/src/app/pages/password/password.component.spec.ts +++ b/src/app/pages/password/password.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { PasswordComponent } from './password.component'; describe('PasswordComponent', () => { - let component: PasswordComponent; - let fixture: ComponentFixture; + let component: PasswordComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ PasswordComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [PasswordComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(PasswordComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(PasswordComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/password/password.component.ts b/src/app/pages/password/password.component.ts index f6947854..dc6210ce 100644 --- a/src/app/pages/password/password.component.ts +++ b/src/app/pages/password/password.component.ts @@ -1,19 +1,16 @@ import { Component, OnInit } from '@angular/core'; -import {BaseComponent} from "../base-page/base.component"; -import {ConfigService} from "../../services/config.service"; +import { BaseComponent } from '../base-page/base.component'; +import { ConfigService } from '../../services/config.service'; @Component({ - selector: 'framadate-password', - templateUrl: './password.component.html', - styleUrls: ['./password.component.scss'] + selector: 'framadate-password', + templateUrl: './password.component.html', + styleUrls: ['./password.component.scss'], }) export class PasswordComponent extends BaseComponent implements OnInit { - constructor(public config: ConfigService) { super(config); } - ngOnInit() { - } - + ngOnInit() {} } diff --git a/src/app/pages/pictures/pictures.component.html b/src/app/pages/pictures/pictures.component.html index 07d0b7b2..893e07ba 100644 --- a/src/app/pages/pictures/pictures.component.html +++ b/src/app/pages/pictures/pictures.component.html @@ -1,6 +1,5 @@

- Images + Images

ok - diff --git a/src/app/pages/pictures/pictures.component.spec.ts b/src/app/pages/pictures/pictures.component.spec.ts index 402073e1..8474bbee 100644 --- a/src/app/pages/pictures/pictures.component.spec.ts +++ b/src/app/pages/pictures/pictures.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { PicturesComponent } from './pictures.component'; describe('PicturesComponent', () => { - let component: PicturesComponent; - let fixture: ComponentFixture; + let component: PicturesComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ PicturesComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [PicturesComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(PicturesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(PicturesComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/pictures/pictures.component.ts b/src/app/pages/pictures/pictures.component.ts index ee04cf1f..a2c5ba79 100644 --- a/src/app/pages/pictures/pictures.component.ts +++ b/src/app/pages/pictures/pictures.component.ts @@ -1,19 +1,16 @@ -import {Component, OnInit} from '@angular/core'; -import {ConfigService} from '../../services/config.service'; -import {BaseComponent} from '../base-page/base.component'; +import { Component, OnInit } from '@angular/core'; +import { ConfigService } from '../../services/config.service'; +import { BaseComponent } from '../base-page/base.component'; @Component({ selector: 'framadate-pictures', templateUrl: './pictures.component.html', - styleUrls: ['./pictures.component.scss'] + styleUrls: ['./pictures.component.scss'], }) export class PicturesComponent extends BaseComponent implements OnInit { - constructor(public config: ConfigService) { super(config); } - ngOnInit() { - } - + ngOnInit() {} } diff --git a/src/app/pages/poll-display/poll-display.component.html b/src/app/pages/poll-display/poll-display.component.html index ea3f939e..ffc6c77f 100644 --- a/src/app/pages/poll-display/poll-display.component.html +++ b/src/app/pages/poll-display/poll-display.component.html @@ -1,87 +1,67 @@ -
- - + + - -
- -
-
- -
- - -
-
+
+ +
+
+
+ +
+
- -
-
- -
-
+ +
+
+ +
+
-
-
+
+
+ - -
-
-
-
- + (click)="config.print()" + /> +
+
+
+
+
No current poll available -
-
- -
+
+ + diff --git a/src/app/pages/poll-display/poll-display.component.scss b/src/app/pages/poll-display/poll-display.component.scss index 203768bc..5c133b95 100644 --- a/src/app/pages/poll-display/poll-display.component.scss +++ b/src/app/pages/poll-display/poll-display.component.scss @@ -1,3 +1 @@ -@import "../../../assets/scss/variables"; - - +@import '../../../assets/scss/variables'; diff --git a/src/app/pages/poll-display/poll-display.component.spec.ts b/src/app/pages/poll-display/poll-display.component.spec.ts index 456bbc09..3f6ff61c 100644 --- a/src/app/pages/poll-display/poll-display.component.spec.ts +++ b/src/app/pages/poll-display/poll-display.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { PollDisplayComponent } from './poll-display.component'; describe('PollDisplayComponent', () => { - let component: PollDisplayComponent; - let fixture: ComponentFixture; + let component: PollDisplayComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ PollDisplayComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [PollDisplayComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(PollDisplayComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(PollDisplayComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/poll-display/poll-display.component.ts b/src/app/pages/poll-display/poll-display.component.ts index a40d38a3..68a05dac 100644 --- a/src/app/pages/poll-display/poll-display.component.ts +++ b/src/app/pages/poll-display/poll-display.component.ts @@ -1,25 +1,22 @@ -import {Component, OnInit} from '@angular/core'; -import {BaseComponent} from "../base-page/base.component"; -import {ConfigService} from "../../services/config.service"; -import {mockComments} from "../../config/mocks/mock-comments"; -import {ActivatedRoute, Router} from "@angular/router"; -import {environment} from "../../../environments/environment"; -import {mockPoll3} from "../../config/mocks/mock-poll3"; +import { Component, OnInit } from '@angular/core'; +import { BaseComponent } from '../base-page/base.component'; +import { ConfigService } from '../../services/config.service'; +import { mockComments } from '../../config/mocks/mock-comments'; +import { ActivatedRoute, Router } from '@angular/router'; +import { environment } from '../../../environments/environment'; +import { mockPoll3 } from '../../config/mocks/mock-poll3'; @Component({ selector: 'framadate-poll-display', templateUrl: './poll-display.component.html', - styleUrls: ['./poll-display.component.scss'] + styleUrls: ['./poll-display.component.scss'], }) export class PollDisplayComponent extends BaseComponent implements OnInit { - comments = mockComments; - constructor(public config: ConfigService, - private router: Router, - public activeRoute: ActivatedRoute) { + constructor(public config: ConfigService, private router: Router, public activeRoute: ActivatedRoute) { super(config); - this.activeRoute.paramMap.subscribe(params => { + this.activeRoute.paramMap.subscribe((params) => { console.log('params', params); this.config.pollId = params.get('poll'); this.config.pollSlug = params.get('pollSlug'); @@ -29,10 +26,7 @@ export class PollDisplayComponent extends BaseComponent implements OnInit { }); } - ngOnInit() { - - } - + ngOnInit() {} // fetch poll with its ID or slug. fetchPoll() { @@ -52,10 +46,11 @@ export class PollDisplayComponent extends BaseComponent implements OnInit { console.log('res', res); this.config.updateCurrentPollFromResponse(res); this.config.loading = false; - }, (e) => { + }, + (e) => { // handle need for a password console.log('e', e); - this.config.handleError(e) + this.config.handleError(e); } ); } else if (pollSlug) { @@ -64,13 +59,12 @@ export class PollDisplayComponent extends BaseComponent implements OnInit { (res: any) => { this.config.loading = false; this.config.updateCurrentPollFromResponse(res); - }, (e) => { + }, + (e) => { // handle need for a password - this.config.handleError(e) + this.config.handleError(e); } ); } - } - } diff --git a/src/app/pages/resume/resume.component.html b/src/app/pages/resume/resume.component.html index e41da066..2cb5403d 100644 --- a/src/app/pages/resume/resume.component.html +++ b/src/app/pages/resume/resume.component.html @@ -1,113 +1,71 @@ -

+

Récapitulatif -

-
- -

- {{config.title}} -

-
+ +
+

+ {{ config.title }} +

+
créé par - - {{config.myName}} - -
-
- - {{config.description}} - -
-
-
    -
  • - image {{questions.url}} - {{questions.id + 1}}. {{questions.text}} -
  • -
-
-
- - - {{"dates.multiple.different"|translate}} - - - {{"dates.multiple.identical"|translate}} - -
-
- -
- {{choice.literal}} + + {{ config.myName }} + +
+
+ + {{ config.description }} + +
+
+
    +
  • + image {{ questions.url }} + {{ questions.id + 1 }}. {{ questions.text }} +
  • +
+
+
+ + + {{ 'dates.multiple.different' | translate }} + + + {{ 'dates.multiple.identical' | translate }} + +
+
+ +
+ {{ choice.literal }} -
- -
- {{idTime}}) - - {{time.literal}} -
- -
+
+
+ {{ idTime }}) + + {{ time.literal }} +
+
-
-
- - {{time.literal}} -
-
-
-
+
+
+ + {{ time.literal }} +
+
+
+ +
-
- - + - diff --git a/src/app/pages/resume/resume.component.spec.ts b/src/app/pages/resume/resume.component.spec.ts index 8d4824de..526fd3eb 100644 --- a/src/app/pages/resume/resume.component.spec.ts +++ b/src/app/pages/resume/resume.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ResumeComponent } from './resume.component'; describe('ResumeComponent', () => { - let component: ResumeComponent; - let fixture: ComponentFixture; + let component: ResumeComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ResumeComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ResumeComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(ResumeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(ResumeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/resume/resume.component.ts b/src/app/pages/resume/resume.component.ts index 97c84e6a..d02f8665 100644 --- a/src/app/pages/resume/resume.component.ts +++ b/src/app/pages/resume/resume.component.ts @@ -1,18 +1,15 @@ -import {Component} from '@angular/core'; -import {BaseComponent} from '../base-page/base.component'; -import {ConfigService} from '../../services/config.service'; -import {Router} from "@angular/router"; +import { Component } from '@angular/core'; +import { BaseComponent } from '../base-page/base.component'; +import { ConfigService } from '../../services/config.service'; +import { Router } from '@angular/router'; @Component({ selector: 'framadate-resume', templateUrl: './resume.component.html', - styleUrls: ['./resume.component.scss'] + styleUrls: ['./resume.component.scss'], }) export class ResumeComponent extends BaseComponent { - - constructor(public config: ConfigService, - private router: Router) { + constructor(public config: ConfigService, private router: Router) { super(config); } - } diff --git a/src/app/pages/visibility/visibility.component.html b/src/app/pages/visibility/visibility.component.html index 6404a5bd..5a168568 100644 --- a/src/app/pages/visibility/visibility.component.html +++ b/src/app/pages/visibility/visibility.component.html @@ -1,195 +1,163 @@ -

- {{"visibility.top_txt"|translate}} -

-
-

- {{"visibility.title"|translate}} -

- - {{"visibility.visibility_want"|translate}} - - - - {{"visibility.visibility_see"|translate}} - +

+ {{ 'visibility.top_txt' | translate }} +

+
+

+ {{ 'visibility.title' | translate }} +

+ + {{ 'visibility.visibility_want' | translate }} + + + + {{ 'visibility.visibility_see' | translate }} + +
-
+
+

+ {{ 'visibility.votes' | translate }} +

+ + +
+
+ -
-

- {{"visibility.votes"|translate}} -

- - -
-
- + +
+ - -
- - - - - {{"visibility.archiving_end_not"|translate}} + + + {{ 'visibility.archiving_end_not' | translate }} - + - - {{"visibility.modfiy_their"|translate}} - - + *ngIf="true == !!config.canModifyAnswers" + [(ngModel)]="config.whoModifiesAnswers" + [disabled]="false == !!config.canModifyAnswers" + > +
+
+
+

+ {{ 'visibility.access' | translate }} +

+ +
+ - + + {{ 'visibility.access_instructions' | translate }} + + +
+ + -
-
-

- {{"visibility.access"|translate}} -

- -
- + - - {{"visibility.access_instructions"|translate}} - - -
- - - - - -
+
+ [(ngModel)]="config.password" + /> + [(ngModel)]="config.password" + /> -
-
+ class="btn btn--default" + > + + {{ 'visibility.see_pass' | translate }} + + +
- + - diff --git a/src/app/pages/visibility/visibility.component.spec.ts b/src/app/pages/visibility/visibility.component.spec.ts index 8f03adaf..40697ee6 100644 --- a/src/app/pages/visibility/visibility.component.spec.ts +++ b/src/app/pages/visibility/visibility.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { VisibilityComponent } from './visibility.component'; describe('VisibilityComponent', () => { - let component: VisibilityComponent; - let fixture: ComponentFixture; + let component: VisibilityComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ VisibilityComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [VisibilityComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(VisibilityComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(VisibilityComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/visibility/visibility.component.ts b/src/app/pages/visibility/visibility.component.ts index 993a90fa..2c30308a 100644 --- a/src/app/pages/visibility/visibility.component.ts +++ b/src/app/pages/visibility/visibility.component.ts @@ -1,31 +1,32 @@ -import {Component, OnInit} from '@angular/core'; -import {BaseComponent} from '../base-page/base.component'; -import {ConfigService} from '../../services/config.service'; -import {environment} from "../../../environments/environment"; -import {PollUtilities} from "../../config/PollUtilities"; +import { Component, OnInit } from '@angular/core'; +import { BaseComponent } from '../base-page/base.component'; +import { ConfigService } from '../../services/config.service'; +import { environment } from '../../../environments/environment'; +import { PollUtilities } from '../../config/PollUtilities'; @Component({ selector: 'framadate-visibility', templateUrl: './visibility.component.html', - styleUrls: ['./visibility.component.scss'] + styleUrls: ['./visibility.component.scss'], }) export class VisibilityComponent extends BaseComponent implements OnInit { showCustomPassword = false; baseUrl = environment.baseApiHref; environment = environment; - constructor(public config: ConfigService, - public utils: PollUtilities) { + constructor(public config: ConfigService, public utils: PollUtilities) { super(config); } ngOnInit() { this.config.customUrl = this.utils.makeSlug(this.config); - this.config.expirationDate = (this.config.addDaysToDate(this.config.expiracyDateDefaultInDays, new Date())).toISOString().substring(0, 10); + this.config.expirationDate = this.config + .addDaysToDate(this.config.expiracyDateDefaultInDays, new Date()) + .toISOString() + .substring(0, 10); } submitCreationAndGoToEnd() { this.config.createPoll(); } - } diff --git a/src/app/pages/voting/choices-list/choices-list.component.html b/src/app/pages/voting/choices-list/choices-list.component.html index f265ecc9..bb3912e0 100644 --- a/src/app/pages/voting/choices-list/choices-list.component.html +++ b/src/app/pages/voting/choices-list/choices-list.component.html @@ -1,27 +1,26 @@ - -
-
- +
+
-
-
+ [poll]="config.currentPoll" + > +
+
+ class="btn btn-block submit-votestack" + (click)="config.addVote()" + [disabled]="!config.myTempVoteStack" + [ngClass]="{ 'btn--primary': config.myTempVoteStack }" + *ngIf="!config.myVoteStack || !config.myVoteStack.id" +> + Envoyer + + class="btn btn--primary btn-block submit-votestack update" + (click)="config.updateVote(config.myVoteStack)" + *ngIf="config.myVoteStack && config.myVoteStack.id" +> + Mettre à jour + diff --git a/src/app/pages/voting/choices-list/choices-list.component.spec.ts b/src/app/pages/voting/choices-list/choices-list.component.spec.ts index c4168392..add57469 100644 --- a/src/app/pages/voting/choices-list/choices-list.component.spec.ts +++ b/src/app/pages/voting/choices-list/choices-list.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChoicesListComponent } from './choices-list.component'; describe('ChoicesListComponent', () => { - let component: ChoicesListComponent; - let fixture: ComponentFixture; + let component: ChoicesListComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ChoicesListComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ChoicesListComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(ChoicesListComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(ChoicesListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/voting/choices-list/choices-list.component.ts b/src/app/pages/voting/choices-list/choices-list.component.ts index 6d415c65..13fd91d9 100644 --- a/src/app/pages/voting/choices-list/choices-list.component.ts +++ b/src/app/pages/voting/choices-list/choices-list.component.ts @@ -1,15 +1,11 @@ -import {Component} from '@angular/core'; -import {ConfigService} from "../../../services/config.service"; +import { Component } from '@angular/core'; +import { ConfigService } from '../../../services/config.service'; @Component({ selector: 'framadate-choices-list', templateUrl: './choices-list.component.html', - styleUrls: ['./choices-list.component.scss'] + styleUrls: ['./choices-list.component.scss'], }) export class ChoicesListComponent { - - constructor(public config: ConfigService) { - - } - + constructor(public config: ConfigService) {} } diff --git a/src/app/pages/voting/comments-list/comments-list.component.html b/src/app/pages/voting/comments-list/comments-list.component.html index 27b2e8a3..40d999cd 100644 --- a/src/app/pages/voting/comments-list/comments-list.component.html +++ b/src/app/pages/voting/comments-list/comments-list.component.html @@ -1,61 +1,34 @@ -
- - - - -
-
-

Laisser un commentaire

- - - - -
- -
- -
+
+ + + + +
+
+

Laisser un commentaire

+ + + + +
+ +
+ +
-
- - - -
-
+ (click)="config.addComment()" + /> +
+ + +
+
diff --git a/src/app/pages/voting/comments-list/comments-list.component.spec.ts b/src/app/pages/voting/comments-list/comments-list.component.spec.ts index 95b34b97..93a52f00 100644 --- a/src/app/pages/voting/comments-list/comments-list.component.spec.ts +++ b/src/app/pages/voting/comments-list/comments-list.component.spec.ts @@ -1,13 +1,13 @@ -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import {CommentsListComponent} from './comments-list.component'; -import {FormsModule} from "@angular/forms"; -import {HttpClient, HttpClientModule} from "@angular/common/http"; -import {BrowserModule} from "@angular/platform-browser"; -import {CommonModule} from "@angular/common"; -import {ConfirmationService, MessageService} from "primeng"; -import {Router} from "@angular/router"; -import {ConfigService} from "../../../services/config.service"; +import { CommentsListComponent } from './comments-list.component'; +import { FormsModule } from '@angular/forms'; +import { HttpClient, HttpClientModule } from '@angular/common/http'; +import { BrowserModule } from '@angular/platform-browser'; +import { CommonModule } from '@angular/common'; +import { ConfirmationService, MessageService } from 'primeng'; +import { Router } from '@angular/router'; +import { ConfigService } from '../../../services/config.service'; const routerSpy = jasmine.createSpyObj('Router', ['navigateByUrl']); @@ -17,18 +17,16 @@ describe('CommentsListComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - imports: [FormsModule, - BrowserModule, - CommonModule, - HttpClientModule], - declarations: [CommentsListComponent,] - , providers: [HttpClient, + imports: [FormsModule, BrowserModule, CommonModule, HttpClientModule], + declarations: [CommentsListComponent], + providers: [ + HttpClient, MessageService, ConfirmationService, ConfigService, - {provide: Router, useValue: routerSpy}] - }) - .compileComponents(); + { provide: Router, useValue: routerSpy }, + ], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/pages/voting/comments-list/comments-list.component.ts b/src/app/pages/voting/comments-list/comments-list.component.ts index 7ba3e09f..0bb6efd3 100644 --- a/src/app/pages/voting/comments-list/comments-list.component.ts +++ b/src/app/pages/voting/comments-list/comments-list.component.ts @@ -1,15 +1,11 @@ -import {Component} from '@angular/core'; -import {ConfigService} from "../../../services/config.service"; +import { Component } from '@angular/core'; +import { ConfigService } from '../../../services/config.service'; @Component({ selector: 'framadate-comments-list', templateUrl: './comments-list.component.html', - styleUrls: ['./comments-list.component.scss'] + styleUrls: ['./comments-list.component.scss'], }) export class CommentsListComponent { - - constructor(public config: ConfigService) { - - } - + constructor(public config: ConfigService) {} } diff --git a/src/app/pages/voting/voting-choice/voting-choice.component.html b/src/app/pages/voting/voting-choice/voting-choice.component.html index 53d04eec..45ff7627 100644 --- a/src/app/pages/voting/voting-choice/voting-choice.component.html +++ b/src/app/pages/voting/voting-choice/voting-choice.component.html @@ -1,171 +1,142 @@ -
+
+ *ngIf="showChangeChoicebutton" + class="btn btn--primary" + (click)="choice.simpleAnswer = !choice.simpleAnswer" + > + + -
-
-
-
- {{choice.text}} -
- - {{choice.url}} - + + {{ choice.url }} + - -
-
- {{choice.date.date | date:'EEE'}} {{choice.date.date | date:'dd'}} {{choice.date.date | date:'LLL'}} -
-
- {{choice.date.date | date:'H:m'}} -
-
- -
-
-
+ +
+
+ {{ choice.date.date | date: 'EEE' }} + {{ choice.date.date | date: 'dd' }} + {{ choice.date.date | date: 'LLL' }} +
+
+ {{ choice.date.date | date: 'H:m' }} +
+
+ +
+
+
- - - - - - - - - -
-
-
-
- -
+ + + + + + + +
+
+
+
+
aucun vote -
+
-
+ alt="" + /> + {{ poll.choices_count.counts[choice.id].maybe.count }} "Peut-être" +
+
    +
  • + {{ pseudo }} +
  • +
+
+
+
+ + {{ poll.choices_count.counts[choice.id].no.count }} "Non" +
+
    +
  • + {{ pseudo }} +
  • +
+
+
+ +
Choix ayant reçu le plus de votes -
-
-
-
- -
- -
+ + + + + + diff --git a/src/app/pages/voting/voting-choice/voting-choice.component.scss b/src/app/pages/voting/voting-choice/voting-choice.component.scss index 6bbc4504..e970f4df 100644 --- a/src/app/pages/voting/voting-choice/voting-choice.component.scss +++ b/src/app/pages/voting/voting-choice/voting-choice.component.scss @@ -5,14 +5,13 @@ // -- IMPORTS // ---------------------------- -@import "../../../../assets/scss/variables"; - +@import '../../../../assets/scss/variables'; // -- VARIABLES // ---------------------------- $box-padding: 2rem; -$box-border-width: .6rem; +$box-border-width: 0.6rem; $btn-size: 5rem; $btn-margin-x: 1rem; $btn-margin-y: 1.5rem; @@ -20,7 +19,6 @@ $btn-wrap-size: calc(2 * #{$btn-size} + 4 * #{$btn-margin-x}); $img-maxheight: 12rem; $breakpoint-responsive: 640px; // à définir - // -- GLOBAL // ---------------------------- @@ -32,7 +30,7 @@ $breakpoint-responsive: 640px; // à définir padding: $box-padding $box-padding $box-padding calc(#{$box-padding} - #{$box-border-width}); border-left: $box-border-width solid transparent; background-color: $white; - box-shadow: 0 0 .6rem 0 rgba($black, .2); + box-shadow: 0 0 0.6rem 0 rgba($black, 0.2); &--active { padding-left: $box-padding; @@ -54,13 +52,12 @@ $breakpoint-responsive: 640px; // à définir } } - // -- DATE // ---------------------------- .choicebox__date { font-size: 1.8rem; - margin-bottom: .5rem; + margin-bottom: 0.5rem; white-space: nowrap; text-transform: capitalize; @@ -74,7 +71,6 @@ $breakpoint-responsive: 640px; // à définir font-weight: bold; } - // -- IMG // ---------------------------- @@ -83,7 +79,6 @@ $breakpoint-responsive: 640px; // à définir max-height: $img-maxheight; } - // -- TXT // ---------------------------- @@ -93,7 +88,6 @@ $breakpoint-responsive: 640px; // à définir min-width: 10em; } - // -- VOTE BTNS // ---------------------------- @@ -119,7 +113,7 @@ $breakpoint-responsive: 640px; // à définir align-items: center; justify-content: center; margin: $btn-margin-y $btn-margin-x; - border: .3rem solid #ccc9c9; + border: 0.3rem solid #ccc9c9; background-color: transparent; border-radius: 50%; cursor: pointer; @@ -133,24 +127,22 @@ $breakpoint-responsive: 640px; // à définir left: auto; } } - &:focus, &:active { + &:focus, + &:active { border-color: #bf83c2; color: #bf83c2; background: #000; } &--active { border-color: #bf83c2; - } @media (min-width: $breakpoint-responsive) { margin-top: 0; margin-bottom: 0; } - } - // -- VOTE COUNT // ---------------------------- @@ -184,7 +176,7 @@ $breakpoint-responsive: 640px; // à définir .choicebox__countxt { display: none; - margin-top: .5rem; + margin-top: 0.5rem; .choicebox--active & { display: block; @@ -194,7 +186,6 @@ $breakpoint-responsive: 640px; // à définir } } - // -- TOOLTIP // ---------------------------- @@ -208,7 +199,7 @@ $breakpoint-responsive: 640px; // à définir left: 50%; z-index: 1; padding: 2rem; - border: .1rem solid rgba($black, .1); + border: 0.1rem solid rgba($black, 0.1); background-color: $white; text-align: left; transform: translateX(-50%); @@ -219,7 +210,7 @@ $breakpoint-responsive: 640px; // à définir height: 0; bottom: 100%; left: 50%; - content: " "; + content: ' '; pointer-events: none; border: solid transparent; } @@ -233,7 +224,7 @@ $breakpoint-responsive: 640px; // à définir margin-left: -1.6rem; border-width: 1.6rem; border-color: rgba($black, 0); - border-bottom-color: rgba($black, .1); + border-bottom-color: rgba($black, 0.1); } ul { margin: 0; @@ -261,7 +252,7 @@ $breakpoint-responsive: 640px; // à définir font-weight: bold; white-space: nowrap; img { - margin-right: .5rem; + margin-right: 0.5rem; vertical-align: sub; } & ~ .choicebox__tooltipttl { diff --git a/src/app/pages/voting/voting-choice/voting-choice.component.spec.ts b/src/app/pages/voting/voting-choice/voting-choice.component.spec.ts index 92d89829..9d416f5a 100644 --- a/src/app/pages/voting/voting-choice/voting-choice.component.spec.ts +++ b/src/app/pages/voting/voting-choice/voting-choice.component.spec.ts @@ -1,14 +1,14 @@ -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import {FormsModule} from "@angular/forms"; -import {HttpClient, HttpClientModule} from "@angular/common/http"; -import {BrowserModule} from "@angular/platform-browser"; -import {CommonModule} from "@angular/common"; -import {ConfirmationService, MessageService} from "primeng"; -import {Router} from "@angular/router"; -import {ConfigService} from "../../../services/config.service"; -import {VotingChoiceComponent} from './voting-choice.component'; -import {mockChoice} from "../../../config/mocks/choice"; -import {mockPoll3} from "../../../config/mocks/mock-poll3"; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { FormsModule } from '@angular/forms'; +import { HttpClient, HttpClientModule } from '@angular/common/http'; +import { BrowserModule } from '@angular/platform-browser'; +import { CommonModule } from '@angular/common'; +import { ConfirmationService, MessageService } from 'primeng'; +import { Router } from '@angular/router'; +import { ConfigService } from '../../../services/config.service'; +import { VotingChoiceComponent } from './voting-choice.component'; +import { mockChoice } from '../../../config/mocks/choice'; +import { mockPoll3 } from '../../../config/mocks/mock-poll3'; const routerSpy = jasmine.createSpyObj('Router', ['navigateByUrl']); @@ -18,24 +18,22 @@ describe('VotingChoiceComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - imports: [FormsModule, - BrowserModule, - CommonModule, - HttpClientModule], - declarations: [VotingChoiceComponent] - , providers: [HttpClient, + imports: [FormsModule, BrowserModule, CommonModule, HttpClientModule], + declarations: [VotingChoiceComponent], + providers: [ + HttpClient, MessageService, ConfirmationService, ConfigService, - {provide: Router, useValue: routerSpy}] - }) - .compileComponents(); + { provide: Router, useValue: routerSpy }, + ], + }).compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(VotingChoiceComponent); component = fixture.componentInstance; - component.choice = {...mockChoice}; + component.choice = { ...mockChoice }; component.choices_count = mockPoll3.choices_count; component.choice_id = mockChoice.id; component.poll = mockPoll3.poll; @@ -76,7 +74,6 @@ describe('VotingChoiceComponent', () => { expect(component.choice.answer).toBe('no'); }); it('should consider to have simple answer when allowedAnswers is only one answer long, which is yes', () => { - expect(component.poll.allowedAnswers[0]).toBe('yes'); expect(component.poll.allowedAnswers.length).toBe(1); expect(component.simpleAnswer).toBeTruthy(); diff --git a/src/app/pages/voting/voting-choice/voting-choice.component.ts b/src/app/pages/voting/voting-choice/voting-choice.component.ts index e954c467..4ec87aa1 100644 --- a/src/app/pages/voting/voting-choice/voting-choice.component.ts +++ b/src/app/pages/voting/voting-choice/voting-choice.component.ts @@ -1,17 +1,17 @@ -import {Component, ElementRef, Input} from '@angular/core'; -import {ConfigService} from "../../../services/config.service"; +import { Component, ElementRef, Input } from '@angular/core'; +import { ConfigService } from '../../../services/config.service'; interface VoteChoice { votes?: { - yes: number - no: number - maybe: number - notAnswered: number + yes: number; + no: number; + maybe: number; + notAnswered: number; }; name?: string; date?: Date; answer: 'yes' | 'no' | 'maybe' | null; - simpleAnswer?: boolean + simpleAnswer?: boolean; false; // enable if we display only a togglable "yes" } @@ -22,10 +22,9 @@ interface VoteChoice { @Component({ selector: 'framadate-voting-choice', templateUrl: './voting-choice.component.html', - styleUrls: ['./voting-choice.component.scss'] + styleUrls: ['./voting-choice.component.scss'], }) export class VotingChoiceComponent { - public showChangeChoicebutton = false; @Input() public choice: any; @Input() public choices_count: any; @@ -34,11 +33,9 @@ export class VotingChoiceComponent { @Input() public simpleAnswer: boolean = true; @Input() public pollIsSpecialDate: boolean = false; - constructor(private el: ElementRef, - private config: ConfigService) { - + constructor(private el: ElementRef, private config: ConfigService) { if (this.poll && this.poll.allowedAnswers) { - this.simpleAnswer = this.poll.allowedAnswers.length == 1 + this.simpleAnswer = this.poll.allowedAnswers.length == 1; } } @@ -52,7 +49,6 @@ export class VotingChoiceComponent { this.choice.answer = newAnswer; this.config.myTempVoteStack++; } - } else { this.choice.answer = newAnswer; if (this.choice.answer !== newAnswer) { @@ -60,11 +56,9 @@ export class VotingChoiceComponent { this.config.myTempVoteStack++; } } else { - console.info('same answer as before') + console.info('same answer as before'); } - } this.el.nativeElement.blur(); } - } diff --git a/src/app/pages/voting/voting-comment/voting-comment.component.html b/src/app/pages/voting/voting-comment/voting-comment.component.html index ba135be9..57feca46 100644 --- a/src/app/pages/voting/voting-comment/voting-comment.component.html +++ b/src/app/pages/voting/voting-comment/voting-comment.component.html @@ -1,13 +1,11 @@ -
- - {{comment.pseudo}} - , le - - {{comment.date.date }} - -
-

- {{comment.text}} -

-
-
+
+ {{ comment.pseudo }} , le + + {{ comment.date.date }} + +
+

+ {{ comment.text }} +

+
+
diff --git a/src/app/pages/voting/voting-comment/voting-comment.component.spec.ts b/src/app/pages/voting/voting-comment/voting-comment.component.spec.ts index 03acbaa3..82de76c4 100644 --- a/src/app/pages/voting/voting-comment/voting-comment.component.spec.ts +++ b/src/app/pages/voting/voting-comment/voting-comment.component.spec.ts @@ -1,6 +1,6 @@ -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import {VotingCommentComponent} from './voting-comment.component'; +import { VotingCommentComponent } from './voting-comment.component'; describe('VotingCommentComponent', () => { let component: VotingCommentComponent; @@ -8,9 +8,8 @@ describe('VotingCommentComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [VotingCommentComponent] - }) - .compileComponents(); + declarations: [VotingCommentComponent], + }).compileComponents(); })); beforeEach(() => { 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 64b36ce4..bf66f443 100644 --- a/src/app/pages/voting/voting-comment/voting-comment.component.ts +++ b/src/app/pages/voting/voting-comment/voting-comment.component.ts @@ -1,19 +1,15 @@ -import {Component, Input, OnInit} from '@angular/core'; -import {mockComments} from "../../../config/mocks/mock-comments"; +import { Component, Input, OnInit } from '@angular/core'; +import { mockComments } from '../../../config/mocks/mock-comments'; @Component({ selector: 'framadate-voting-comment', templateUrl: './voting-comment.component.html', - styleUrls: ['./voting-comment.component.scss'] + styleUrls: ['./voting-comment.component.scss'], }) export class VotingCommentComponent implements OnInit { - @Input() comment = mockComments[0]; - constructor() { - } - - ngOnInit() { - } + constructor() {} + ngOnInit() {} } diff --git a/src/app/pages/voting/voting-graph/voting-graph.component.spec.ts b/src/app/pages/voting/voting-graph/voting-graph.component.spec.ts index b7c6b312..3bb55d83 100644 --- a/src/app/pages/voting/voting-graph/voting-graph.component.spec.ts +++ b/src/app/pages/voting/voting-graph/voting-graph.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { VotingGraphComponent } from './voting-graph.component'; describe('VotingGraphComponent', () => { - let component: VotingGraphComponent; - let fixture: ComponentFixture; + let component: VotingGraphComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ VotingGraphComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [VotingGraphComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(VotingGraphComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(VotingGraphComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/voting/voting-graph/voting-graph.component.ts b/src/app/pages/voting/voting-graph/voting-graph.component.ts index 164af760..7cc3da6a 100644 --- a/src/app/pages/voting/voting-graph/voting-graph.component.ts +++ b/src/app/pages/voting/voting-graph/voting-graph.component.ts @@ -1,19 +1,16 @@ import { Component, OnInit } from '@angular/core'; -import {BaseComponent} from "../../base-page/base.component"; -import {ConfigService} from "../../../services/config.service"; +import { BaseComponent } from '../../base-page/base.component'; +import { ConfigService } from '../../../services/config.service'; @Component({ - selector: 'framadate-voting-graph', - templateUrl: './voting-graph.component.html', - styleUrls: ['./voting-graph.component.scss'] + selector: 'framadate-voting-graph', + templateUrl: './voting-graph.component.html', + styleUrls: ['./voting-graph.component.scss'], }) export class VotingGraphComponent extends BaseComponent implements OnInit { - constructor(public config: ConfigService) { super(config); } - ngOnInit() { - } - + ngOnInit() {} } diff --git a/src/app/pages/voting/voting-navigation/voting-navigation.component.html b/src/app/pages/voting/voting-navigation/voting-navigation.component.html index e8b48546..50864a4f 100644 --- a/src/app/pages/voting/voting-navigation/voting-navigation.component.html +++ b/src/app/pages/voting/voting-navigation/voting-navigation.component.html @@ -1,34 +1,31 @@ - diff --git a/src/app/pages/voting/voting-navigation/voting-navigation.component.spec.ts b/src/app/pages/voting/voting-navigation/voting-navigation.component.spec.ts index 1626cc28..42ac04e9 100644 --- a/src/app/pages/voting/voting-navigation/voting-navigation.component.spec.ts +++ b/src/app/pages/voting/voting-navigation/voting-navigation.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { VotingNavigationComponent } from './voting-navigation.component'; describe('VotingNavigationComponent', () => { - let component: VotingNavigationComponent; - let fixture: ComponentFixture; + let component: VotingNavigationComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ VotingNavigationComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [VotingNavigationComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(VotingNavigationComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(VotingNavigationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/voting/voting-navigation/voting-navigation.component.ts b/src/app/pages/voting/voting-navigation/voting-navigation.component.ts index 5cd81980..d8e202cc 100644 --- a/src/app/pages/voting/voting-navigation/voting-navigation.component.ts +++ b/src/app/pages/voting/voting-navigation/voting-navigation.component.ts @@ -1,14 +1,11 @@ -import {Component} from '@angular/core'; -import {ConfigService} from "../../../services/config.service"; +import { Component } from '@angular/core'; +import { ConfigService } from '../../../services/config.service'; @Component({ selector: 'framadate-voting-navigation', templateUrl: './voting-navigation.component.html', - styleUrls: ['./voting-navigation.component.scss'] + styleUrls: ['./voting-navigation.component.scss'], }) export class VotingNavigationComponent { - - constructor(public config: ConfigService) { - } - + constructor(public config: ConfigService) {} } diff --git a/src/app/pages/voting/voting-summary/voting-summary.component.html b/src/app/pages/voting/voting-summary/voting-summary.component.html index 4a499571..df5569fc 100644 --- a/src/app/pages/voting/voting-summary/voting-summary.component.html +++ b/src/app/pages/voting/voting-summary/voting-summary.component.html @@ -1,138 +1,122 @@ -

Résumé

-
-
-

{{config.currentPoll.poll.title}}

-

{{config.currentPoll.poll.description}}

- - Créé le {{config.currentPoll.poll.creationDate.date}} - - - Expire le {{config.currentPoll.poll.expiracyDate.date}} - -
- - {{config.currentPoll.stacks.length}} votants, - {{config.currentPoll.choices.length}} choix, -
-
-
-
- +

Résumé

+
+
+

{{ config.currentPoll.poll.title }}

+

{{ config.currentPoll.poll.description }}

+ Créé le {{ config.currentPoll.poll.creationDate.date }} + Expire le {{ config.currentPoll.poll.expiracyDate.date }} +
+ + {{ config.currentPoll.stacks.length }} votants, {{ config.currentPoll.choices.length }} choix, +
+
+
+
+ Pour l'instant, - + les - + + le - - choix ayant reçu le plus grand nombre de votes ( {{config.currentPoll.choices_count.maxScore}} points ) - + + choix ayant reçu le plus grand nombre de votes ( {{ config.currentPoll.choices_count.maxScore }} points ) + sont à égalité - + + est - + : - - {{preferred}} - -
- - - - - + + + + +
- Pseudo - + {{ preferred }} + + + + + + + + + + + + + + + + + + + + + + + - - + + +
+ + + + + + - + + - title='somme des points, dont un demi point pour les "peut être"' > - - - - - - - - - - - - - - - - - - - -
+ Pseudo + + {{ choice.text }} +
points + {{ pollconfig.choices_count.counts[this.pollconfig.choices[2].id].score }} +
+ + + id: {{ choice.id }} +
+ + + + - > - {{choice.text}} -
+ - -
- points - - {{pollconfig.choices_count.counts[this.pollconfig.choices[2].id].score}} -
- - - id: {{choice.id}} -
- - - - - - - -
- - - -
- - - - - {{voteStack.pseudo}} - - - - yes - yes - -
+ {{ voteStack.pseudo }} +
+ + yes + yes + +
+ -
-

+ [transitionOptions]="'200ms'" +> +
+

Participation validée ! -

-

- Votre vote a bien été pris en compte, mais faites attention, ce sondage n'autorise - l'édition de votre vote qu'avec le lien personnalisé suivant : -

-
- {{config.urlAdmin}} - -
-

Conservez-le précieusement !

-
+

+

+ Votre vote a bien été pris en compte, mais faites attention, ce sondage n'autorise l'édition de votre vote + qu'avec le lien personnalisé suivant : +

+
+ {{ config.urlAdmin }} + +
+

Conservez-le précieusement !

+
-
- -
+ (click)="config.displayConfirmVoteModalAdmin = false" + label="Revenir au sondage" + class="btn btn--primary btn--default btn--purple btn--black-text" + > +
+ diff --git a/src/app/pages/voting/voting-summary/voting-summary.component.scss b/src/app/pages/voting/voting-summary/voting-summary.component.scss index 5b75f96c..e99ff015 100644 --- a/src/app/pages/voting/voting-summary/voting-summary.component.scss +++ b/src/app/pages/voting/voting-summary/voting-summary.component.scss @@ -1,4 +1,4 @@ -@import "../../../../assets/scss/variables"; +@import '../../../../assets/scss/variables'; .person { font-weight: 700; diff --git a/src/app/pages/voting/voting-summary/voting-summary.component.spec.ts b/src/app/pages/voting/voting-summary/voting-summary.component.spec.ts index e4d956d9..87834781 100644 --- a/src/app/pages/voting/voting-summary/voting-summary.component.spec.ts +++ b/src/app/pages/voting/voting-summary/voting-summary.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { VotingSummaryComponent } from './voting-summary.component'; describe('VotingSummaryComponent', () => { - let component: VotingSummaryComponent; - let fixture: ComponentFixture; + let component: VotingSummaryComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ VotingSummaryComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [VotingSummaryComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(VotingSummaryComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(VotingSummaryComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); 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 9bf1614f..137fb41f 100644 --- a/src/app/pages/voting/voting-summary/voting-summary.component.ts +++ b/src/app/pages/voting/voting-summary/voting-summary.component.ts @@ -1,29 +1,26 @@ -import {Component, Input, OnInit} from '@angular/core'; -import {ConfigService} from "../../../services/config.service"; -import {mockPoll3} from "../../../config/mocks/mock-poll3"; +import { Component, Input, OnInit } from '@angular/core'; +import { ConfigService } from '../../../services/config.service'; +import { mockPoll3 } from '../../../config/mocks/mock-poll3'; @Component({ selector: 'framadate-voting-summary', templateUrl: './voting-summary.component.html', - styleUrls: ['./voting-summary.component.scss'] + styleUrls: ['./voting-summary.component.scss'], }) export class VotingSummaryComponent implements OnInit { - preferred: string = 'rien'; severalPreferred: boolean = false; @Input() pollconfig = mockPoll3; - constructor(public config: ConfigService) { - - } + constructor(public config: ConfigService) {} ngOnInit() { this.computePreferred(); - } + } getKeys(obj) { - return Object.keys(obj) + return Object.keys(obj); } /** @@ -35,21 +32,18 @@ export class VotingSummaryComponent implements OnInit { this.severalPreferred = false; let maxScore = this.pollconfig.choices_count.maxScore; - keys.forEach(item => { + keys.forEach((item) => { if (maxScore === this.pollconfig.choices_count.counts[item].score) { if (this.preferred.length) { - this.preferred += ', ' + this.preferred += ', '; this.severalPreferred = true; } // find the favourite this.preferred += this.pollconfig.choices_count.counts[item].choice_text; } - }); - } - showModalDialog() { this.config.displayConfirmVoteModalAdmin = true; } diff --git a/src/app/pages/voting/voting.component.html b/src/app/pages/voting/voting.component.html index 520a9908..d6bc7ce8 100644 --- a/src/app/pages/voting/voting.component.html +++ b/src/app/pages/voting/voting.component.html @@ -1,6 +1,4 @@
- -

Les commentaires

@@ -9,9 +7,4 @@ le 26 novembre 2019 Rock Luxio Surskit. Glacier Badge

- - - -
- diff --git a/src/app/pages/voting/voting.component.spec.ts b/src/app/pages/voting/voting.component.spec.ts index 8a0a0c2c..18ef8889 100644 --- a/src/app/pages/voting/voting.component.spec.ts +++ b/src/app/pages/voting/voting.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { VotingComponent } from './voting.component'; describe('VotingComponent', () => { - let component: VotingComponent; - let fixture: ComponentFixture; + let component: VotingComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ VotingComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [VotingComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(VotingComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(VotingComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/pages/voting/voting.component.ts b/src/app/pages/voting/voting.component.ts index f99c6102..dee7b36a 100644 --- a/src/app/pages/voting/voting.component.ts +++ b/src/app/pages/voting/voting.component.ts @@ -1,16 +1,13 @@ import { Component, OnInit } from '@angular/core'; @Component({ - selector: 'framadate-voting', - templateUrl: './voting.component.html', - styleUrls: ['./voting.component.scss'] + selector: 'framadate-voting', + templateUrl: './voting.component.html', + styleUrls: ['./voting.component.scss'], }) export class VotingComponent implements OnInit { - show_mask=true; - constructor() { - } - - ngOnInit() { - } + show_mask = true; + constructor() {} + ngOnInit() {} } diff --git a/src/app/poll-graphic/poll-graphic.component.html b/src/app/poll-graphic/poll-graphic.component.html index ca6c13e6..6fe16e72 100644 --- a/src/app/poll-graphic/poll-graphic.component.html +++ b/src/app/poll-graphic/poll-graphic.component.html @@ -6,24 +6,19 @@ (change)="toggleColorblind()" class="input" > - - - - -{{ "pollGraphic.colorblindText" | translate }} - -
+ + + + + {{ 'pollGraphic.colorblindText' | translate }} + +
work in progress to link data with poll config -
-
- -
- - +
+
+ +
diff --git a/src/app/poll-graphic/poll-graphic.component.spec.ts b/src/app/poll-graphic/poll-graphic.component.spec.ts index ed5118d3..a914105c 100644 --- a/src/app/poll-graphic/poll-graphic.component.spec.ts +++ b/src/app/poll-graphic/poll-graphic.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { PollGraphicComponent } from './poll-graphic.component'; describe('PollGraphicComponent', () => { - let component: PollGraphicComponent; - let fixture: ComponentFixture; + let component: PollGraphicComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ PollGraphicComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [PollGraphicComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(PollGraphicComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(PollGraphicComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/poll-graphic/poll-graphic.component.ts b/src/app/poll-graphic/poll-graphic.component.ts index 9568935b..37283a66 100644 --- a/src/app/poll-graphic/poll-graphic.component.ts +++ b/src/app/poll-graphic/poll-graphic.component.ts @@ -1,60 +1,58 @@ -import {Component, Inject, OnInit} from "@angular/core"; -import {Chart} from "chart.js"; -import {DOCUMENT} from '@angular/common'; -import {mockGraphConfig} from "../config/mocks/mock-graph"; -import {graphOptions} from "../config/graph-canevas-options"; -import {ConfigService} from "../services/config.service"; -import {mockPoll3} from "../config/mocks/mock-poll3"; +import { Component, Inject, OnInit } from '@angular/core'; +import { Chart } from 'chart.js'; +import { DOCUMENT } from '@angular/common'; +import { mockGraphConfig } from '../config/mocks/mock-graph'; +import { graphOptions } from '../config/graph-canevas-options'; +import { ConfigService } from '../services/config.service'; +import { mockPoll3 } from '../config/mocks/mock-poll3'; @Component({ - selector: "framadate-poll-graphic", - templateUrl: "./poll-graphic.component.html", - styleUrls: ["./poll-graphic.component.scss"] + selector: 'framadate-poll-graphic', + templateUrl: './poll-graphic.component.html', + styleUrls: ['./poll-graphic.component.scss'], }) export class PollGraphicComponent implements OnInit { isColorblind: boolean = false; pollConfigRetrieved: any = mockPoll3; graphicConfig: any = mockGraphConfig; - preferred: any = "rien"; + preferred: any = 'rien'; yesList: number[] = []; maybeList: number[] = []; noList: number[] = []; nbPoll: number = 0; dateList: string[] = []; - constructor(@Inject(DOCUMENT) private document: any, - private config: ConfigService) { - } + constructor(@Inject(DOCUMENT) private document: any, private config: ConfigService) {} ngOnInit() { this.formatDataAnswers(this.graphicConfig); this.isColorblind = false; - this.pollConfigRetrieved = new Chart(this.document.getElementById("graph"), { - type: "horizontalBar", + this.pollConfigRetrieved = new Chart(this.document.getElementById('graph'), { + type: 'horizontalBar', data: { - labels: this.pollConfigRetrieved.choices.map(choice => choice.name), + labels: this.pollConfigRetrieved.choices.map((choice) => choice.name), datasets: [ { - type: "horizontalBar", - stack: "Yes", - backgroundColor: "#429a00", - data: this.yesList + type: 'horizontalBar', + stack: 'Yes', + backgroundColor: '#429a00', + data: this.yesList, }, { - type: "horizontalBar", - stack: "Yes", - backgroundColor: "#f5a623", - data: this.maybeList + type: 'horizontalBar', + stack: 'Yes', + backgroundColor: '#f5a623', + data: this.maybeList, }, { - type: "horizontalBar", - stack: "No", - backgroundColor: "#cd0000", - data: this.noList - } - ] + type: 'horizontalBar', + stack: 'No', + backgroundColor: '#cd0000', + data: this.noList, + }, + ], }, - options: graphOptions + options: graphOptions, }); } @@ -65,15 +63,15 @@ export class PollGraphicComponent implements OnInit { formatDataAnswers(poll) { // if (poll && poll.pollType === "date") { this.initPollCounter(); - poll.answers.forEach(response => { + poll.answers.forEach((response) => { switch (response.text) { - case "yes": + case 'yes': this.yesList[this.nbPoll - 1]++; break; - case "maybe": + case 'maybe': this.maybeList[this.nbPoll - 1]++; break; - case "no": + case 'no': this.noList[this.nbPoll - 1]++; break; } @@ -83,7 +81,7 @@ export class PollGraphicComponent implements OnInit { initPollCounter() { this.nbPoll++; - this.dateList[this.nbPoll - 1] = "jeudi"; + this.dateList[this.nbPoll - 1] = 'jeudi'; this.maybeList[this.nbPoll - 1] = 0; this.yesList[this.nbPoll - 1] = 0; this.noList[this.nbPoll - 1] = 0; diff --git a/src/app/services/config.service.ts b/src/app/services/config.service.ts index 79b3ce89..838117da 100644 --- a/src/app/services/config.service.ts +++ b/src/app/services/config.service.ts @@ -1,13 +1,13 @@ -import {Injectable} from '@angular/core'; -import {PollConfig} from '../config/PollConfig'; -import {HttpClient} from '@angular/common/http'; -import {environment} from '../../environments/environment'; -import {ConfirmationService, MessageService} from 'primeng/api'; -import {Router} from '@angular/router'; -import {mockMyPolls} from '../config/mocks/mockmypolls'; -import {mockPoll3} from '../config/mocks/mock-poll3'; -import {mockSuccessVote} from '../config/mocks/mock-success-vote'; -import {PollUtilities} from '../config/PollUtilities'; +import { Injectable } from '@angular/core'; +import { PollConfig } from '../config/PollConfig'; +import { HttpClient } from '@angular/common/http'; +import { environment } from '../../environments/environment'; +import { ConfirmationService, MessageService } from 'primeng/api'; +import { Router } from '@angular/router'; +import { mockMyPolls } from '../config/mocks/mockmypolls'; +import { mockPoll3 } from '../config/mocks/mock-poll3'; +import { mockSuccessVote } from '../config/mocks/mock-success-vote'; +import { PollUtilities } from '../config/PollUtilities'; const LocalstoragePreferences = { themeName: 'light-watermelon', @@ -20,21 +20,19 @@ const LocalstoragePreferences = { * le service transverse à chaque page qui permet de syncroniser la configuration de sondage souhaitée */ @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ConfigService extends PollConfig { - - preferences: any = LocalstoragePreferences; // user specific preferences, stored in localstorage, used for theme. loading = false; baseHref: any = environment.baseApiHref; - - constructor(private http: HttpClient, - private messageService: MessageService, - private router: Router, - private utils: PollUtilities, - private confirmationService: ConfirmationService, + constructor( + private http: HttpClient, + private messageService: MessageService, + private router: Router, + private utils: PollUtilities, + private confirmationService: ConfirmationService ) { super(); this.fillValuesOnDevEnv(); @@ -47,7 +45,6 @@ export class ConfigService extends PollConfig { // fill in mock values if we are not in production environment fillValuesOnDevEnv() { - if (!environment.production) { console.info(' ######### framadate ######### we are not in production env, filling with mock values'); this.currentPoll = mockPoll3; @@ -64,11 +61,9 @@ export class ConfigService extends PollConfig { const preferences = storage.getItem('FramadateConfig'); if (preferences) { - const parsed = JSON.parse(preferences); console.log('parsed', parsed); this.preferences = parsed; - } } else { console.error('pas de localstorage'); @@ -78,17 +73,13 @@ export class ConfigService extends PollConfig { } setPreference(key, value) { - if (this.preferences) { - this.preferences[key] = value; if (key === 'themeName' && this.themeChoices.includes(value)) { this.themeSelected = this.themeChoices.indexOf(value); - this.preferences.themeClass = - this.themeClass = `theme-${value}`; + this.preferences.themeClass = this.themeClass = `theme-${value}`; } this.saveLocalStoragePreferences(); - } } @@ -101,7 +92,6 @@ export class ConfigService extends PollConfig { } } - /** * add some days to a date, to compute intervals * @param days @@ -111,7 +101,7 @@ export class ConfigService extends PollConfig { date = new Date(date.valueOf()); date.setDate(date.getDate() + days); return date; - }; + } /** ================================== * @@ -148,7 +138,6 @@ export class ConfigService extends PollConfig { return jsonConfig; } - checkIfSlugIsUniqueInDatabase(slug: string = '') { this.customUrlIsUnique = null; if (!slug) { @@ -158,16 +147,15 @@ export class ConfigService extends PollConfig { this.loading = true; // TODO this.todo('check slug is unique'); - this.http.get(`${this.baseHref}/check-slug-is-uniq/${slug}`, - this.utils.makeHeaders({slug: this.customUrl}), - ) - .subscribe((res: any) => { - + this.http + .get(`${this.baseHref}/check-slug-is-uniq/${slug}`, this.utils.makeHeaders({ slug: this.customUrl })) + .subscribe( + (res: any) => { this.customUrlIsUnique = res.poll.isUnique; this.loading = false; }, - (e) => this.handleError(e)) - ; + (e) => this.handleError(e) + ); } /** @@ -175,34 +163,30 @@ export class ConfigService extends PollConfig { * @param email */ findPollsByEmail(email: string) { - this.findLocalStorageData(); // If no key is found in the localstorage, ask the backend to send an email to the user this.myEmail = email; - this.todo('send email for real : TODO'); this.loading = true; - this.http.get(`${this.baseHref}/send-polls-to-user/${this.myEmail}`, - this.utils.makeHeaders(), - ) - .subscribe(res => { - // message: 'Trouvé! Allez voir votre boite email', - this.myPolls = res; - this.loading = false; - this.messageService.add({ - severity: 'success', - summary: 'Succès', - detail: `Vos infos de sondages vous ont été transmises. Allez voir votre boite email ${this.myEmail}` - }); - }, (e) => { - this.handleError(e); - } - ); + this.http.get(`${this.baseHref}/send-polls-to-user/${this.myEmail}`, this.utils.makeHeaders()).subscribe( + (res) => { + // message: 'Trouvé! Allez voir votre boite email', + this.myPolls = res; + this.loading = false; + this.messageService.add({ + severity: 'success', + summary: 'Succès', + detail: `Vos infos de sondages vous ont été transmises. Allez voir votre boite email ${this.myEmail}`, + }); + }, + (e) => { + this.handleError(e); + } + ); } - /** * display error message depending on the response of the backend * @param err @@ -210,10 +194,9 @@ export class ConfigService extends PollConfig { handleError(err: any) { console.error('err', err); this.loading = false; - this.messageService.add({severity: 'warning', summary: 'Erreur lors de l\'appel ', detail: err.message}); + this.messageService.add({ severity: 'warning', summary: "Erreur lors de l'appel ", detail: err.message }); } - findLocalStorageData() { // TODO check if the person has a key to retrieve her polls console.log('localStorage', localStorage); @@ -222,13 +205,11 @@ export class ConfigService extends PollConfig { } } - /** * get one poll by its slug name * @param url */ getPollByURL(url: string) { - this.todo(); return this.http.get(`${this.baseHref}/poll/slug/${url}`, this.utils.makeHeaders()); } @@ -239,10 +220,7 @@ export class ConfigService extends PollConfig { * @param id */ getPollById(id: string, password?: string) { - - return this.http - .get(`${this.baseHref}/poll/${id}`, - this.utils.makeHeaders({body: password})); + return this.http.get(`${this.baseHref}/poll/${id}`, this.utils.makeHeaders({ body: password })); } fetchPollFromRoute(event) { @@ -255,20 +233,16 @@ export class ConfigService extends PollConfig { * @param ownerEmail */ getMyPolls(ownerEmail: string) { - this.http - .get(`${this.baseHref}/my-polls`, - this.utils.makeHeaders({ownerEmail}) - ) - .subscribe( - (res: any) => { - // this.myPolls = res.poll; - }, (e) => { - this.handleError(e); - } - ); + this.http.get(`${this.baseHref}/my-polls`, this.utils.makeHeaders({ ownerEmail })).subscribe( + (res: any) => { + // this.myPolls = res.poll; + }, + (e) => { + this.handleError(e); + } + ); } - /** * launch creation call to the api */ @@ -295,7 +269,7 @@ export class ConfigService extends PollConfig { } resetCurrentChoicesAnswers() { - this.currentPoll.choices.map(choice => { + this.currentPoll.choices.map((choice) => { choice.answer = null; }); } @@ -305,7 +279,6 @@ export class ConfigService extends PollConfig { * @param voteStack */ loadVoteStack(voteStack: any) { - // load the pseudo and email this.myName = voteStack.pseudo; this.myEmail = voteStack.email; @@ -320,7 +293,7 @@ export class ConfigService extends PollConfig { * the display of the poll uses the choices data, so we update the choices answers of the current poll to reflect the vote stack we have taken */ if (voteItem.choice_id && voteItem.value) { - const foundChoiceToModify = this.currentPoll.choices.find(choicesItem => { + const foundChoiceToModify = this.currentPoll.choices.find((choicesItem) => { return voteItem.choice_id == choicesItem.id; }); console.log('foundChoiceToModify', foundChoiceToModify); @@ -339,28 +312,27 @@ export class ConfigService extends PollConfig { createPollFromConfig(config: any) { this.loading = true; console.log('config', config); - return this.http.post(`${this.baseHref}/poll`, - config, - this.utils.makeHeaders()) - .subscribe((res: any) => { - // redirect to the page to administrate the new poll - this.messageService.add({severity: 'success', summary: 'Sondage Créé',}); + return this.http.post(`${this.baseHref}/poll`, config, this.utils.makeHeaders()).subscribe( + (res: any) => { + // redirect to the page to administrate the new poll + this.messageService.add({ severity: 'success', summary: 'Sondage Créé' }); - this.updateCurrentPollFromResponse(res); + this.updateCurrentPollFromResponse(res); - this.loading = false; - if (!this.myPolls) { - this.myPolls = []; - } - this.myPolls.push(res); - this.router.navigate(['step/end']); - // TODO save new poll to localstorage - // reset all fields in current config - this.resetConfig(); - }, (e) => { - this.handleError(e); + this.loading = false; + if (!this.myPolls) { + this.myPolls = []; } - ); + this.myPolls.push(res); + this.router.navigate(['step/end']); + // TODO save new poll to localstorage + // reset all fields in current config + this.resetConfig(); + }, + (e) => { + this.handleError(e); + } + ); } /** @@ -368,12 +340,12 @@ export class ConfigService extends PollConfig { * @param choiceList */ convertChoicesAnsweredToSend(choiceList) { - choiceList = choiceList.filter(c => c.answer ? c : null); // remove choices where we did not answer - const converted = choiceList.map(elem => { + choiceList = choiceList.filter((c) => (c.answer ? c : null)); // remove choices where we did not answer + const converted = choiceList.map((elem) => { if (elem.answer) { return { choice_id: elem.id, - value: elem.answer + value: elem.answer, }; } }); @@ -400,17 +372,14 @@ export class ConfigService extends PollConfig { this.handleVoteAdded(mockSuccessVote); return; } - this.http.post( - `${this.baseHref}/poll/${this.pollId}/vote`, - voteStack, - this.utils.makeHeaders()) - .subscribe((res: any) => { - - this.handleVoteAdded(res); - }, (e) => { - this.handleError(e); - } - ); + this.http.post(`${this.baseHref}/poll/${this.pollId}/vote`, voteStack, this.utils.makeHeaders()).subscribe( + (res: any) => { + this.handleVoteAdded(res); + }, + (e) => { + this.handleError(e); + } + ); } handleVoteAdded(res) { @@ -431,18 +400,21 @@ export class ConfigService extends PollConfig { updateVote(voteStack?: any) { if (!this.myVoteStack) { return; - } else { voteStack = this.myVoteStack; } - this.http.patch( - `${this.baseHref}/vote-stack/${voteStack.id}/token/${this.owner_modifier_token}`, - voteStack, - this.utils.makeHeaders()) - .subscribe((res: any) => { - this.messageService.add({severity: 'success', summary: 'Vote mis à jour'}); + this.http + .patch( + `${this.baseHref}/vote-stack/${voteStack.id}/token/${this.owner_modifier_token}`, + voteStack, + this.utils.makeHeaders() + ) + .subscribe( + (res: any) => { + this.messageService.add({ severity: 'success', summary: 'Vote mis à jour' }); this.updateCurrentPollFromResponse(res); - }, (e) => { + }, + (e) => { this.handleError(e); } ); @@ -464,29 +436,26 @@ export class ConfigService extends PollConfig { }; } console.log('comment', comment); - this.http.post( - `${this.baseHref}/poll/${this.pollId}/comment`, - comment, - this.utils.makeHeaders()) - .subscribe((res: any) => { - this.messageService.add({ - severity: 'success', - summary: 'Commentaire Créé', - detail: comment.text - }); - // empty comment after success - this.myComment = ''; - comment.date = { - date: comment.date - }; - this.currentPoll.comments.push(comment); - }, (e) => { - this.handleError(e); - } - ); + this.http.post(`${this.baseHref}/poll/${this.pollId}/comment`, comment, this.utils.makeHeaders()).subscribe( + (res: any) => { + this.messageService.add({ + severity: 'success', + summary: 'Commentaire Créé', + detail: comment.text, + }); + // empty comment after success + this.myComment = ''; + comment.date = { + date: comment.date, + }; + this.currentPoll.comments.push(comment); + }, + (e) => { + this.handleError(e); + } + ); } - /** * administrator calls */ @@ -494,46 +463,48 @@ export class ConfigService extends PollConfig { deleteComments() { // prompt for confirmation this.confirmationService.confirm({ - message: 'Are you sure that you want to completely delete the comments of this poll (' + this.title + ') permanentely?', + message: + 'Are you sure that you want to completely delete the comments of this poll (' + + this.title + + ') permanentely?', accept: () => { - this.http.delete( - `${this.baseHref}/poll/${this.pollId}/comments`, - this.utils.makeHeaders()) - .subscribe((res: any) => { - this.messageService.add({ - severity: 'success', - summary: 'Commentaires bien supprimés', - detail: 'Commentaires du sondage "' + this.title + '" supprimé' - }); - - }, (e) => { - this.handleError(e); - } - ); - } + this.http.delete(`${this.baseHref}/poll/${this.pollId}/comments`, this.utils.makeHeaders()).subscribe( + (res: any) => { + this.messageService.add({ + severity: 'success', + summary: 'Commentaires bien supprimés', + detail: 'Commentaires du sondage "' + this.title + '" supprimé', + }); + }, + (e) => { + this.handleError(e); + } + ); + }, }); } deleteVotes() { // prompt for confirmation this.confirmationService.confirm({ - message: 'Are you sure that you want to completely delete the votes of this poll (' + this.title + ') permanentely?', + message: + 'Are you sure that you want to completely delete the votes of this poll (' + + this.title + + ') permanentely?', accept: () => { - this.http.delete( - `${this.baseHref}/poll/${this.pollId}/votes`, - this.utils.makeHeaders()) - .subscribe((res: any) => { - this.messageService.add({ - severity: 'success', - summary: 'Votes bien supprimés', - detail: 'Votes du sondage "' + this.title + '" supprimé' - }); - - }, (e) => { - this.handleError(e); - } - ); - } + this.http.delete(`${this.baseHref}/poll/${this.pollId}/votes`, this.utils.makeHeaders()).subscribe( + (res: any) => { + this.messageService.add({ + severity: 'success', + summary: 'Votes bien supprimés', + detail: 'Votes du sondage "' + this.title + '" supprimé', + }); + }, + (e) => { + this.handleError(e); + } + ); + }, }); } @@ -541,31 +512,33 @@ export class ConfigService extends PollConfig { if (!this.pollId) { this.messageService.add({ summary: 'this poll is not administrable, it has no ID', - severity: 'warning' + severity: 'warning', }); return; } const self = this; // prompt for confirmation this.confirmationService.confirm({ - message: 'Are you sure that you want to completely delete this poll (' + self.title + ') and all is data permanentely?', + message: + 'Are you sure that you want to completely delete this poll (' + + self.title + + ') and all is data permanentely?', accept: () => { - this.http.delete( - `${this.baseHref}/poll/${this.pollId}`, - this.utils.makeHeaders()) - .subscribe((res: any) => { - this.messageService.add({ - severity: 'success', - summary: 'Sondage bien supprimé', - detail: 'sondage "' + this.title + '" supprimé' - }); + this.http.delete(`${this.baseHref}/poll/${this.pollId}`, this.utils.makeHeaders()).subscribe( + (res: any) => { + this.messageService.add({ + severity: 'success', + summary: 'Sondage bien supprimé', + detail: 'sondage "' + this.title + '" supprimé', + }); - this.router.navigate(['home']); - }, (e) => { - this.handleError(e); - } - ); - } + this.router.navigate(['home']); + }, + (e) => { + this.handleError(e); + } + ); + }, }); } @@ -576,99 +549,89 @@ export class ConfigService extends PollConfig { * TODO */ updatePoll(voteStack: any) { - this.http.put( - `${this.baseHref}/poll/${this.pollId}`, - voteStack, - this.utils.makeHeaders() - ) - .subscribe((res: any) => { - this.messageService.add({ - severity: 'success', - summary: 'Sondage mis à jour', - }); - this.updateCurrentPollFromResponse(res); - }, (e) => { - this.handleError(e); - } - ); + this.http.put(`${this.baseHref}/poll/${this.pollId}`, voteStack, this.utils.makeHeaders()).subscribe( + (res: any) => { + this.messageService.add({ + severity: 'success', + summary: 'Sondage mis à jour', + }); + this.updateCurrentPollFromResponse(res); + }, + (e) => { + this.handleError(e); + } + ); } /** * export all the poll data available to the public as a CSV single file */ exportCSV() { - - let rows = []; const now = new Date(); const headers = [ ['export de sondage Framadate ', this.customUrl], ['le', now.toISOString()], [this.currentPoll.pollId, this.currentPoll.title, this.customUrl, this.creationDate], - ['pseudo']]; - + ['pseudo'], + ]; const listOfChoices = ['choices : ']; - this.currentPoll.choices.map(choice => { + this.currentPoll.choices.map((choice) => { listOfChoices.push(choice.text); }); listOfChoices.push('pseudo'); - this.currentPoll.stacks.map(voteStack => { + this.currentPoll.stacks.map((voteStack) => { const voteStackInArray = [voteStack.pseudo]; const keysVotes = Object.keys(voteStack.votes); - keysVotes.map(id => { + keysVotes.map((id) => { voteStackInArray.push(voteStack.votes[id].value ? voteStack.votes[id].value : ''); }); - rows.push( - voteStackInArray - ); + rows.push(voteStackInArray); }); - const headersComments = [ - ['comments'], - ['pseudo', 'text', 'creation_date'], - ]; + const headersComments = [['comments'], ['pseudo', 'text', 'creation_date']]; const comments = []; - this.currentPoll.comments.map(item => { - comments.push( - [item.pseudo, - item.text, - item.date.date, - '\n'] - ); + this.currentPoll.comments.map((item) => { + comments.push([item.pseudo, item.text, item.date.date, '\n']); }); headers.push(listOfChoices); rows = [headers, listOfChoices, rows, headersComments, comments]; - const convertedCsv = rows.map(elem => { - console.log('elem', elem); - return elem.map(item => { - console.log('item', item); - if (typeof item === typeof Array) { - return item.join('\n'); - } - return item; - }).join('\n'); - }).join('\n'); + const convertedCsv = rows + .map((elem) => { + console.log('elem', elem); + return elem + .map((item) => { + console.log('item', item); + if (typeof item === typeof Array) { + return item.join('\n'); + } + return item; + }) + .join('\n'); + }) + .join('\n'); console.log('rows', rows); console.log('convertedCsv', convertedCsv); - const csvContent = 'data:text/csv;charset=utf-8,' - + convertedCsv; + const csvContent = 'data:text/csv;charset=utf-8,' + convertedCsv; console.log('csvContent', csvContent); const encodedUri = encodeURI(csvContent); const link = document.createElement('a'); link.setAttribute('href', encodedUri); - const exportFileName = (this.urlPublic ? this.urlPublic : this.utils.makeSlug(this)) + '_export_' + new Date() + '.csv'; + const exportFileName = + (this.urlPublic ? this.urlPublic : this.utils.makeSlug(this)) + '_export_' + new Date() + '.csv'; link.setAttribute('download', exportFileName); document.body.appendChild(link); // Required for FF link.click(); // This will download the data file named "my_data.csv". } exportJson() { - this.download('export_poll_' + this.pollSlug + '.json', JSON.stringify( - { + this.download( + 'export_poll_' + this.pollSlug + '.json', + JSON.stringify({ export_date: new Date(), creation_date: this.creationDate, title: this.title, @@ -676,10 +639,9 @@ export class ConfigService extends PollConfig { pollType: this.pollType, urlPublic: this.urlPublic, currentPoll: this.currentPoll, - votes: this.voteChoices + votes: this.voteChoices, }) ); - } download(filename, text) { @@ -695,7 +657,6 @@ export class ConfigService extends PollConfig { document.body.removeChild(element); } - print() { alert('TODO'); } @@ -703,7 +664,8 @@ export class ConfigService extends PollConfig { todo(message = '') { this.messageService.add({ severity: 'info' + message, - detail: 'cette fonctionnalité n\'est pas encore disponible. Venez en discuter sur framateam.org / Ux et design libre / Framasoft', + detail: + "cette fonctionnalité n'est pas encore disponible. Venez en discuter sur framateam.org / Ux et design libre / Framasoft", summary: 'Work in progress', }); } @@ -719,24 +681,22 @@ export class ConfigService extends PollConfig { creationDate: { date: '2020-01-22 14:28:19.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, expiracyDate: { date: '2020-01-22 14:28:19.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, owner: { __initializer__: null, __cloner__: null, __isInitialized__: true, pseudo: 'tk_TEST', - email: 'tktest@tktest.com' + email: 'tktest@tktest.com', }, kind: 'text', - allowedAnswers: [ - 'yes' - ], + allowedAnswers: ['yes'], modificationPolicy: 'self', mailOnComment: null, mailOnVote: null, @@ -746,16 +706,17 @@ export class ConfigService extends PollConfig { stacksOfVotes: {}, choices: {}, comments: {}, - defaultExpiracyDaysFromNow: 60 + defaultExpiracyDaysFromNow: 60, }, vote_stack: { id: 43, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-04-02 17:55:45.201475', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { @@ -763,135 +724,138 @@ export class ConfigService extends PollConfig { value: 'yes', choice_id: 5, text: 'Vic le viking', - stack_id: 43 + stack_id: 43, }, 6: { id: 94, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 43 + stack_id: 43, }, 7: { id: 95, value: 'yes', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 43 + text: "Les mystérieuses cités d'or", + stack_id: 43, }, 8: { id: 96, value: 'yes', choice_id: 8, text: 'Les mondes engloutis', - stack_id: 43 + stack_id: 43, }, 9: { id: 97, value: 'yes', choice_id: 9, text: 'Foot 2 rue', - stack_id: 43 + stack_id: 43, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, stacks: [ { id: 3, - modifier_token: 'sfdH00Fy17bt5c3Y5zYk5GDsX7Cl67cgec14Qd06V87g74JFOr2UOC2ZL8E919eBmI72W8f5keYDeWfrV7SQW35fw0Vg452k25w9BrS62MtOs89JjLQ', + modifier_token: + 'sfdH00Fy17bt5c3Y5zYk5GDsX7Cl67cgec14Qd06V87g74JFOr2UOC2ZL8E919eBmI72W8f5keYDeWfrV7SQW35fw0Vg452k25w9BrS62MtOs89JjLQ', pseudo: 'voting_people_TEST', creation_date: { date: '2020-01-22 14:28:19.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { - choice_id: 5 + choice_id: 5, }, 6: { id: 5, value: 'maybe', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 3 + stack_id: 3, }, 7: { id: 4, value: 'yes', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 3 + text: "Les mystérieuses cités d'or", + stack_id: 3, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 4, - modifier_token: 'sfdH00Fy17bt5c3Y5zYk5GDsX7Cl67cgec14Qd06V87g74JFOr2UOC2ZL8E919eBmI72W8f5keYDeWfrV7SQW35fw0Vg452k25w9BrS62MtOs89JjLQ', + modifier_token: + 'sfdH00Fy17bt5c3Y5zYk5GDsX7Cl67cgec14Qd06V87g74JFOr2UOC2ZL8E919eBmI72W8f5keYDeWfrV7SQW35fw0Vg452k25w9BrS62MtOs89JjLQ', pseudo: 'voting_people_TEST', creation_date: { date: '2020-01-22 14:28:19.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { - choice_id: 5 + choice_id: 5, }, 6: { id: 6, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 4 + stack_id: 4, }, 7: { id: 8, value: 'no', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 4 + text: "Les mystérieuses cités d'or", + stack_id: 4, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 5, - modifier_token: 'sfdH00Fy17bt5c3Y5zYk5GDsX7Cl67cgec14Qd06V87g74JFOr2UOC2ZL8E919eBmI72W8f5keYDeWfrV7SQW35fw0Vg452k25w9BrS62MtOs89JjLQ', + modifier_token: + 'sfdH00Fy17bt5c3Y5zYk5GDsX7Cl67cgec14Qd06V87g74JFOr2UOC2ZL8E919eBmI72W8f5keYDeWfrV7SQW35fw0Vg452k25w9BrS62MtOs89JjLQ', pseudo: 'voting_people_TEST', creation_date: { date: '2020-01-22 16:00:50.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { @@ -899,44 +863,45 @@ export class ConfigService extends PollConfig { value: 'no', choice_id: 5, text: 'Vic le viking', - stack_id: 5 + stack_id: 5, }, 6: { id: 10, value: 'maybe', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 5 + stack_id: 5, }, 7: { id: 11, value: 'yes', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 5 + text: "Les mystérieuses cités d'or", + stack_id: 5, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 6, - modifier_token: 'W1275k1tOh7CA9e9F0VbD58teW3Z451848Sh14imcr90QY1d3tK415mHw9Ib8II8S91F2n8dhk135-20d9cT2mX3UfZ92aeuQdwcj32e17E0bc50fp3d', + modifier_token: + 'W1275k1tOh7CA9e9F0VbD58teW3Z451848Sh14imcr90QY1d3tK415mHw9Ib8II8S91F2n8dhk135-20d9cT2mX3UfZ92aeuQdwcj32e17E0bc50fp3d', pseudo: '', creation_date: { date: '2020-01-22 16:01:10.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { @@ -944,85 +909,87 @@ export class ConfigService extends PollConfig { value: 'yes', choice_id: 5, text: 'Vic le viking', - stack_id: 6 + stack_id: 6, }, 6: { id: 13, value: 'maybe', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 6 + stack_id: 6, }, 7: { id: 14, value: 'no', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 6 + text: "Les mystérieuses cités d'or", + stack_id: 6, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 7, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-23 16:19:29.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { - choice_id: 5 + choice_id: 5, }, 6: { id: 15, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 7 + stack_id: 7, }, 7: { - choice_id: 7 + choice_id: 7, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { id: 16, value: 'yes', choice_id: 10, - text: 'Le chat, la vache, et l\'océan', - stack_id: 7 + text: "Le chat, la vache, et l'océan", + stack_id: 7, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 12, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-24 11:34:54.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { @@ -1030,85 +997,87 @@ export class ConfigService extends PollConfig { value: 'yes', choice_id: 5, text: 'Vic le viking', - stack_id: 12 + stack_id: 12, }, 6: { - choice_id: 6 + choice_id: 6, }, 7: { - choice_id: 7 + choice_id: 7, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { id: 22, value: 'yes', choice_id: 11, text: 'Digimon', - stack_id: 12 - } - } + stack_id: 12, + }, + }, }, { id: 13, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-24 12:00:47.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { - choice_id: 5 + choice_id: 5, }, 6: { id: 23, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 13 + stack_id: 13, }, 7: { id: 24, value: 'yes', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 13 + text: "Les mystérieuses cités d'or", + stack_id: 13, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { id: 25, value: 'yes', choice_id: 9, text: 'Foot 2 rue', - stack_id: 13 + stack_id: 13, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 14, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-24 12:01:47.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { @@ -1116,184 +1085,189 @@ export class ConfigService extends PollConfig { value: 'yes', choice_id: 5, text: 'Vic le viking', - stack_id: 14 + stack_id: 14, }, 6: { - choice_id: 6 + choice_id: 6, }, 7: { - choice_id: 7 + choice_id: 7, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 15, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-24 12:07:15.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { - choice_id: 5 + choice_id: 5, }, 6: { id: 27, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 15 + stack_id: 15, }, 7: { - choice_id: 7 + choice_id: 7, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 16, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-24 12:08:58.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { - choice_id: 5 + choice_id: 5, }, 6: { id: 28, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 16 + stack_id: 16, }, 7: { - choice_id: 7 + choice_id: 7, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 17, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-24 12:09:15.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { - choice_id: 5 + choice_id: 5, }, 6: { - choice_id: 6 + choice_id: 6, }, 7: { id: 29, value: 'yes', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 17 + text: "Les mystérieuses cités d'or", + stack_id: 17, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 18, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-24 12:15:45.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { - choice_id: 5 + choice_id: 5, }, 6: { - choice_id: 6 + choice_id: 6, }, 7: { id: 30, value: 'yes', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 18 + text: "Les mystérieuses cités d'or", + stack_id: 18, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 19, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-24 12:16:50.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { @@ -1301,89 +1275,91 @@ export class ConfigService extends PollConfig { value: 'yes', choice_id: 5, text: 'Vic le viking', - stack_id: 19 + stack_id: 19, }, 6: { id: 32, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 19 + stack_id: 19, }, 7: { id: 33, value: 'yes', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 19 + text: "Les mystérieuses cités d'or", + stack_id: 19, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 25, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-29 17:55:42.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { - choice_id: 5 + choice_id: 5, }, 6: { id: 44, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 25 + stack_id: 25, }, 7: { - choice_id: 7 + choice_id: 7, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { id: 45, value: 'yes', choice_id: 9, text: 'Foot 2 rue', - stack_id: 25 + stack_id: 25, }, 10: { id: 46, value: 'yes', choice_id: 10, - text: 'Le chat, la vache, et l\'océan', - stack_id: 25 + text: "Le chat, la vache, et l'océan", + stack_id: 25, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 26, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-30 10:20:06.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { @@ -1391,48 +1367,49 @@ export class ConfigService extends PollConfig { value: 'yes', choice_id: 5, text: 'Vic le viking', - stack_id: 26 + stack_id: 26, }, 6: { id: 48, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 26 + stack_id: 26, }, 7: { id: 49, value: 'yes', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 26 + text: "Les mystérieuses cités d'or", + stack_id: 26, }, 8: { id: 50, value: 'yes', choice_id: 8, text: 'Les mondes engloutis', - stack_id: 26 + stack_id: 26, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 28, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-30 17:23:48.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { @@ -1440,130 +1417,133 @@ export class ConfigService extends PollConfig { value: 'yes', choice_id: 5, text: 'Vic le viking', - stack_id: 28 + stack_id: 28, }, 6: { id: 54, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 28 + stack_id: 28, }, 7: { id: 55, value: 'yes', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 28 + text: "Les mystérieuses cités d'or", + stack_id: 28, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { id: 56, value: 'yes', choice_id: 10, - text: 'Le chat, la vache, et l\'océan', - stack_id: 28 + text: "Le chat, la vache, et l'océan", + stack_id: 28, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 35, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-01-31 09:42:28.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { - choice_id: 5 + choice_id: 5, }, 6: { id: 69, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 35 + stack_id: 35, }, 7: { id: 70, value: 'yes', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 35 + text: "Les mystérieuses cités d'or", + stack_id: 35, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { - choice_id: 9 + choice_id: 9, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 37, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-02-05 10:38:47.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { - choice_id: 5 + choice_id: 5, }, 6: { - choice_id: 6 + choice_id: 6, }, 7: { - choice_id: 7 + choice_id: 7, }, 8: { id: 74, value: 'yes', choice_id: 8, text: 'Les mondes engloutis', - stack_id: 37 + stack_id: 37, }, 9: { id: 75, value: 'yes', choice_id: 9, text: 'Foot 2 rue', - stack_id: 37 + stack_id: 37, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 40, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-02-22 17:53:57.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { @@ -1571,48 +1551,49 @@ export class ConfigService extends PollConfig { value: 'no', choice_id: 5, text: 'Vic le viking', - stack_id: 40 + stack_id: 40, }, 6: { id: 83, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 40 + stack_id: 40, }, 7: { - choice_id: 7 + choice_id: 7, }, 8: { id: 84, value: 'yes', choice_id: 8, text: 'Les mondes engloutis', - stack_id: 40 + stack_id: 40, }, 9: { id: 85, value: 'yes', choice_id: 9, text: 'Foot 2 rue', - stack_id: 40 + stack_id: 40, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 41, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-04-01 12:24:37.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { @@ -1620,52 +1601,53 @@ export class ConfigService extends PollConfig { value: 'yes', choice_id: 5, text: 'Vic le viking', - stack_id: 41 + stack_id: 41, }, 6: { id: 87, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 41 + stack_id: 41, }, 7: { id: 88, value: 'yes', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 41 + text: "Les mystérieuses cités d'or", + stack_id: 41, }, 8: { - choice_id: 8 + choice_id: 8, }, 9: { id: 89, value: 'yes', choice_id: 9, text: 'Foot 2 rue', - stack_id: 41 + stack_id: 41, }, 10: { id: 90, value: 'yes', choice_id: 10, - text: 'Le chat, la vache, et l\'océan', - stack_id: 41 + text: "Le chat, la vache, et l'océan", + stack_id: 41, }, 11: { - choice_id: 11 - } - } + choice_id: 11, + }, + }, }, { id: 43, - modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', pseudo: 'tk_TEST', creation_date: { date: '2020-04-02 17:55:45.201475', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, votes: { 5: { @@ -1673,44 +1655,44 @@ export class ConfigService extends PollConfig { value: 'yes', choice_id: 5, text: 'Vic le viking', - stack_id: 43 + stack_id: 43, }, 6: { id: 94, value: 'yes', choice_id: 6, text: 'Boumbo petite automobile', - stack_id: 43 + stack_id: 43, }, 7: { id: 95, value: 'yes', choice_id: 7, - text: 'Les mystérieuses cités d\'or', - stack_id: 43 + text: "Les mystérieuses cités d'or", + stack_id: 43, }, 8: { id: 96, value: 'yes', choice_id: 8, text: 'Les mondes engloutis', - stack_id: 43 + stack_id: 43, }, 9: { id: 97, value: 'yes', choice_id: 9, text: 'Foot 2 rue', - stack_id: 43 + stack_id: 43, }, 10: { - choice_id: 10 + choice_id: 10, }, 11: { - choice_id: 11 - } - } - } + choice_id: 11, + }, + }, + }, ], comments: [ { @@ -1720,8 +1702,8 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-22 16:00:22.000000', timezone_type: 3, - timezone: 'Europe/Paris' - } + timezone: 'Europe/Paris', + }, }, { id: 6, @@ -1730,8 +1712,8 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-22 16:09:32.000000', timezone_type: 3, - timezone: 'Europe/Paris' - } + timezone: 'Europe/Paris', + }, }, { id: 7, @@ -1740,8 +1722,8 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-22 16:09:51.000000', timezone_type: 3, - timezone: 'Europe/Paris' - } + timezone: 'Europe/Paris', + }, }, { id: 8, @@ -1750,8 +1732,8 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-22 16:15:24.000000', timezone_type: 3, - timezone: 'Europe/Paris' - } + timezone: 'Europe/Paris', + }, }, { id: 9, @@ -1760,8 +1742,8 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-23 14:11:21.000000', timezone_type: 3, - timezone: 'Europe/Paris' - } + timezone: 'Europe/Paris', + }, }, { id: 13, @@ -1770,8 +1752,8 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-23 16:35:52.000000', timezone_type: 3, - timezone: 'Europe/Paris' - } + timezone: 'Europe/Paris', + }, }, { id: 14, @@ -1780,8 +1762,8 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-23 16:36:04.000000', timezone_type: 3, - timezone: 'Europe/Paris' - } + timezone: 'Europe/Paris', + }, }, { id: 16, @@ -1790,8 +1772,8 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-23 18:37:49.000000', timezone_type: 3, - timezone: 'Europe/Paris' - } + timezone: 'Europe/Paris', + }, }, { id: 18, @@ -1800,8 +1782,8 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-24 11:34:58.000000', timezone_type: 3, - timezone: 'Europe/Paris' - } + timezone: 'Europe/Paris', + }, }, { id: 19, @@ -1810,8 +1792,8 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-24 11:35:08.000000', timezone_type: 3, - timezone: 'Europe/Paris' - } + timezone: 'Europe/Paris', + }, }, { id: 20, @@ -1820,8 +1802,8 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-24 12:16:24.000000', timezone_type: 3, - timezone: 'Europe/Paris' - } + timezone: 'Europe/Paris', + }, }, { id: 21, @@ -1830,9 +1812,9 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-24 12:16:38.000000', timezone_type: 3, - timezone: 'Europe/Paris' - } - } + timezone: 'Europe/Paris', + }, + }, ], choices: [ { @@ -1840,71 +1822,71 @@ export class ConfigService extends PollConfig { date: { date: '2020-01-22 14:28:19.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, text: 'Vic le viking', - url: null + url: null, }, { id: 6, date: { date: '2020-01-22 14:28:19.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, text: 'Boumbo petite automobile', - url: null + url: null, }, { id: 7, date: { date: '2020-01-22 14:28:19.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, - text: 'Les mystérieuses cités d\'or', - url: null + text: "Les mystérieuses cités d'or", + url: null, }, { id: 8, date: { date: '2020-01-22 14:28:19.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, text: 'Les mondes engloutis', - url: null + url: null, }, { id: 9, date: { date: '2020-01-22 14:28:19.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, text: 'Foot 2 rue', - url: null + url: null, }, { id: 10, date: { date: '2020-01-22 14:28:19.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, - text: 'Le chat, la vache, et l\'océan', - url: null + text: "Le chat, la vache, et l'océan", + url: null, }, { id: 11, date: { date: '2020-01-22 14:28:19.000000', timezone_type: 3, - timezone: 'Europe/Paris' + timezone: 'Europe/Paris', }, text: 'Digimon', - url: null - } + url: null, + }, ], choices_count: { counts: { @@ -1915,28 +1897,16 @@ export class ConfigService extends PollConfig { score: 8, yes: { count: 8, - people: [ - '', - 'tk_TEST', - 'tk_TEST', - 'tk_TEST', - 'tk_TEST', - 'tk_TEST', - 'tk_TEST', - 'tk_TEST' - ] + people: ['', 'tk_TEST', 'tk_TEST', 'tk_TEST', 'tk_TEST', 'tk_TEST', 'tk_TEST', 'tk_TEST'], }, maybe: { count: 0, - people: [] + people: [], }, no: { count: 2, - people: [ - 'voting_people_TEST', - 'tk_TEST' - ] - } + people: ['voting_people_TEST', 'tk_TEST'], + }, }, 6: { choice_id: 6, @@ -1958,25 +1928,21 @@ export class ConfigService extends PollConfig { 'tk_TEST', 'tk_TEST', 'tk_TEST', - 'tk_TEST' - ] + 'tk_TEST', + ], }, maybe: { count: 3, - people: [ - 'voting_people_TEST', - 'voting_people_TEST', - '' - ] + people: ['voting_people_TEST', 'voting_people_TEST', ''], }, no: { count: 0, - people: [] - } + people: [], + }, }, 7: { choice_id: 7, - choice_text: 'Les mystérieuses cités d\'or', + choice_text: "Les mystérieuses cités d'or", id: 4, score: 12, yes: { @@ -1993,20 +1959,17 @@ export class ConfigService extends PollConfig { 'tk_TEST', 'tk_TEST', 'tk_TEST', - 'tk_TEST' - ] + 'tk_TEST', + ], }, maybe: { count: 0, - people: [] + people: [], }, no: { count: 2, - people: [ - 'voting_people_TEST', - '' - ] - } + people: ['voting_people_TEST', ''], + }, }, 8: { choice_id: 8, @@ -2015,21 +1978,16 @@ export class ConfigService extends PollConfig { score: 4, yes: { count: 4, - people: [ - 'tk_TEST', - 'tk_TEST', - 'tk_TEST', - 'tk_TEST' - ] + people: ['tk_TEST', 'tk_TEST', 'tk_TEST', 'tk_TEST'], }, maybe: { count: 0, - people: [] + people: [], }, no: { count: 0, - people: [] - } + people: [], + }, }, 9: { choice_id: 9, @@ -2038,46 +1996,34 @@ export class ConfigService extends PollConfig { score: 6, yes: { count: 6, - people: [ - 'tk_TEST', - 'tk_TEST', - 'tk_TEST', - 'tk_TEST', - 'tk_TEST', - 'tk_TEST' - ] + people: ['tk_TEST', 'tk_TEST', 'tk_TEST', 'tk_TEST', 'tk_TEST', 'tk_TEST'], }, maybe: { count: 0, - people: [] + people: [], }, no: { count: 0, - people: [] - } + people: [], + }, }, 10: { choice_id: 10, - choice_text: 'Le chat, la vache, et l\'océan', + choice_text: "Le chat, la vache, et l'océan", id: 16, score: 4, yes: { count: 4, - people: [ - 'tk_TEST', - 'tk_TEST', - 'tk_TEST', - 'tk_TEST' - ] + people: ['tk_TEST', 'tk_TEST', 'tk_TEST', 'tk_TEST'], }, maybe: { count: 0, - people: [] + people: [], }, no: { count: 0, - people: [] - } + people: [], + }, }, 11: { choice_id: 11, @@ -2086,21 +2032,19 @@ export class ConfigService extends PollConfig { score: 1, yes: { count: 1, - people: [ - 'tk_TEST' - ] + people: ['tk_TEST'], }, maybe: { count: 0, - people: [] + people: [], }, no: { count: 0, - people: [] - } - } + people: [], + }, + }, }, - maxScore: 14.5 + maxScore: 14.5, }, vote_count: 21, owner: { @@ -2108,36 +2052,38 @@ export class ConfigService extends PollConfig { __cloner__: null, __isInitialized__: true, pseudo: 'tk_TEST', - email: 'tktest@tktest.com' + email: 'tktest@tktest.com', }, - owner_modifier_token: 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', - admin_key: 'A8jZ9oc1jsFGZJ024c457f0Wj1bYca5m6537cm9nCg7catZdc18ke5Kqd449eL290oHCqdu3SNmkC7yIHj96n6dnU7ca7qdaf2VSRMI48eXd61O9a3U', + owner_modifier_token: + 'b88Qnb1A515Sfedee8b74d726A32444m87cn9Zc0f9t6Ued516f76235V93tBKcJVJearh061S8I0o5l24wbIaMe2v4wg76dhEBBi9m-28Qa601b664L', + admin_key: + 'A8jZ9oc1jsFGZJ024c457f0Wj1bYca5m6537cm9nCg7catZdc18ke5Kqd449eL290oHCqdu3SNmkC7yIHj96n6dnU7ca7qdaf2VSRMI48eXd61O9a3U', json_you_sent: { pseudo: 'mon pseudo', email: 'tktest@tktest.com', votes: [ { choice_id: 5, - value: 'yes' + value: 'yes', }, { choice_id: 6, - value: 'yes' + value: 'yes', }, { choice_id: 7, - value: 'yes' + value: 'yes', }, { choice_id: 8, - value: 'yes' + value: 'yes', }, { choice_id: 9, - value: 'yes' - } - ] - } + value: 'yes', + }, + ], + }, }; this.updateCurrentPollFromResponse(mockResponse); } diff --git a/src/app/services/poll-service.service.spec.ts b/src/app/services/poll-service.service.spec.ts index c47006ba..e2a84713 100644 --- a/src/app/services/poll-service.service.spec.ts +++ b/src/app/services/poll-service.service.spec.ts @@ -3,10 +3,10 @@ import { TestBed } from '@angular/core/testing'; import { PollService } from './poll.service'; describe('PollServiceService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + beforeEach(() => TestBed.configureTestingModule({})); - it('should be created', () => { - const service: PollService = TestBed.get(PollService); - expect(service).toBeTruthy(); - }); + it('should be created', () => { + const service: PollService = TestBed.get(PollService); + expect(service).toBeTruthy(); + }); }); diff --git a/src/app/services/poll.service.ts b/src/app/services/poll.service.ts index 33f190d2..21d42e22 100644 --- a/src/app/services/poll.service.ts +++ b/src/app/services/poll.service.ts @@ -1,15 +1,11 @@ -import {Injectable} from '@angular/core'; -import {environment} from "../../environments/environment"; +import { Injectable } from '@angular/core'; +import { environment } from '../../environments/environment'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class PollService { - private baseHref: string = environment.baseApiHref; - constructor() { - } - - + constructor() {} } diff --git a/src/app/services/progression.service.spec.ts b/src/app/services/progression.service.spec.ts index c8fff3dd..5833109e 100644 --- a/src/app/services/progression.service.spec.ts +++ b/src/app/services/progression.service.spec.ts @@ -3,10 +3,10 @@ import { TestBed } from '@angular/core/testing'; import { ConfigService } from './config.service'; describe('ConfigService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + beforeEach(() => TestBed.configureTestingModule({})); - it('should be created', () => { - const service: ConfigService = TestBed.get(ConfigService); - expect(service).toBeTruthy(); - }); + it('should be created', () => { + const service: ConfigService = TestBed.get(ConfigService); + expect(service).toBeTruthy(); + }); }); diff --git a/src/app/ui/copy-text/copy-text.component.html b/src/app/ui/copy-text/copy-text.component.html index 23e10d50..0e85fbea 100644 --- a/src/app/ui/copy-text/copy-text.component.html +++ b/src/app/ui/copy-text/copy-text.component.html @@ -1,13 +1,11 @@ + class="btn btn--primary btn--outline" + id="copyLink" +> + + {{ 'admin.copy_link' | translate }} + " {{ textToCopy }}" + diff --git a/src/app/ui/copy-text/copy-text.component.spec.ts b/src/app/ui/copy-text/copy-text.component.spec.ts index 18a6c096..d6e93f3d 100644 --- a/src/app/ui/copy-text/copy-text.component.spec.ts +++ b/src/app/ui/copy-text/copy-text.component.spec.ts @@ -1,6 +1,6 @@ -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import {CopyTextComponent} from './copy-text.component'; +import { CopyTextComponent } from './copy-text.component'; describe('CopyTextComponent', () => { let component: CopyTextComponent; @@ -8,9 +8,8 @@ describe('CopyTextComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [CopyTextComponent] - }) - .compileComponents(); + declarations: [CopyTextComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/ui/copy-text/copy-text.component.ts b/src/app/ui/copy-text/copy-text.component.ts index ea70c8f5..8f4e3b3d 100644 --- a/src/app/ui/copy-text/copy-text.component.ts +++ b/src/app/ui/copy-text/copy-text.component.ts @@ -1,27 +1,24 @@ -import {Component, Input, OnInit} from '@angular/core'; -import {MessageService} from "primeng/api"; +import { Component, Input, OnInit } from '@angular/core'; +import { MessageService } from 'primeng/api'; @Component({ selector: 'framadate-copy-text', templateUrl: './copy-text.component.html', - styleUrls: ['./copy-text.component.scss'] + styleUrls: ['./copy-text.component.scss'], }) export class CopyTextComponent implements OnInit { @Input() public textToCopy: any; displayContentToCopy = false; - constructor(private messageService: MessageService,) { - } + constructor(private messageService: MessageService) {} - ngOnInit() { - } + ngOnInit() {} handleClick() { this.messageService.add({ severity: 'success', summary: 'Texte copié', - detail: this.textToCopy - }) + detail: this.textToCopy, + }); } - } diff --git a/src/app/ui/directives/resettable-input.directive.spec.ts b/src/app/ui/directives/resettable-input.directive.spec.ts index 143a8014..3b09be3c 100644 --- a/src/app/ui/directives/resettable-input.directive.spec.ts +++ b/src/app/ui/directives/resettable-input.directive.spec.ts @@ -1,8 +1,8 @@ import { ResettableInputDirective } from './resettable-input.directive'; describe('ResettableInputDirective', () => { - it('should create an instance', () => { - const directive = new ResettableInputDirective(); - expect(directive).toBeTruthy(); - }); + it('should create an instance', () => { + const directive = new ResettableInputDirective(); + expect(directive).toBeTruthy(); + }); }); diff --git a/src/app/ui/directives/resettable-input.directive.ts b/src/app/ui/directives/resettable-input.directive.ts index adb4ac38..7d2d89be 100644 --- a/src/app/ui/directives/resettable-input.directive.ts +++ b/src/app/ui/directives/resettable-input.directive.ts @@ -1,14 +1,11 @@ -import {Directive} from '@angular/core'; +import { Directive } from '@angular/core'; /** * add a button on an input which deletes its value */ @Directive({ - selector: '[framadateResettableInput]' + selector: '[framadateResettableInput]', }) export class ResettableInputDirective { - - constructor() { - } - + constructor() {} } diff --git a/src/app/ui/erasable-input/erasable-input.component.html b/src/app/ui/erasable-input/erasable-input.component.html index c5d1859b..0c647dc2 100644 --- a/src/app/ui/erasable-input/erasable-input.component.html +++ b/src/app/ui/erasable-input/erasable-input.component.html @@ -1,6 +1,3 @@ - + diff --git a/src/app/ui/erasable-input/erasable-input.component.spec.ts b/src/app/ui/erasable-input/erasable-input.component.spec.ts index 3a1b0626..b55a00a3 100644 --- a/src/app/ui/erasable-input/erasable-input.component.spec.ts +++ b/src/app/ui/erasable-input/erasable-input.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ErasableInputComponent } from './erasable-input.component'; describe('ErasableInputComponent', () => { - let component: ErasableInputComponent; - let fixture: ComponentFixture; + let component: ErasableInputComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ErasableInputComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ErasableInputComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(ErasableInputComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(ErasableInputComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/ui/erasable-input/erasable-input.component.ts b/src/app/ui/erasable-input/erasable-input.component.ts index 147a1c01..49293814 100644 --- a/src/app/ui/erasable-input/erasable-input.component.ts +++ b/src/app/ui/erasable-input/erasable-input.component.ts @@ -1,25 +1,22 @@ -import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; @Component({ selector: 'framadate-erasable-input', templateUrl: './erasable-input.component.html', - styleUrls: ['./erasable-input.component.scss'] + styleUrls: ['./erasable-input.component.scss'], }) export class ErasableInputComponent implements OnInit { @Output() inputModelChange = new EventEmitter(); @Input() inputModel; - constructor() { - } + constructor() {} - ngOnInit() { - } + ngOnInit() {} eraseInput() { // this.inputModelChange.emit(''); // TODO focus on other element } - } diff --git a/src/app/ui/navigation/master-head/master-head.component.html b/src/app/ui/navigation/master-head/master-head.component.html index cb9c93cc..614c073d 100644 --- a/src/app/ui/navigation/master-head/master-head.component.html +++ b/src/app/ui/navigation/master-head/master-head.component.html @@ -1,14 +1,11 @@ - +

Frama date (démo)

-
proposé par +
+ proposé par Frama soft
diff --git a/src/app/ui/navigation/master-head/master-head.component.spec.ts b/src/app/ui/navigation/master-head/master-head.component.spec.ts index 6e052446..762fd85f 100644 --- a/src/app/ui/navigation/master-head/master-head.component.spec.ts +++ b/src/app/ui/navigation/master-head/master-head.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { MasterHeadComponent } from './master-head.component'; describe('MasterHeadComponent', () => { - let component: MasterHeadComponent; - let fixture: ComponentFixture; + let component: MasterHeadComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ MasterHeadComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [MasterHeadComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(MasterHeadComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(MasterHeadComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/ui/navigation/master-head/master-head.component.ts b/src/app/ui/navigation/master-head/master-head.component.ts index e224b395..bfb7000e 100644 --- a/src/app/ui/navigation/master-head/master-head.component.ts +++ b/src/app/ui/navigation/master-head/master-head.component.ts @@ -1,15 +1,12 @@ import { Component, OnInit } from '@angular/core'; @Component({ - selector: 'framadate-master-head', - templateUrl: './master-head.component.html', - styleUrls: ['./master-head.component.scss'] + selector: 'framadate-master-head', + templateUrl: './master-head.component.html', + styleUrls: ['./master-head.component.scss'], }) export class MasterHeadComponent implements OnInit { + constructor() {} - constructor() { } - - ngOnInit(): void { - } - + ngOnInit(): void {} } diff --git a/src/app/ui/navigation/navigation.component.html b/src/app/ui/navigation/navigation.component.html index 6d7343e8..3ec4d0b6 100644 --- a/src/app/ui/navigation/navigation.component.html +++ b/src/app/ui/navigation/navigation.component.html @@ -1,106 +1,50 @@ -
diff --git a/src/app/ui/navigation/navigation.component.scss b/src/app/ui/navigation/navigation.component.scss index 89b6ecfc..78962486 100644 --- a/src/app/ui/navigation/navigation.component.scss +++ b/src/app/ui/navigation/navigation.component.scss @@ -22,7 +22,6 @@ nav { &:not(:first-of-type)::before { content: ' | '; - } &.active { diff --git a/src/app/ui/navigation/navigation.component.spec.ts b/src/app/ui/navigation/navigation.component.spec.ts index 38577181..66c06295 100644 --- a/src/app/ui/navigation/navigation.component.spec.ts +++ b/src/app/ui/navigation/navigation.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { NavigationComponent } from './navigation.component'; describe('NavigationComponent', () => { - let component: NavigationComponent; - let fixture: ComponentFixture; + let component: NavigationComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ NavigationComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [NavigationComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(NavigationComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(NavigationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/ui/navigation/navigation.component.ts b/src/app/ui/navigation/navigation.component.ts index 94f12e42..79616c2a 100644 --- a/src/app/ui/navigation/navigation.component.ts +++ b/src/app/ui/navigation/navigation.component.ts @@ -1,34 +1,28 @@ -import {Component, Input, OnInit} from '@angular/core'; -import {BaseComponent} from '../../pages/base-page/base.component'; +import { Component, Input, OnInit } from '@angular/core'; +import { BaseComponent } from '../../pages/base-page/base.component'; -import {Router} from '@angular/router'; -import {ConfigService} from '../../services/config.service'; +import { Router } from '@angular/router'; +import { ConfigService } from '../../services/config.service'; @Component({ selector: 'framadate-navigation', templateUrl: './navigation.component.html', - styleUrls: ['./navigation.component.scss'] + styleUrls: ['./navigation.component.scss'], }) export class NavigationComponent extends BaseComponent implements OnInit { - @Input() public step = 'home'; - constructor(public config: ConfigService, - public route: Router) { + constructor(public config: ConfigService, public route: Router) { super(config); - } - ngOnInit() { - - } + ngOnInit() {} nextPage() { if (this.checkValidity()) { if (this.config.step < this.config.stepMax) { this.config.step++; } - } else { this.displayErrorMessage(); } diff --git a/src/app/ui/selector/language/language.component.html b/src/app/ui/selector/language/language.component.html index 6289c1e7..4db74a77 100644 --- a/src/app/ui/selector/language/language.component.html +++ b/src/app/ui/selector/language/language.component.html @@ -5,30 +5,18 @@ alt="location icon" (click)="changeLanguage()" class="lang_icon clickable" - > menu icon + /> + menu icon - Menu + Menu
- diff --git a/src/app/ui/selector/language/language.component.spec.ts b/src/app/ui/selector/language/language.component.spec.ts index 39043b99..12501dec 100644 --- a/src/app/ui/selector/language/language.component.spec.ts +++ b/src/app/ui/selector/language/language.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { LanguageComponent } from './language.component'; describe('LanguageComponent', () => { - let component: LanguageComponent; - let fixture: ComponentFixture; + let component: LanguageComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ LanguageComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [LanguageComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(LanguageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(LanguageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/ui/selector/language/language.component.ts b/src/app/ui/selector/language/language.component.ts index 5e81b387..131e731f 100644 --- a/src/app/ui/selector/language/language.component.ts +++ b/src/app/ui/selector/language/language.component.ts @@ -1,16 +1,15 @@ -import {Component, Inject, OnInit} from '@angular/core'; -import {TranslateService} from '@ngx-translate/core'; -import {ConfigService} from '../../../services/config.service'; -import {DOCUMENT} from '@angular/common'; -import {Router} from '@angular/router'; +import { Component, Inject, OnInit } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; +import { ConfigService } from '../../../services/config.service'; +import { DOCUMENT } from '@angular/common'; +import { Router } from '@angular/router'; @Component({ selector: 'framadate-language', templateUrl: './language.component.html', - styleUrls: ['./language.component.scss'] + styleUrls: ['./language.component.scss'], }) export class LanguageComponent implements OnInit { - currentLang = 'fr'; langsAvailable = ['fr', 'en']; title = 'framadate'; @@ -18,19 +17,18 @@ export class LanguageComponent implements OnInit { minutes = 12; user = { name: 'Arthur', - age: 42 + age: 42, }; - constructor(private translate: TranslateService, - public config: ConfigService, - @Inject(DOCUMENT) private document, - private route: Router) { - - - } + constructor( + private translate: TranslateService, + public config: ConfigService, + @Inject(DOCUMENT) private document, + private route: Router + ) {} ngOnInit(): void { - console.log('this.config.preferences', this.config.preferences) + console.log('this.config.preferences', this.config.preferences); if (this.config.preferences.lang) { this.switchLanguage(this.config.preferences.lang); } else { @@ -40,12 +38,10 @@ export class LanguageComponent implements OnInit { switchLanguage(language: string) { if (this.langsAvailable.includes(language)) { - this.translate.use(language); this.currentLang = language; this.config.setPreference('lang', language); this.translate.setDefaultLang(this.currentLang); - } else { console.error('this lang is not supported'); } @@ -60,7 +56,7 @@ export class LanguageComponent implements OnInit { const indexofCurrent = langs.indexOf(this.currentLang); if (indexofCurrent > -1) { let newIndex = indexofCurrent + 1; - if (newIndex > (langs.length - 1)) { + if (newIndex > langs.length - 1) { newIndex = 0; } this.currentLang = this.langsAvailable[newIndex]; @@ -68,9 +64,7 @@ export class LanguageComponent implements OnInit { this.translate.use(this.currentLang); } - toggleMenu() { this.config.menuVisible = !this.config.menuVisible; } - } diff --git a/src/app/ui/selector/selector.component.html b/src/app/ui/selector/selector.component.html index b75b2232..c6547320 100644 --- a/src/app/ui/selector/selector.component.html +++ b/src/app/ui/selector/selector.component.html @@ -1,9 +1,10 @@ diff --git a/src/app/ui/selector/selector.component.spec.ts b/src/app/ui/selector/selector.component.spec.ts index 13b5c414..f3aacb2b 100644 --- a/src/app/ui/selector/selector.component.spec.ts +++ b/src/app/ui/selector/selector.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SelectorComponent } from './selector.component'; describe('SelectorComponent', () => { - let component: SelectorComponent; - let fixture: ComponentFixture; + let component: SelectorComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SelectorComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [SelectorComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(SelectorComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(SelectorComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/ui/selector/selector.component.ts b/src/app/ui/selector/selector.component.ts index 1f4faf8a..f44b39fb 100644 --- a/src/app/ui/selector/selector.component.ts +++ b/src/app/ui/selector/selector.component.ts @@ -1,30 +1,27 @@ -import {Component, Input, OnInit} from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; interface Item { - label: string, - value: string + label: string; + value: string; } interface SelectorConfig { - label: string, - name: string, - id: string, - selectorNgModel: any, - listItems: Item[] + label: string; + name: string; + id: string; + selectorNgModel: any; + listItems: Item[]; } @Component({ selector: 'framadate-selector', templateUrl: './selector.component.html', - styleUrls: ['./selector.component.scss'] + styleUrls: ['./selector.component.scss'], }) export class SelectorComponent implements OnInit { @Input() selectorConfig: SelectorConfig; - constructor() { - } - - ngOnInit() { - } + constructor() {} + ngOnInit() {} } diff --git a/src/app/ui/theme-selector/theme-selector.component.html b/src/app/ui/theme-selector/theme-selector.component.html index b5ae7924..be8e9c7f 100644 --- a/src/app/ui/theme-selector/theme-selector.component.html +++ b/src/app/ui/theme-selector/theme-selector.component.html @@ -1,25 +1,24 @@ -
-

Thème

+
+

Thème

- - light - + class="choice btn" + [ngClass]="{ 'btn--primary': config.preferences.themeClass === 'theme-light-watermelon' }" + (click)="selectTheme('light-watermelon')" + > + light + - - dark - + class="choice btn" + [ngClass]="{ 'btn--primary': config.preferences.themeClass === 'theme-dark-crystal' }" + (click)="selectTheme('dark-crystal')" + > + dark + - - red - -
+ class="choice btn" + [ngClass]="{ 'btn--primary': config.preferences.themeClass === 'theme-hot-covid' }" + (click)="selectTheme('hot-covid')" + > + red + +
diff --git a/src/app/ui/theme-selector/theme-selector.component.spec.ts b/src/app/ui/theme-selector/theme-selector.component.spec.ts index c31b23bf..4670a91b 100644 --- a/src/app/ui/theme-selector/theme-selector.component.spec.ts +++ b/src/app/ui/theme-selector/theme-selector.component.spec.ts @@ -3,23 +3,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ThemeSelectorComponent } from './theme-selector.component'; describe('ThemeSelectorComponent', () => { - let component: ThemeSelectorComponent; - let fixture: ComponentFixture; + let component: ThemeSelectorComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ThemeSelectorComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ThemeSelectorComponent], + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(ThemeSelectorComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(ThemeSelectorComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/ui/theme-selector/theme-selector.component.ts b/src/app/ui/theme-selector/theme-selector.component.ts index 089b9a53..bf47a583 100644 --- a/src/app/ui/theme-selector/theme-selector.component.ts +++ b/src/app/ui/theme-selector/theme-selector.component.ts @@ -1,25 +1,21 @@ -import {Component, OnInit} from '@angular/core'; -import {ConfigService} from '../../services/config.service'; +import { Component, OnInit } from '@angular/core'; +import { ConfigService } from '../../services/config.service'; @Component({ selector: 'framadate-theme-selector', templateUrl: './theme-selector.component.html', - styleUrls: ['./theme-selector.component.scss'] + styleUrls: ['./theme-selector.component.scss'], }) export class ThemeSelectorComponent implements OnInit { - constructor(public config: ConfigService) { // this.selectTheme('dark-crystal') } - ngOnInit(): void { - } + ngOnInit(): void {} selectTheme(themeName: string) { if (this.config.themeChoices.includes(themeName)) { - this.config.setPreference('themeName', themeName); } - } } diff --git a/src/assets/css/bootstrap-reboot-4.3.1.css b/src/assets/css/bootstrap-reboot-4.3.1.css index b198a50b..7a23e077 100644 --- a/src/assets/css/bootstrap-reboot-4.3.1.css +++ b/src/assets/css/bootstrap-reboot-4.3.1.css @@ -18,13 +18,23 @@ html { -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } -article, aside, figcaption, figure, footer, header, hgroup, main, nav, section { +article, +aside, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section { display: block; } body { margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, + 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 1rem; font-weight: 400; line-height: 1.5; @@ -33,7 +43,7 @@ body { background-color: #fff; } -[tabindex="-1"]:focus { +[tabindex='-1']:focus { outline: 0 !important; } @@ -43,7 +53,12 @@ hr { overflow: visible; } -h1, h2, h3, h4, h5, h6 { +h1, +h2, +h3, +h4, +h5, +h6 { margin-top: 0; margin-bottom: 0.5rem; } @@ -89,7 +104,7 @@ dt { } dd { - margin-bottom: .5rem; + margin-bottom: 0.5rem; margin-left: 0; } @@ -115,11 +130,11 @@ sup { } sub { - bottom: -.25em; + bottom: -0.25em; } sup { - top: -.5em; + top: -0.5em; } a { @@ -136,7 +151,8 @@ a:not([href]):not([tabindex]) { text-decoration: none; } -a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus { +a:not([href]):not([tabindex]):hover, +a:not([href]):not([tabindex]):focus { color: inherit; text-decoration: none; } @@ -149,7 +165,7 @@ pre, code, kbd, samp { - font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; font-size: 1em; } @@ -229,37 +245,37 @@ select { } button, -[type="button"], -[type="reset"], -[type="submit"] { +[type='button'], +[type='reset'], +[type='submit'] { -webkit-appearance: button; } button:not(:disabled), -[type="button"]:not(:disabled), -[type="reset"]:not(:disabled), -[type="submit"]:not(:disabled) { +[type='button']:not(:disabled), +[type='reset']:not(:disabled), +[type='submit']:not(:disabled) { cursor: pointer; } button::-moz-focus-inner, -[type="button"]::-moz-focus-inner, -[type="reset"]::-moz-focus-inner, -[type="submit"]::-moz-focus-inner { +[type='button']::-moz-focus-inner, +[type='reset']::-moz-focus-inner, +[type='submit']::-moz-focus-inner { padding: 0; border-style: none; } -input[type="radio"], -input[type="checkbox"] { +input[type='radio'], +input[type='checkbox'] { box-sizing: border-box; padding: 0; } -input[type="date"], -input[type="time"], -input[type="datetime-local"], -input[type="month"] { +input[type='date'], +input[type='time'], +input[type='datetime-local'], +input[type='month'] { -webkit-appearance: listbox; } @@ -280,7 +296,7 @@ legend { width: 100%; max-width: 100%; padding: 0; - margin-bottom: .5rem; + margin-bottom: 0.5rem; font-size: 1.5rem; line-height: inherit; color: inherit; @@ -291,17 +307,17 @@ progress { vertical-align: baseline; } -[type="number"]::-webkit-inner-spin-button, -[type="number"]::-webkit-outer-spin-button { +[type='number']::-webkit-inner-spin-button, +[type='number']::-webkit-outer-spin-button { height: auto; } -[type="search"] { +[type='search'] { outline-offset: -2px; -webkit-appearance: none; } -[type="search"]::-webkit-search-decoration { +[type='search']::-webkit-search-decoration { -webkit-appearance: none; } diff --git a/src/assets/scss/atoms/_buttons.scss b/src/assets/scss/atoms/_buttons.scss index a9a5d61f..bf787ba5 100644 --- a/src/assets/scss/atoms/_buttons.scss +++ b/src/assets/scss/atoms/_buttons.scss @@ -11,10 +11,10 @@ &:focus, &:hover, &:active { - background-color: rgba($color, .8); + background-color: rgba($color, 0.8); &.btn--outline { - background-color: rgba($color, .2); + background-color: rgba($color, 0.2); } } } @@ -24,12 +24,12 @@ } .btn { - margin: .5rem 0; + margin: 0.5rem 0; padding: 1rem 1.5rem; font-size: 1.6rem; line-height: normal; - border: .2rem solid transparent; - border-radius: .3rem; + border: 0.2rem solid transparent; + border-radius: 0.3rem; font-weight: normal; &--primary { @@ -58,7 +58,7 @@ } &--small { - padding: .75rem 1.25rem; + padding: 0.75rem 1.25rem; } &--full { @@ -68,7 +68,6 @@ &--mini { background-color: $mini-button-color; - } &--link { @@ -76,5 +75,4 @@ margin: 0 auto; display: block; } - } diff --git a/src/assets/scss/atoms/_fonts.scss b/src/assets/scss/atoms/_fonts.scss index 2bf29958..57bb166a 100644 --- a/src/assets/scss/atoms/_fonts.scss +++ b/src/assets/scss/atoms/_fonts.scss @@ -1,56 +1,56 @@ @charset "UTF-8"; @font-face { - font-family: "pt_sans"; - src: url("assets/fonts/pt_sans/pt_sans_regular-webfont.woff2") format("woff2"), - url("assets/fonts/pt_sans/pt_sans_regular-webfont.woff") format("woff"); - font-weight: normal; - font-style: normal; + font-family: 'pt_sans'; + src: url('assets/fonts/pt_sans/pt_sans_regular-webfont.woff2') format('woff2'), + url('assets/fonts/pt_sans/pt_sans_regular-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; } @font-face { - font-family: "pt_sans"; - src: url("assets/fonts/pt_sans/pt_sans_bold-webfont.woff2") format("woff2"), - url("assets/fonts/pt_sans/pt_sans_bold-webfont.woff") format("woff"); - font-weight: bold; - font-style: normal; + font-family: 'pt_sans'; + src: url('assets/fonts/pt_sans/pt_sans_bold-webfont.woff2') format('woff2'), + url('assets/fonts/pt_sans/pt_sans_bold-webfont.woff') format('woff'); + font-weight: bold; + font-style: normal; } @font-face { - font-family: "proza_libre"; - src: url("assets/fonts/proza_libre/prozalibre-regular-webfont.woff2") format("woff2"), - url("assets/fonts/proza_libre/prozalibre-regular-webfont.woff") format("woff"); - font-weight: normal; - font-style: normal; + font-family: 'proza_libre'; + src: url('assets/fonts/proza_libre/prozalibre-regular-webfont.woff2') format('woff2'), + url('assets/fonts/proza_libre/prozalibre-regular-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; } @font-face { - font-family: "proza_libre"; - src: url("assets/fonts/proza_libre/prozalibre-medium-webfont.woff2") format("woff2"), - url("assets/fonts/proza_libre/prozalibre-medium-webfont.woff") format("woff"); - font-weight: 500; - font-style: normal; + font-family: 'proza_libre'; + src: url('assets/fonts/proza_libre/prozalibre-medium-webfont.woff2') format('woff2'), + url('assets/fonts/proza_libre/prozalibre-medium-webfont.woff') format('woff'); + font-weight: 500; + font-style: normal; } @font-face { - font-family: "proza_libre"; - src: url("assets/fonts/proza_libre/prozalibre-semibold-webfont.woff2") format("woff2"), - url("assets/fonts/proza_libre/prozalibre-semibold-webfont.woff") format("woff"); - font-weight: 600; - font-style: normal; + font-family: 'proza_libre'; + src: url('assets/fonts/proza_libre/prozalibre-semibold-webfont.woff2') format('woff2'), + url('assets/fonts/proza_libre/prozalibre-semibold-webfont.woff') format('woff'); + font-weight: 600; + font-style: normal; } @font-face { - font-family: "proza_libre"; - src: url("assets/fonts/proza_libre/prozalibre-bold-webfont.woff2") format("woff2"), - url("assets/fonts/proza_libre/prozalibre-bold-webfont.woff") format("woff"); - font-weight: bold; - font-style: normal; + font-family: 'proza_libre'; + src: url('assets/fonts/proza_libre/prozalibre-bold-webfont.woff2') format('woff2'), + url('assets/fonts/proza_libre/prozalibre-bold-webfont.woff') format('woff'); + font-weight: bold; + font-style: normal; } body { - font-family: $default_font, Arial, Helvetica, sans-serif; - font-size: 1.4rem; + font-family: $default_font, Arial, Helvetica, sans-serif; + font-size: 1.4rem; } h1, @@ -59,8 +59,8 @@ h3, h4, h5, h6 { - font-family: $title_font, "Brie Light", "Arial", "DejaVu Sans Mono"; + font-family: $title_font, 'Brie Light', 'Arial', 'DejaVu Sans Mono'; } -.nobold{ - font-weight: normal; +.nobold { + font-weight: normal; } diff --git a/src/assets/scss/atoms/_forms.scss b/src/assets/scss/atoms/_forms.scss index b305701a..b164356c 100644 --- a/src/assets/scss/atoms/_forms.scss +++ b/src/assets/scss/atoms/_forms.scss @@ -12,8 +12,8 @@ select { input { margin-right: 1ch; - &[type="date"]::after { - content: "au format JJ/MM/AAAA"; + &[type='date']::after { + content: 'au format JJ/MM/AAAA'; display: inline-block; position: relative; } @@ -25,7 +25,6 @@ textarea { padding: 1rem; border: 1px solid $secondary_color; border-bottom: 3px solid $primary_color; - } input, @@ -49,7 +48,7 @@ option { border-radius: 0; background-color: transparent; - background-image: url("./assets/img/fleche_bas.svg"); + background-image: url('./assets/img/fleche_bas.svg'); padding-right: 2.5rem; background-repeat: no-repeat; @@ -97,7 +96,6 @@ input { } } - .comment { border-left: 6px solid $ugly-purple; margin-top: 25px; @@ -107,7 +105,6 @@ input { } .cname { - font-weight: bold; } @@ -119,7 +116,8 @@ input { max-width: 200px; } -input[type=text], textarea { +input[type='text'], +textarea { max-width: 350px; } @@ -128,7 +126,6 @@ li { } h2 { - } .next { @@ -145,7 +142,9 @@ textarea { font-weight: normal; } -select, input, textarea { +select, +input, +textarea { @extend .clickable; &:active, @@ -160,6 +159,7 @@ select, input, textarea { width: 100%; } -.btn, a { +.btn, +a { cursor: pointer; } diff --git a/src/assets/scss/atoms/_links.scss b/src/assets/scss/atoms/_links.scss index d8244357..ef2d668f 100644 --- a/src/assets/scss/atoms/_links.scss +++ b/src/assets/scss/atoms/_links.scss @@ -15,7 +15,7 @@ a { &::before, &::after { - content: ""; + content: ''; } &.next::before, @@ -55,7 +55,6 @@ a { &.next::before, &.prev::after { background-color: rgba($primary_color, 0.7); - } } diff --git a/src/assets/scss/atoms/_lists.scss b/src/assets/scss/atoms/_lists.scss index 03bb3631..9f44090c 100644 --- a/src/assets/scss/atoms/_lists.scss +++ b/src/assets/scss/atoms/_lists.scss @@ -1 +1 @@ -@charset "UTF-8"; \ No newline at end of file +@charset "UTF-8"; diff --git a/src/assets/scss/atoms/_main.scss b/src/assets/scss/atoms/_main.scss index e7453ad7..296ec715 100644 --- a/src/assets/scss/atoms/_main.scss +++ b/src/assets/scss/atoms/_main.scss @@ -7,4 +7,3 @@ main { margin: 0 auto; padding: 0 2rem; } - diff --git a/src/assets/scss/default.scss b/src/assets/scss/default.scss index 2410541b..596d83bb 100644 --- a/src/assets/scss/default.scss +++ b/src/assets/scss/default.scss @@ -1,28 +1,28 @@ @charset "UTF-8"; html { - font-size: 62.5%; /* 10px */ - font-size: calc(1em * 0.625); /* fix */ - color: $font_color; + font-size: 62.5%; /* 10px */ + font-size: calc(1em * 0.625); /* fix */ + color: $font_color; } .text-right { - text-align: right; + text-align: right; } .Language- { - padding-right: 2em; - font-family: SourceSansPro; - font-size: 11px; - font-weight: normal; - font-stretch: normal; - font-style: normal; - line-height: normal; - letter-spacing: normal; - color: var(--black); - border: none; + padding-right: 2em; + font-family: SourceSansPro; + font-size: 11px; + font-weight: normal; + font-stretch: normal; + font-style: normal; + line-height: normal; + letter-spacing: normal; + color: var(--black); + border: none; } .select_language { - display: none; -} \ No newline at end of file + display: none; +} diff --git a/src/assets/scss/molecules/_debug.scss b/src/assets/scss/molecules/_debug.scss index 892dfcbd..2420b0ef 100644 --- a/src/assets/scss/molecules/_debug.scss +++ b/src/assets/scss/molecules/_debug.scss @@ -1,15 +1,15 @@ .debug { - font-size: 1rem; - background: $dark-lavender; - margin: 2em; - padding: 2em; - - ul { - list-style-type: none; - } - - pre { font-size: 1rem; - padding: 0.5em; - } + background: $dark-lavender; + margin: 2em; + padding: 2em; + + ul { + list-style-type: none; + } + + pre { + font-size: 1rem; + padding: 0.5em; + } } diff --git a/src/assets/scss/molecules/_flex-line.scss b/src/assets/scss/molecules/_flex-line.scss index 0bd372f1..85cb4484 100644 --- a/src/assets/scss/molecules/_flex-line.scss +++ b/src/assets/scss/molecules/_flex-line.scss @@ -9,4 +9,4 @@ & > select { flex-grow: 1; } -} \ No newline at end of file +} diff --git a/src/assets/scss/molecules/_logo.scss b/src/assets/scss/molecules/_logo.scss index 2c9e2c72..90607284 100644 --- a/src/assets/scss/molecules/_logo.scss +++ b/src/assets/scss/molecules/_logo.scss @@ -1,4 +1,5 @@ -.logo_first, .logo_second { +.logo_first, +.logo_second { padding-left: 0; padding-right: 0; } diff --git a/src/assets/scss/themes/_all.scss b/src/assets/scss/themes/_all.scss index 8dd2cea3..95d52bb6 100644 --- a/src/assets/scss/themes/_all.scss +++ b/src/assets/scss/themes/_all.scss @@ -1,3 +1,3 @@ -@import "light"; -@import "dark"; -@import "red"; +@import 'light'; +@import 'dark'; +@import 'red'; diff --git a/src/assets/scss/themes/_dark.scss b/src/assets/scss/themes/_dark.scss index 34c6e185..aa8e2f2c 100644 --- a/src/assets/scss/themes/_dark.scss +++ b/src/assets/scss/themes/_dark.scss @@ -1,5 +1,4 @@ #big_container { - &.theme-dark-crystal { background: #222; color: #ddd; @@ -12,12 +11,16 @@ background-color: #1b6d85; } - .btn--primary:focus, .btn--primary:hover, .btn--primary:active, + .btn--primary:focus, + .btn--primary:hover, + .btn--primary:active, .btn--primary { background-color: #1b6d85; } - .btn--warning:focus, .btn--warning:hover, .btn--warning:active, + .btn--warning:focus, + .btn--warning:hover, + .btn--warning:active, .btn--warning { background-color: #554685; } @@ -35,10 +38,10 @@ color: #ccc; } - .lang_icon, .menu_icon { + .lang_icon, + .menu_icon { fill: #1b6d85 !important; color: #1b6d85 !important; } - } } diff --git a/src/assets/scss/themes/_light.scss b/src/assets/scss/themes/_light.scss index fd612607..baaeb8a1 100644 --- a/src/assets/scss/themes/_light.scss +++ b/src/assets/scss/themes/_light.scss @@ -2,5 +2,4 @@ &.theme-light-watermelon { background: #fff; } - } diff --git a/src/assets/scss/themes/_red.scss b/src/assets/scss/themes/_red.scss index 154e2e7c..295337bd 100644 --- a/src/assets/scss/themes/_red.scss +++ b/src/assets/scss/themes/_red.scss @@ -7,7 +7,10 @@ background-color: #850003; } - .btn--primary:focus, .btn--primary:hover, .btn--primary:active, .btn--primary { + .btn--primary:focus, + .btn--primary:hover, + .btn--primary:active, + .btn--primary { background-color: #850003 !important; } } diff --git a/src/assets/scss/variables.scss b/src/assets/scss/variables.scss index 8f8f8e87..e7e1e8fe 100644 --- a/src/assets/scss/variables.scss +++ b/src/assets/scss/variables.scss @@ -4,16 +4,16 @@ $camo: #839546; $black: #000000; $ugly-purple: #b24eb7; -$lavender-pink : #e9bdeb; +$lavender-pink: #e9bdeb; $white: #ffffff; $dark-lavender: #7d6c99; $dusty-orange: #f18647; $violet: #bd10e0; $red: #cd0000; $cool-grey: #aeafb1; -$warm-grey:#807e7e; -$wisteria:#bf83c2; -$pale-purple:#d198d4; +$warm-grey: #807e7e; +$wisteria: #bf83c2; +$pale-purple: #d198d4; // interpretations in app $primary_color: $ugly-purple; $secondary_color: $lavender-pink; @@ -23,9 +23,9 @@ $logo_color_2: $camo; $legend_color: $dark-lavender; $legend_color_2: $dusty-orange; $choice_select_border_color: $cool-grey; -$hover-color:$warm-grey; -$clicked-color:$wisteria; -$mini-button-color:$pale-purple; +$hover-color: $warm-grey; +$clicked-color: $wisteria; +$mini-button-color: $pale-purple; // FONT -$default_font : "pt_sans"; -$title_font: "proza_libre"; +$default_font: 'pt_sans'; +$title_font: 'proza_libre'; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index cc5c5ac1..7e5e9188 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,9 +1,9 @@ // This file can be replaced during build by using the `fileReplacements` array. // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. // The list of file replacements can be found in `angular.json`. -let baseURL = "http://localhost:8000/"; -const baseURLProd = "https://framadate.org/"; -const baseURLDemo = "https://framadate-api.cipherbliss.com/"; +let baseURL = 'http://localhost:8000/'; +const baseURLProd = 'https://framadate.org/'; +const baseURLDemo = 'https://framadate-api.cipherbliss.com/'; const apiVersion = 1; const testOnDemo = 0; if (testOnDemo) { @@ -12,7 +12,7 @@ if (testOnDemo) { export const environment = { production: false, baseHref: baseURL, - baseApiHref: baseURL + "api/v" + apiVersion + baseApiHref: baseURL + 'api/v' + apiVersion, }; /* diff --git a/src/index.html b/src/index.html index 00a293a7..703c67d3 100644 --- a/src/index.html +++ b/src/index.html @@ -1,16 +1,16 @@ - + - - - Framadate - + + + Framadate + - - + + - - - - - + + + + + diff --git a/src/main.ts b/src/main.ts index c7b673cf..207c6dde 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,8 +5,9 @@ import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; if (environment.production) { - enableProdMode(); + enableProdMode(); } -platformBrowserDynamic().bootstrapModule(AppModule) - .catch(err => console.error(err)); +platformBrowserDynamic() + .bootstrapModule(AppModule) + .catch((err) => console.error(err)); diff --git a/src/polyfills.ts b/src/polyfills.ts index 7c9e495f..0a3281c4 100644 --- a/src/polyfills.ts +++ b/src/polyfills.ts @@ -59,8 +59,7 @@ import '@angular/localize/init'; /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ -import 'zone.js/dist/zone'; // Included with Angular CLI. - +import 'zone.js/dist/zone'; // Included with Angular CLI. /*************************************************************************************************** * APPLICATION IMPORTS diff --git a/src/stories/0-Welcome.stories.ts b/src/stories/0-Welcome.stories.ts index fb32db9e..60b18d7a 100644 --- a/src/stories/0-Welcome.stories.ts +++ b/src/stories/0-Welcome.stories.ts @@ -1,15 +1,15 @@ import { Welcome } from '@storybook/angular/demo'; export default { - title: 'Welcome', - component: Welcome, + title: 'Welcome', + component: Welcome, }; export const ToStorybook = () => ({ - component: Welcome, - props: {}, + component: Welcome, + props: {}, }); ToStorybook.story = { - name: 'to Storybook', + name: 'to Storybook', }; diff --git a/src/stories/1-Button.stories.ts b/src/stories/1-Button.stories.ts index 14a3bc25..9eece755 100644 --- a/src/stories/1-Button.stories.ts +++ b/src/stories/1-Button.stories.ts @@ -4,49 +4,49 @@ import { linkTo } from '@storybook/addon-links'; import { Button } from '@storybook/angular/demo'; export default { - title: 'Button', - component: Button, + title: 'Button', + component: Button, }; export const Text = () => ({ - component: Button, - props: { - text: 'Hello Button', - }, + component: Button, + props: { + text: 'Hello Button', + }, }); export const Emoji = () => ({ - component: Button, - props: { - text: '😀 😎 👍 💯', - }, + component: Button, + props: { + text: '😀 😎 👍 💯', + }, }); Emoji.story = { - parameters: { notes: 'My notes on a button with emojis' }, + parameters: { notes: 'My notes on a button with emojis' }, }; export const WithSomeEmojiAndAction = () => ({ - component: Button, - props: { - text: '😀 😎 👍 💯', - onClick: action('This was clicked OMG'), - }, + component: Button, + props: { + text: '😀 😎 👍 💯', + onClick: action('This was clicked OMG'), + }, }); WithSomeEmojiAndAction.story = { - name: 'with some emoji and action', - parameters: { notes: 'My notes on a button with emojis' }, + name: 'with some emoji and action', + parameters: { notes: 'My notes on a button with emojis' }, }; export const ButtonWithLinkToAnotherStory = () => ({ - component: Button, - props: { - text: 'Go to Welcome Story', - onClick: linkTo('Welcome'), - }, + component: Button, + props: { + text: 'Go to Welcome Story', + onClick: linkTo('Welcome'), + }, }); ButtonWithLinkToAnotherStory.story = { - name: 'button with link to another story', + name: 'button with link to another story', }; diff --git a/src/styles.scss b/src/styles.scss index 5d489038..422ca63d 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -1,20 +1,20 @@ /* You can add global styles to this file, and also import other style files */ -@import "~bulma/bulma"; -@import "assets/scss/variables"; -@import "assets/scss/default"; -@import "assets/scss/themes/all"; -@import "assets/scss/useful_classes"; +@import '~bulma/bulma'; +@import 'assets/scss/variables'; +@import 'assets/scss/default'; +@import 'assets/scss/themes/all'; +@import 'assets/scss/useful_classes'; -@import "assets/scss/atoms/main"; -@import "assets/scss/atoms/section"; -@import "assets/scss/atoms/fonts"; -@import "assets/scss/atoms/headings"; -@import "assets/scss/atoms/buttons"; -@import "assets/scss/atoms/links"; -@import "assets/scss/atoms/forms"; -@import "assets/scss/atoms/lists"; -@import "assets/scss/atoms/images"; +@import 'assets/scss/atoms/main'; +@import 'assets/scss/atoms/section'; +@import 'assets/scss/atoms/fonts'; +@import 'assets/scss/atoms/headings'; +@import 'assets/scss/atoms/buttons'; +@import 'assets/scss/atoms/links'; +@import 'assets/scss/atoms/forms'; +@import 'assets/scss/atoms/lists'; +@import 'assets/scss/atoms/images'; -@import "assets/scss/molecules/logo"; -@import "assets/scss/molecules/debug"; -@import "assets/scss/molecules/flex-line"; +@import 'assets/scss/molecules/logo'; +@import 'assets/scss/molecules/debug'; +@import 'assets/scss/molecules/flex-line'; diff --git a/src/test.ts b/src/test.ts index 16317897..da9049dc 100644 --- a/src/test.ts +++ b/src/test.ts @@ -2,18 +2,12 @@ import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; +import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; declare const require: any; // First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); +getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules.