mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
fixes for building in prod
This commit is contained in:
parent
729dac9599
commit
7a0061eeb1
@ -8,6 +8,9 @@ export class Choice {
|
||||
public score: number;
|
||||
public enabled: boolean;
|
||||
public url?: string;
|
||||
public yes?: any;
|
||||
public no?: any;
|
||||
public maybe?: any;
|
||||
|
||||
constructor(
|
||||
public participants: Map<Answer, Set<User>> = new Map<Answer, Set<User>>([
|
||||
|
@ -44,7 +44,7 @@ export class Poll {
|
||||
|
||||
public allowed_answers = [];
|
||||
|
||||
public modification_policy = [];
|
||||
public modification_policy = 'everybody';
|
||||
|
||||
public dateChoices: Choice[] = [];
|
||||
// sets of days as strings, config to set identical time for days in a special days poll
|
||||
|
@ -1,10 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
|
||||
import { UserRole } from '../enums/user-role.enum';
|
||||
import { Choice } from '../models/choice.model';
|
||||
import { Poll } from '../models/poll.model';
|
||||
import { User } from '../models/user.model';
|
||||
import { ApiService } from './api.service';
|
||||
import { UserService } from './user.service';
|
||||
import { UuidService } from './uuid.service';
|
||||
@ -18,38 +14,7 @@ export class MockingService {
|
||||
|
||||
constructor(private apiService: ApiService, private userService: UserService, private uuidService: UuidService) {}
|
||||
|
||||
public async init(): Promise<void> {
|
||||
const pollsAvailable = await this.apiService.getAllAvailablePolls();
|
||||
this._pollsAvailables.next(pollsAvailable);
|
||||
public async init(): Promise<void> {}
|
||||
|
||||
if (this._pollsAvailables.getValue() && this._pollsAvailables.getValue().length > 0) {
|
||||
// arbitrary choose first owner available
|
||||
const currentUser = this._pollsAvailables.getValue()[0].owner;
|
||||
currentUser.polls = [this._pollsAvailables.getValue()[0]];
|
||||
this.userService.updateUser(currentUser);
|
||||
} else {
|
||||
this.loadMock();
|
||||
}
|
||||
}
|
||||
|
||||
public loadMock(): void {
|
||||
const owner = new User('TOTO', 'toto@gafam.com', [], UserRole.REGISTERED);
|
||||
|
||||
const poll1: Poll = new Poll(owner, this.uuidService.getUUID(), 'Quand le picnic ?', 'Pour faire la teuf');
|
||||
const poll2: Poll = new Poll(
|
||||
owner,
|
||||
this.uuidService.getUUID(),
|
||||
'On fait quoi à la soirée ?',
|
||||
'Balancez vos idées'
|
||||
);
|
||||
|
||||
poll1.choices = [new Choice('mardi prochain'), new Choice('mercredi')];
|
||||
poll2.choices = [new Choice('jeux'), new Choice('danser'), new Choice('discuter en picolant')];
|
||||
|
||||
this._pollsAvailables.next([poll1, poll2]);
|
||||
owner.polls = [poll1, poll2];
|
||||
this.userService.updateUser(owner);
|
||||
|
||||
console.info('MOCKING user', { user: owner });
|
||||
}
|
||||
public loadMock(): void {}
|
||||
}
|
||||
|
@ -105,7 +105,6 @@
|
||||
<a [href]="'/vote/poll/slug/' + config.customUrl">
|
||||
{{ '/vote/poll/slug/' + config.customUrl }}
|
||||
</a>
|
||||
<app-copy-text [textToCopy]="config.urlPublic"></app-copy-text>
|
||||
</div>
|
||||
<br />
|
||||
<label for="passwordAccess">
|
||||
|
@ -21,7 +21,7 @@ export class VisibilityComponent extends BaseComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.config.customUrl = this.utils.makeSlug(this.config);
|
||||
this.config.customUrl = 'un slug';
|
||||
this.config.expirationDate = this.config
|
||||
.addDaysToDate(this.config.expiracyDateDefaultInDays, new Date())
|
||||
.toISOString()
|
||||
|
@ -97,7 +97,7 @@ export class ConfigService extends PollConfig {
|
||||
// TODO: http requests moved to apiService
|
||||
this.customUrlIsUnique = null;
|
||||
if (!slug) {
|
||||
slug = this.utils.makeSlug(this);
|
||||
slug = 'un slug';
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
@ -472,6 +472,8 @@ export class ConfigService extends PollConfig {
|
||||
this.toastService.display(`this poll is not administrable, it has no ID`);
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
||||
const self = this;
|
||||
// prompt for confirmation
|
||||
this.confirmationService.confirm({
|
||||
@ -570,8 +572,7 @@ export class ConfigService extends PollConfig {
|
||||
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 : 'un_slug' + '_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".
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div class="box">
|
||||
<div class="columns is-vcentered">
|
||||
<div class="column">
|
||||
<label class="label">{{ choice.label }}</label>
|
||||
<label class="label">{{ choice.name }}</label>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="buttons has-addons is-centered">
|
||||
|
@ -14,17 +14,15 @@ import { ChoiceDetailsComponent } from '../../../shared/components/choice-detail
|
||||
templateUrl: './add-answer.component.html',
|
||||
styleUrls: ['./add-answer.component.scss'],
|
||||
})
|
||||
export class AddAnswerComponent implements OnInit {
|
||||
export class AddAnswerComponent {
|
||||
@Input() user: User;
|
||||
@Input() poll: Poll;
|
||||
@Input() choice: Choice;
|
||||
public answerEnum = Answer;
|
||||
public answer: Answer;
|
||||
public answer: any;
|
||||
|
||||
constructor(private pollService: PollService, private modalService: ModalService) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public openModal(choice: Choice): void {
|
||||
const config: MatDialogConfig<Choice> = { data: choice };
|
||||
this.modalService.openModal<ChoiceDetailsComponent, Choice>(ChoiceDetailsComponent, config);
|
||||
|
@ -3,9 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { ParticipationComponent } from './participation.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: ParticipationComponent },
|
||||
];
|
||||
const routes: Routes = [{ path: '', component: ParticipationComponent }];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
|
Loading…
Reference in New Issue
Block a user