From 40c0c3888902b046c9ab9f65549c57abbff5a1c3 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Mon, 8 Feb 2021 11:32:58 +0100 Subject: [PATCH] testing ciphering page --- package.json | 7 +-- src/app/app.module.ts | 3 +- src/app/core/services/poll.service.ts | 1 - .../administration/form/form.component.ts | 28 +++++++---- .../features/old-stuff/config/PollConfig.ts | 1 - .../visibility/visibility.component.html | 2 +- .../old-stuff/services/config.service.ts | 1 - .../ciphering/ciphering.component.html | 22 +++++++++ .../ciphering/ciphering.component.scss | 0 .../ciphering/ciphering.component.spec.ts | 24 ++++++++++ .../ciphering/ciphering.component.ts | 47 +++++++++++++++++++ src/app/routes-framadate.ts | 5 ++ yarn.lock | 5 ++ 13 files changed, 128 insertions(+), 18 deletions(-) create mode 100644 src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.html create mode 100644 src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.scss create mode 100644 src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.spec.ts create mode 100644 src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.ts diff --git a/package.json b/package.json index c95d9b98..21f26d21 100644 --- a/package.json +++ b/package.json @@ -21,9 +21,9 @@ "mock:server": "json-server --port 8000 --watch ./mocks/db.json --routes ./mocks/routes.json", "start:proxy": "ng serve --proxy-config proxy.conf.json", "start:proxymock": "concurrently --kill-others \"yarn mock:server\" \"yarn start:proxy\"", - "i18n:init": "ngx-translate-extract --input ./src --output ./src/assets/i18n/template.json --key-as-default-value --replace --format json", - "i18n:extract": "ngx-translate-extract --input ./src --output ./src/assets/i18n/{en,da,de,fi,nb,nl,sv}.json --clean --format json" - }, + "i18n:init": "ngx-translate-extract --input ./src --output ./src/assets/i18n/template.json --key-as-default-value --replace --format json", + "i18n:extract": "ngx-translate-extract --input ./src --output ./src/assets/i18n/{en,da,de,fi,nb,nl,sv}.json --clean --format json" + }, "private": false, "dependencies": { "@angular/animations": "^9.1.1", @@ -52,6 +52,7 @@ "ngx-clipboard": "^13.0.0", "ngx-markdown": "^9.0.0", "ngx-webstorage": "^5.0.0", + "node-forge": "^0.10.0", "primeng": "^9.0.6", "quill": "^1.3.7", "rxjs": "^6.5.5", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 8a8301b6..1fb42f4d 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -26,6 +26,7 @@ import { SharedModule } from './shared/shared.module'; import { CguComponent } from './features/shared/components/ui/static-pages/cgu/cgu.component'; import { LegalComponent } from './features/shared/components/ui/static-pages/legal/legal.component'; import { PrivacyComponent } from './features/shared/components/ui/static-pages/privacy/privacy.component'; +import { CipheringComponent } from './features/shared/components/ui/static-pages/ciphering/ciphering.component'; registerLocaleData(localeEn, 'en-EN'); registerLocaleData(localeFr, 'fr-FR'); @@ -40,7 +41,7 @@ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader { } @NgModule({ - declarations: [AppComponent, CguComponent, LegalComponent, PrivacyComponent], + declarations: [AppComponent, CguComponent, LegalComponent, PrivacyComponent, CipheringComponent], imports: [ AppRoutingModule, BrowserAnimationsModule, diff --git a/src/app/core/services/poll.service.ts b/src/app/core/services/poll.service.ts index 501ff08b..14477d06 100644 --- a/src/app/core/services/poll.service.ts +++ b/src/app/core/services/poll.service.ts @@ -228,7 +228,6 @@ export class PollService implements Resolve { adminKey: '', // key to change config of the poll owner_modifier_token: '', // key to change a vote stack canModifyAnswers: newpoll.configuration.isAllowingtoChangeOwnAnswers, // bool for the frontend selector - whoModifiesAnswers: newpoll.configuration.whoCanChangeAnswers, // everybody, self, nobody (: just admin) whoCanChangeAnswers: newpoll.configuration.whoCanChangeAnswers, // everybody, self, nobody (: just admin) dateList: newpoll.dateChoices, // sets of days as strings, config to set identical time for days in a special days poll timeList: newpoll.timeChoices, // ranges of time expressed as strings diff --git a/src/app/features/administration/form/form.component.ts b/src/app/features/administration/form/form.component.ts index 2a17a7d7..abdb00a9 100644 --- a/src/app/features/administration/form/form.component.ts +++ b/src/app/features/administration/form/form.component.ts @@ -1,13 +1,11 @@ import { ChangeDetectorRef, Component, Inject, Input, OnInit } from '@angular/core'; import { Poll } from '../../../core/models/poll.model'; -import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { UuidService } from '../../../core/services/uuid.service'; import { ApiService } from '../../../core/services/api.service'; import { ToastService } from '../../../core/services/toast.service'; import { PollService } from '../../../core/services/poll.service'; -import { DateUtilities } from '../../old-stuff/config/DateUtilities'; import { DOCUMENT } from '@angular/common'; -import { CdkDragDrop } from '@angular/cdk/drag-drop'; import { Router } from '@angular/router'; @Component({ @@ -28,7 +26,6 @@ export class FormComponent implements OnInit { private uuidService: UuidService, private toastService: ToastService, private pollService: PollService, - public dateUtilities: DateUtilities, private apiService: ApiService, private router: Router, @Inject(DOCUMENT) private document: any @@ -48,10 +45,21 @@ export class FormComponent implements OnInit { creatorEmail: ['', [Validators.required]], slug: [this.uuidService.getUUID(), [Validators.required]], description: ['', [Validators.required]], - choices: new FormArray([]), - // configuration: new FormGroup(), - whoModifiesAnswers: ['', [Validators.required]], - whoCanChangeAnswers: ['', [Validators.required]], + choices: this.fb.array([ + this.fb.group({ + label: ['', [Validators.required]], + imageUrl: ['', [Validators.required]], + }), + ]), + configuration: this.fb.group({ + whoCanChangeAnswers: ['everybody', [Validators.required]], + // isProtectedByPassword: false, + // isOwnerNotifiedByEmailOnNewVote: false, + // isOwnerNotifiedByEmailOnNewComment: false, + // isMaybeAnswerAvailable: false, + // areResultsPublic: true, + // expiracyNumberOfDays: 60, + }), isAboutDate: [true, [Validators.required]], isProtectedByPassword: [false, [Validators.required]], startDateInterval: ['', [Validators.required]], @@ -71,6 +79,7 @@ export class FormComponent implements OnInit { if (showDemoValues) { this.setDemoValues(); + this.toastService.display('default values filled for demo'); } } @@ -85,9 +94,8 @@ export class FormComponent implements OnInit { creatorPseudo: 'Chuck Norris', creatorEmail: 'chucknorris@example.com', isAboutDate: true, - hasSeveralHours: true, + // hasSeveralHours: true, configuration: { - whoModifiesAnswers: 'everybody', whoCanChangeAnswers: 'everybody', isProtectedByPassword: false, isOwnerNotifiedByEmailOnNewVote: false, diff --git a/src/app/features/old-stuff/config/PollConfig.ts b/src/app/features/old-stuff/config/PollConfig.ts index f6eb71b8..483b5539 100644 --- a/src/app/features/old-stuff/config/PollConfig.ts +++ b/src/app/features/old-stuff/config/PollConfig.ts @@ -62,7 +62,6 @@ export class PollConfig { 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) 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/features/old-stuff/pages/visibility/visibility.component.html b/src/app/features/old-stuff/pages/visibility/visibility.component.html index 624751bc..14abb51a 100644 --- a/src/app/features/old-stuff/pages/visibility/visibility.component.html +++ b/src/app/features/old-stuff/pages/visibility/visibility.component.html @@ -73,7 +73,7 @@ name="modificationScope" id="modificationScope" *ngIf="true == !!config.canModifyAnswers" - [(ngModel)]="config.whoModifiesAnswers" + [(ngModel)]="config.whoCanChangeAnswers" [disabled]="false == !!config.canModifyAnswers" >