From e3b9a829282ec00c6f48caeec48274485199cb46 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Fri, 11 Feb 2022 09:19:34 +0100 Subject: [PATCH] bar style, nav buttons in vote --- src/app/core/models/stack.model.ts | 2 +- src/app/core/services/api.service.ts | 5 +-- src/app/core/services/poll.service.ts | 16 ++++---- .../consultation-user.component.html | 27 +++++++----- .../consultation-user.component.ts | 2 +- .../consultation/consultation.component.html | 2 +- .../consultation/consultation.component.ts | 2 +- .../consultation/edit/edit.component.html | 6 +++ .../poll-results-detailed.component.ts | 4 +- .../poll-results-dinum.component.scss | 32 --------------- .../results-rounded.component.ts | 4 +- src/environments/endpoints.ts | 2 +- src/styles/partials/_forms.scss | 41 +++++++++++++++++++ 13 files changed, 82 insertions(+), 63 deletions(-) diff --git a/src/app/core/models/stack.model.ts b/src/app/core/models/stack.model.ts index 4d7610e3..ad9492ac 100644 --- a/src/app/core/models/stack.model.ts +++ b/src/app/core/models/stack.model.ts @@ -3,7 +3,7 @@ import { Owner } from './owner.model'; export class Stack { public id: number; - public poll_custom_url: string; + public custom_url: string; public pass_hash: string; public pseudo = 'Choque Nourrice'; public comment = 'Le beau commentaire de Choque Nourrice'; diff --git a/src/app/core/services/api.service.ts b/src/app/core/services/api.service.ts index d488522b..d29aec26 100644 --- a/src/app/core/services/api.service.ts +++ b/src/app/core/services/api.service.ts @@ -142,10 +142,7 @@ export class ApiService { public async createComment(slug: string, comment: string): Promise { try { - return await this.axiosInstance.post( - `${this.baseHref}${this.commentsEndpoint}/${slug}${this.commentsEndpoint}`, - comment - ); + return await this.axiosInstance.post(`${this.baseHref}${this.commentsEndpoint}/${slug}`, comment); } catch (error) { ApiService.handleError(error); } diff --git a/src/app/core/services/poll.service.ts b/src/app/core/services/poll.service.ts index 998da138..9fdfca9a 100644 --- a/src/app/core/services/poll.service.ts +++ b/src/app/core/services/poll.service.ts @@ -21,7 +21,6 @@ import { DateUtilitiesService } from './date.utilities.service'; import { Owner } from '../models/owner.model'; import { Stack } from '../models/stack.model'; import { Vote } from '../models/vote.model'; -import { defaultTimeOfDay } from '../../../../mocks/old-stuff/config/defaultConfigs'; import { ClipboardService } from 'ngx-clipboard'; import { TranslateService } from '@ngx-translate/core'; @@ -211,7 +210,7 @@ export class PollService implements Resolve { } const loadedPoll = this._poll.getValue(); if (loadedPoll) { - this.storageService.vote_stack.poll_custom_url = loadedPoll.custom_url; + this.storageService.vote_stack.custom_url = loadedPoll.custom_url; return loadedPoll; } else { this.router.navigate(['page-not-found']); @@ -272,15 +271,15 @@ export class PollService implements Resolve { * update poll and parse its fields * @param poll */ - public updateCurrentPoll(poll: Poll): Poll { + public updateCurrentPoll(poll: Poll, displayToast = false): Poll { console.log('this.storageService.vote_stack.id', this.storageService.vote_stack.id); - // if (!this.storageService.vote_stack.id || this.storageService.vote_stack.poll_custom_url !== poll.custom_url) { + // if (!this.storageService.vote_stack.id || this.storageService.vote_stack.custom_url !== poll.custom_url) { // console.log('set base choices', poll.choices); // // set the choices only the first time the poll loads, or if we changed the poll // console.log( - // 'this.storageService.vote_stack.poll_custom_url', - // this.storageService.vote_stack.poll_custom_url + // 'this.storageService.vote_stack.custom_url', + // this.storageService.vote_stack.custom_url // ); // this.storageService.setChoicesForVoteStack(poll.choices); // } @@ -289,8 +288,9 @@ export class PollService implements Resolve { console.log('next poll', poll); this.storageService.setChoicesForVoteStack(poll.choices); - - this.toastService.display(`sondage ${poll.title} bien mis à jour`, 'success'); + if (displayToast) { + this.toastService.display(`sondage ${poll.title} bien mis à jour`, 'success'); + } return poll; } diff --git a/src/app/features/consultation/consultation-user/consultation-user.component.html b/src/app/features/consultation/consultation-user/consultation-user.component.html index ef12cd04..400c0a4f 100644 --- a/src/app/features/consultation/consultation-user/consultation-user.component.html +++ b/src/app/features/consultation/consultation-user/consultation-user.component.html @@ -8,15 +8,22 @@ {{ 'owner.name_label' | translate }} - - + +
+
+ + +
diff --git a/src/app/features/consultation/consultation-user/consultation-user.component.ts b/src/app/features/consultation/consultation-user/consultation-user.component.ts index bd93b53e..8c7a0f1a 100644 --- a/src/app/features/consultation/consultation-user/consultation-user.component.ts +++ b/src/app/features/consultation/consultation-user/consultation-user.component.ts @@ -37,7 +37,7 @@ export class ConsultationUserComponent implements OnInit { * create a new vote stack */ addVoteStack(): void { - this.storageService.vote_stack.poll_custom_url = this.pollService._poll.getValue().custom_url; + this.storageService.vote_stack.custom_url = this.pollService._poll.getValue().custom_url; this.pollService.pass_hash = this.pass_hash; this.toastService.display('envoi du vote ....'); diff --git a/src/app/features/consultation/consultation.component.html b/src/app/features/consultation/consultation.component.html index 4085fec8..6b9408e6 100644 --- a/src/app/features/consultation/consultation.component.html +++ b/src/app/features/consultation/consultation.component.html @@ -1,6 +1,6 @@ -
+
+