mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
random autofill on view page of a poll
This commit is contained in:
parent
e86e7af5e1
commit
406bf71b92
@ -3,8 +3,8 @@ import { Owner } from './owner.model';
|
||||
|
||||
export class Stack {
|
||||
public id: number;
|
||||
public pseudo: string = 'Choque Nourrice';
|
||||
public comment: string = 'Le beau commentaire de Choque Nourrice';
|
||||
public pseudo = 'Choque Nourrice';
|
||||
public comment = 'Le beau commentaire de Choque Nourrice';
|
||||
public owner: Owner = new Owner();
|
||||
public votes: Vote[];
|
||||
public votes: Vote[] = [];
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import {
|
||||
import { Poll } from '../models/poll.model';
|
||||
import { Owner } from '../models/owner.model';
|
||||
import { DateUtilitiesService } from './date.utilities.service';
|
||||
import { ToastService } from './toast.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@ -44,8 +45,13 @@ export class StorageService {
|
||||
@LocalStorage()
|
||||
public choices: Choice[] = [];
|
||||
|
||||
constructor(public dateUtilities: DateUtilitiesService) {
|
||||
constructor(
|
||||
public dateUtilities: DateUtilitiesService,
|
||||
|
||||
private toastService: ToastService
|
||||
) {
|
||||
if (environment.autofill) {
|
||||
this.toastService.display('autofill des sondages utilisateur');
|
||||
this.userPolls.push(new Poll(new Owner(), 'Démo: Anniversaire de tonton Patrick', 'aujourdhui-ou-demain'));
|
||||
this.userPolls.push(new Poll(new Owner(), 'Démo: Atelier cuisine du quartier', 'aujourdhui-ou-demain'));
|
||||
this.userPolls.push(
|
||||
@ -64,7 +70,9 @@ export class StorageService {
|
||||
// text choices
|
||||
for (const choice of choices_list) {
|
||||
if (environment.autofill) {
|
||||
this.vote_stack.votes.push(new Vote(choice.id, 'yes'));
|
||||
this.toastService.display('autofill au hasard des votes à ce sondage');
|
||||
const defaultvalue = Math.random() > 0.75 ? 'yes' : '';
|
||||
this.vote_stack.votes.push(new Vote(choice.id, defaultvalue));
|
||||
} else {
|
||||
this.vote_stack.votes.push(new Vote(choice.id));
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
<div class="date-choices" *ngIf="poll.kind == 'date'">
|
||||
<div class="box" *ngFor="let group of poll.choices_grouped">
|
||||
<h3 class="title is-3">
|
||||
{{ group.date_string }}
|
||||
{{ showAsDate(group.date_string) | date: 'fullDate':'Europe/Paris':'fr_FR' }}
|
||||
</h3>
|
||||
<div class="box" *ngFor="let choice of group.choices">
|
||||
<div class="time-slice-choice" *ngFor="let choice of group.choices">
|
||||
<div class="columns is-vcentered is-mobile">
|
||||
<div class="column">
|
||||
<label class="label">
|
||||
@ -18,9 +18,9 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="column is-narrow">
|
||||
<button class="button is-white" (click)="openModal(poll, choice)">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
</button>
|
||||
<!-- <button class="button is-white" (click)="openModal(poll, choice)">-->
|
||||
<!-- <i class="fa fa-info-circle"></i>-->
|
||||
<!-- </button>-->
|
||||
</div>
|
||||
<div class="column is-narrow">
|
||||
<div class="buttons has-addons is-right">
|
||||
|
@ -31,4 +31,8 @@ export class PollResultsCompactComponent implements OnInit {
|
||||
toggleAnswer(choice_id: number, value: string) {
|
||||
this.storageService.toggleAnswer(choice_id, value);
|
||||
}
|
||||
|
||||
showAsDate(date_string: string) {
|
||||
return new Date(date_string);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<button
|
||||
class="button is-white"
|
||||
class="choice-button is-white"
|
||||
[ngClass]="{ 'is-primary': storageService.choiceHasAnswerOfValue(choice.id, answerEnum[answerKind]) }"
|
||||
(click)="storageService.toggleAnswer(choice.id, answerEnum[answerKind])"
|
||||
*ngIf="poll.allowed_answers.indexOf(answerEnum[answerKind]) !== -1"
|
||||
|
@ -0,0 +1,12 @@
|
||||
.choice-button {
|
||||
padding: 1.5em;
|
||||
border-radius: 10em;
|
||||
border: solid 3px #ccc;
|
||||
height: 5em;
|
||||
width: 5em;
|
||||
display: inline-block;
|
||||
&:focus,
|
||||
&:active {
|
||||
border-color: #6c99ff;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user