display de sondage de démo

This commit is contained in:
tykayn 2021-04-24 12:31:34 +02:00 committed by Baptiste Lemoine
parent 6cb32cb2e1
commit 21aa634ce5
7 changed files with 56 additions and 32 deletions

View File

@ -26,5 +26,34 @@
canal Matrix
</a>
</p>
<div class="demo" *ngIf="!env.production">
Environnement de développement: voici des liens de démonstration issus des fixtures Doctrine de
date-poll-api.
<button class="btn is-primary" [routerLink]="['/poll/aujourdhui-ou-demain/consultation']">
consulter le sondage
<strong>
aujourdhui-ou-demain
</strong>
</button>
<button class="btn is-primary" [routerLink]="['/poll/citron/hash/consultation']">
<strong>
citron
</strong>
</button>
<button class="btn is-primary" [routerLink]="['/poll/dessin-anime/consultation']">
<strong>
dessin-anime
</strong>
</button>
<button class="btn is-primary" routerLink="/poll/citron/consultation/9199bdd9e0d4b29deafbf3463c0727fc">
consulter le sondage
<strong>
citron
</strong>
avec son hash md5 de mot de passe intégré
</button>
</div>
</div>
</footer>

View File

@ -13,28 +13,7 @@
| translate
}}
</blockquote>
<div class="demo" *ngIf="!env.production">
Environnement de développement: voici des liens de démonstration issus des fixtures Doctrine de
date-poll-api.
<button class="btn is-primary" [routerLink]="['/poll/aujourdhui-ou-demain/consultation']">
consulter le sondage
<strong>
aujourdhui-ou-demain
</strong>
</button>
<button
class="btn is-primary"
routerLink="/poll/citron/consultation/9199bdd9e0d4b29deafbf3463c0727fc"
>
consulter le sondage
<strong>
citron
</strong>
avec son hash md5 de mot de passe intégré
</button>
</div>
<img src="assets/img/undraw_group_selfie_ijc6.svg" alt="image WIP" />
</div>
<div class="columns">

View File

@ -120,6 +120,8 @@ export class ApiService {
// TODO: this interceptor should be avoided if backends returns the good object
const adapterInterceptor: number = this.axiosInstance.interceptors.response.use(
(response: AxiosResponse): AxiosResponse => {
console.log('response', response);
if (response.data['poll']) {
// response from cipherbliss backend, actually used by oldstuffModule
response.data = response.data['poll'];

View File

@ -12,6 +12,13 @@
<p class="card-header-title">{{ poll.title }}</p>
<!-- <p class="card-header-icon">author : {{ poll.owner?.pseudo }}</p>-->
</header>
<button
class="btn is-info"
(click)="isCompactMode = !isCompactMode"
[ngClass]="{ 'is-primary': isCompactMode, 'is-default': !isCompactMode }"
>
changer d'affichage
</button>
<div class="card-content">
<div class="content">
<p>{{ poll.description }}</p>
@ -28,12 +35,13 @@
</div>
</div>
<footer class="card-footer" *ngIf="!isArchived">
<a routerLink="{{ '../../../poll/' + poll.slug + '/participation' }}" class="card-footer-item">
Participer
</a>
<a routerLink="{{ '../../../poll/' + poll.slug + '/administration' }}" class="card-footer-item">
Administrer
</a>
TODO links
<!-- <a routerLink="{{ '../../../poll/' + poll.slug + '/participation' }}" class="card-footer-item">-->
<!-- Participer-->
<!-- </a>-->
<!-- <a routerLink="{{ '../../../poll/' + poll.slug + '/administration' }}" class="card-footer-item">-->
<!-- Administrer-->
<!-- </a>-->
</footer>
</div>
</div>

View File

@ -36,6 +36,7 @@ export class ConsultationComponent implements OnInit, OnDestroy {
console.log('params', params);
this.pollSlug = params.get('slug');
this.passHash = params.get('hash');
console.log('hash, slug', this.passHash, this.pollSlug);
if (this.passHash) {
this.pollService.loadPollBySlugWithPasswordHash(this.pollSlug, this.passHash);
} else {

View File

@ -1,17 +1,20 @@
<div class="box" *ngFor="let choice of poll.choices">
<div class="columns is-vcentered is-mobile">
<div class="column">
<label class="label">{{ choice.label }}</label>
<label class="label">{{ choice.name }}</label>
</div>
<div class="column is-narrow">
<div class="buttons has-addons is-right" (click)="openModal(choice)">
<button class="button is-white">
<img class="image is-24x24" src="../../../assets/img/icon_voter_YES.svg" />
<span class="counter" *ngIf="choice.counts">
{{ choice.counts.get(answerEnum.YES) }}
</span>
</button>
<button class="button is-white" *ngIf="poll.configuration.isMaybeAnswerAvailable">
<button class="button is-white" *ngIf="poll.allowed_answers.indexOf('maybe') !== -1">
<img class="image is-24x24" src="../../../assets/img/icon_voter_MAYBE.svg" />
{{ choice.counts.get(answerEnum.MAYBE) }}
<!-- {{ choice.counts.get(answerEnum.MAYBE) }}-->
</button>
</div>
</div>

View File

@ -18,7 +18,9 @@ export class PollResultsCompactComponent implements OnInit {
constructor(private modalService: ModalService) {}
ngOnInit(): void {}
ngOnInit(): void {
console.log('this.poll', this.poll);
}
public openModal(choice: Choice): void {
const config: MatDialogConfig<Choice> = { data: choice };