forked from tykayn/funky-framadate-front
stack of vote relié au formulaire de commentaire
This commit is contained in:
parent
7a0061eeb1
commit
620a7b99fa
@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { SettingsComponent } from '../../../shared/components/settings/settings.component';
|
import { SettingsComponent } from '../../../shared/components/settings/settings.component';
|
||||||
import { User } from '../../models/user.model';
|
import { Owner } from '../../models/owner.model';
|
||||||
import { ModalService } from '../../services/modal.service';
|
import { ModalService } from '../../services/modal.service';
|
||||||
import { UserService } from '../../services/user.service';
|
import { UserService } from '../../services/user.service';
|
||||||
import { environment } from '../../../../environments/environment';
|
import { environment } from '../../../../environments/environment';
|
||||||
@ -13,7 +13,7 @@ import { environment } from '../../../../environments/environment';
|
|||||||
styleUrls: ['./header.component.scss'],
|
styleUrls: ['./header.component.scss'],
|
||||||
})
|
})
|
||||||
export class HeaderComponent implements OnInit {
|
export class HeaderComponent implements OnInit {
|
||||||
public _user: Observable<User> = this.userService.user;
|
public _user: Observable<Owner> = this.userService.user;
|
||||||
public env = environment;
|
public env = environment;
|
||||||
@Input() public appTitle: string = 'FramaDate Funky';
|
@Input() public appTitle: string = 'FramaDate Funky';
|
||||||
@Input() public appLogo: string;
|
@Input() public appLogo: string;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Answer } from '../enums/answer.enum';
|
import { Answer } from '../enums/answer.enum';
|
||||||
import { User } from './user.model';
|
import { Owner } from './owner.model';
|
||||||
|
|
||||||
export class Choice {
|
export class Choice {
|
||||||
public id: number;
|
public id: number;
|
||||||
@ -13,10 +13,10 @@ export class Choice {
|
|||||||
public maybe?: any;
|
public maybe?: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public participants: Map<Answer, Set<User>> = new Map<Answer, Set<User>>([
|
public participants: Map<Answer, Set<Owner>> = new Map<Answer, Set<Owner>>([
|
||||||
[Answer.YES, new Set<User>()],
|
[Answer.YES, new Set<Owner>()],
|
||||||
[Answer.NO, new Set<User>()],
|
[Answer.NO, new Set<Owner>()],
|
||||||
[Answer.MAYBE, new Set<User>()],
|
[Answer.MAYBE, new Set<Owner>()],
|
||||||
]),
|
]),
|
||||||
public counts: Map<Answer, number> = new Map<Answer, number>([
|
public counts: Map<Answer, number> = new Map<Answer, number>([
|
||||||
[Answer.YES, 0],
|
[Answer.YES, 0],
|
||||||
@ -25,13 +25,13 @@ export class Choice {
|
|||||||
])
|
])
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public updateParticipation(user: User, responseType: Answer): void {
|
public updateParticipation(user: Owner, responseType: Answer): void {
|
||||||
this.removeParticipant(user);
|
this.removeParticipant(user);
|
||||||
this.participants.get(responseType).add(user);
|
this.participants.get(responseType).add(user);
|
||||||
this.updateCounts();
|
this.updateCounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
public removeParticipant(user: User): void {
|
public removeParticipant(user: Owner): void {
|
||||||
for (const responseType of Object.values(Answer)) {
|
for (const responseType of Object.values(Answer)) {
|
||||||
if (this.participants.get(responseType).has(user)) {
|
if (this.participants.get(responseType).has(user)) {
|
||||||
this.participants.get(responseType).delete(user);
|
this.participants.get(responseType).delete(user);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { UserRole } from '../enums/user-role.enum';
|
import { UserRole } from '../enums/user-role.enum';
|
||||||
import { Poll } from './poll.model';
|
import { Poll } from './poll.model';
|
||||||
|
|
||||||
export class User {
|
export class Owner {
|
||||||
constructor(
|
constructor(
|
||||||
public pseudo: string = 'pseudo',
|
public pseudo: string = 'pseudo',
|
||||||
public email: string = 'example@example.com',
|
public email: string = 'example@example.com',
|
@ -3,7 +3,7 @@ import { environment } from 'src/environments/environment';
|
|||||||
import { Choice } from './choice.model';
|
import { Choice } from './choice.model';
|
||||||
import { Comment } from './comment.model';
|
import { Comment } from './comment.model';
|
||||||
import { PollConfiguration } from './configuration.model';
|
import { PollConfiguration } from './configuration.model';
|
||||||
import { User } from './user.model';
|
import { Owner } from './owner.model';
|
||||||
|
|
||||||
export class Poll {
|
export class Poll {
|
||||||
public id = 0;
|
public id = 0;
|
||||||
@ -49,13 +49,13 @@ export class Poll {
|
|||||||
public dateChoices: Choice[] = [];
|
public dateChoices: Choice[] = [];
|
||||||
// sets of days as strings, config to set identical time for days in a special days poll
|
// sets of days as strings, config to set identical time for days in a special days poll
|
||||||
public timeChoices: Choice[] = []; // ranges of time expressed as strings
|
public timeChoices: Choice[] = []; // ranges of time expressed as strings
|
||||||
constructor(public owner: User = new User(), public urlPublic: string = '', public slug: string = '') {}
|
constructor(public owner: Owner = new Owner(), public urlPublic: string = '', public slug: string = '') {}
|
||||||
|
|
||||||
public static adaptFromLocalJsonServer(
|
public static adaptFromLocalJsonServer(
|
||||||
item: Pick<Poll, 'owner' | 'title' | 'description' | 'slug' | 'configuration' | 'comments' | 'choices'>
|
item: Pick<Poll, 'owner' | 'title' | 'description' | 'slug' | 'configuration' | 'comments' | 'choices'>
|
||||||
): Poll {
|
): Poll {
|
||||||
return new Poll(
|
return new Poll(
|
||||||
new User(item.owner.pseudo, item.owner.email, undefined),
|
new Owner(item.owner.pseudo, item.owner.email, undefined),
|
||||||
''
|
''
|
||||||
// item.slug,
|
// item.slug,
|
||||||
// item.title,
|
// item.title,
|
||||||
|
10
src/app/core/models/stack.model.ts
Normal file
10
src/app/core/models/stack.model.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { Vote } from './vote.model';
|
||||||
|
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 owner: Owner = new Owner();
|
||||||
|
public votes: Vote[];
|
||||||
|
}
|
4
src/app/core/models/vote.model.ts
Normal file
4
src/app/core/models/vote.model.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export class Vote {
|
||||||
|
public choice_id: number;
|
||||||
|
public value: string; // valeur de réponse
|
||||||
|
}
|
@ -5,7 +5,7 @@ import { BehaviorSubject, Observable, Subscription } from 'rxjs';
|
|||||||
import { Answer } from '../enums/answer.enum';
|
import { Answer } from '../enums/answer.enum';
|
||||||
import { Choice } from '../models/choice.model';
|
import { Choice } from '../models/choice.model';
|
||||||
import { Poll } from '../models/poll.model';
|
import { Poll } from '../models/poll.model';
|
||||||
import { User } from '../models/user.model';
|
import { Owner } from '../models/owner.model';
|
||||||
import { ApiService } from './api.service';
|
import { ApiService } from './api.service';
|
||||||
import { ToastService } from './toast.service';
|
import { ToastService } from './toast.service';
|
||||||
import { UserService } from './user.service';
|
import { UserService } from './user.service';
|
||||||
@ -136,7 +136,7 @@ export class PollService implements Resolve<Poll> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public saveParticipation(choice: Choice, user: User, response: Answer): void {
|
public saveParticipation(choice: Choice, user: Owner, response: Answer): void {
|
||||||
const currentPoll = this._poll.getValue();
|
const currentPoll = this._poll.getValue();
|
||||||
currentPoll.choices.find((c) => c.name === choice.name)?.updateParticipation(user, response);
|
currentPoll.choices.find((c) => c.name === choice.name)?.updateParticipation(user, response);
|
||||||
this.updateCurrentPoll(currentPoll);
|
this.updateCurrentPoll(currentPoll);
|
||||||
@ -162,8 +162,8 @@ export class PollService implements Resolve<Poll> {
|
|||||||
public buildAnswersByChoiceLabelByPseudo(poll: Poll): Map<string, Map<string, Answer>> {
|
public buildAnswersByChoiceLabelByPseudo(poll: Poll): Map<string, Map<string, Answer>> {
|
||||||
const pseudos: Set<string> = new Set();
|
const pseudos: Set<string> = new Set();
|
||||||
poll.choices.forEach((choice: Choice) => {
|
poll.choices.forEach((choice: Choice) => {
|
||||||
// choice.voters.forEach((users: Set<User>) => {
|
// choice.voters.forEach((users: Set<Owner>) => {
|
||||||
// users.forEach((user: User) => {
|
// users.forEach((user: Owner) => {
|
||||||
// pseudos.add(user.pseudo);
|
// pseudos.add(user.pseudo);
|
||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
@ -182,8 +182,8 @@ export class PollService implements Resolve<Poll> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
poll.choices.forEach((choice: Choice) => {
|
poll.choices.forEach((choice: Choice) => {
|
||||||
choice.participants.forEach((users: Set<User>, answer: Answer) => {
|
choice.participants.forEach((users: Set<Owner>, answer: Answer) => {
|
||||||
users.forEach((user: User) => {
|
users.forEach((user: Owner) => {
|
||||||
list.get(user.pseudo).set(choice.name, answer);
|
list.get(user.pseudo).set(choice.name, answer);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@ import { LocalStorage } from 'ngx-webstorage';
|
|||||||
|
|
||||||
import { Language } from '../enums/language.enum';
|
import { Language } from '../enums/language.enum';
|
||||||
import { Theme } from '../enums/theme.enum';
|
import { Theme } from '../enums/theme.enum';
|
||||||
|
import { Stack } from '../models/stack.model';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@ -18,5 +19,5 @@ export class StorageService {
|
|||||||
public userPollsIds: string[];
|
public userPollsIds: string[];
|
||||||
|
|
||||||
@LocalStorage()
|
@LocalStorage()
|
||||||
public pseudo: string;
|
public vote_stack: Stack = new Stack();
|
||||||
}
|
}
|
||||||
|
@ -2,25 +2,25 @@ import { Injectable } from '@angular/core';
|
|||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
|
|
||||||
import { UserRole } from '../enums/user-role.enum';
|
import { UserRole } from '../enums/user-role.enum';
|
||||||
import { User } from '../models/user.model';
|
import { Owner } from '../models/owner.model';
|
||||||
import { ApiService } from './api.service';
|
import { ApiService } from './api.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService {
|
||||||
public anonymous: User = new User('', '', [], UserRole.ANONYMOUS);
|
public anonymous: Owner = new Owner('', '', [], UserRole.ANONYMOUS);
|
||||||
|
|
||||||
private _user: BehaviorSubject<User> = new BehaviorSubject<User>(this.anonymous);
|
private _user: BehaviorSubject<Owner> = new BehaviorSubject<Owner>(this.anonymous);
|
||||||
public readonly user: Observable<User> = this._user.asObservable();
|
public readonly user: Observable<Owner> = this._user.asObservable();
|
||||||
|
|
||||||
constructor(private apiService: ApiService) {}
|
constructor(private apiService: ApiService) {}
|
||||||
|
|
||||||
public updateUser(user: User): void {
|
public updateUser(user: Owner): void {
|
||||||
this._user.next(user);
|
this._user.next(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCurrentUser(): User {
|
public getCurrentUser(): Owner {
|
||||||
return this._user.getValue();
|
return this._user.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async getUserPolls(): Promise<void> {
|
public async getUserPolls(): Promise<void> {
|
||||||
const currentUser: User = this._user.getValue();
|
const currentUser: Owner = this._user.getValue();
|
||||||
currentUser.polls = await this.apiService.getPollsUrlsByUserEmail(currentUser.email);
|
currentUser.polls = await this.apiService.getPollsUrlsByUserEmail(currentUser.email);
|
||||||
this.updateUser(currentUser);
|
this.updateUser(currentUser);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<section class="loading_poll" *ngIf="fetching"></section>
|
<section class="loading_poll" *ngIf="fetching"></section>
|
||||||
<section class="poll_loaded padded" *ngIf="!fetching && poll">
|
<section class="poll_loaded padded" *ngIf="!fetching && poll">
|
||||||
|
<!-- infos locales storage-->
|
||||||
|
mon pseudo : {{ storageService.vote_stack.pseudo }}
|
||||||
|
|
||||||
<!-- messages-->
|
<!-- messages-->
|
||||||
|
|
||||||
<article class="message is-warning" *ngIf="isArchived">
|
<article class="message is-warning" *ngIf="isArchived">
|
||||||
<div class="message-body">
|
<div class="message-body">
|
||||||
⚰️ Ce sondage a expiré, il n'est plus possible d'y ajouter de votes ou de commentaires
|
⚰️ Ce sondage a expiré, il n'est plus possible d'y ajouter de votes ou de commentaires
|
||||||
@ -88,7 +92,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<app-comments [poll]="poll"></app-comments>
|
<app-comments [poll]="poll" [vote_stack]="storageService.vote_stack"></app-comments>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import { PollService } from '../../core/services/poll.service';
|
|||||||
import { DateService } from '../../core/services/date.service';
|
import { DateService } from '../../core/services/date.service';
|
||||||
import { PollUtilities } from '../old-stuff/config/PollUtilities';
|
import { PollUtilities } from '../old-stuff/config/PollUtilities';
|
||||||
import { Comment } from '../../core/models/comment.model';
|
import { Comment } from '../../core/models/comment.model';
|
||||||
|
import { StorageService } from '../../core/services/storage.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-consultation',
|
selector: 'app-consultation',
|
||||||
@ -33,6 +34,7 @@ export class ConsultationComponent implements OnInit, OnDestroy {
|
|||||||
private router: Router,
|
private router: Router,
|
||||||
private utils: PollUtilities,
|
private utils: PollUtilities,
|
||||||
private _Activatedroute: ActivatedRoute,
|
private _Activatedroute: ActivatedRoute,
|
||||||
|
public storageService: StorageService,
|
||||||
public pollService: PollService,
|
public pollService: PollService,
|
||||||
public dateService: DateService,
|
public dateService: DateService,
|
||||||
private modalService: ModalService
|
private modalService: ModalService
|
||||||
|
@ -4,7 +4,7 @@ import { Answer } from 'src/app/core/enums/answer.enum';
|
|||||||
|
|
||||||
import { Choice } from '../../../core/models/choice.model';
|
import { Choice } from '../../../core/models/choice.model';
|
||||||
import { Poll } from '../../../core/models/poll.model';
|
import { Poll } from '../../../core/models/poll.model';
|
||||||
import { User } from '../../../core/models/user.model';
|
import { Owner } from '../../../core/models/owner.model';
|
||||||
import { ModalService } from '../../../core/services/modal.service';
|
import { ModalService } from '../../../core/services/modal.service';
|
||||||
import { PollService } from '../../../core/services/poll.service';
|
import { PollService } from '../../../core/services/poll.service';
|
||||||
import { ChoiceDetailsComponent } from '../../../shared/components/choice-details/choice-details.component';
|
import { ChoiceDetailsComponent } from '../../../shared/components/choice-details/choice-details.component';
|
||||||
@ -15,7 +15,7 @@ import { ChoiceDetailsComponent } from '../../../shared/components/choice-detail
|
|||||||
styleUrls: ['./add-answer.component.scss'],
|
styleUrls: ['./add-answer.component.scss'],
|
||||||
})
|
})
|
||||||
export class AddAnswerComponent {
|
export class AddAnswerComponent {
|
||||||
@Input() user: User;
|
@Input() user: Owner;
|
||||||
@Input() poll: Poll;
|
@Input() poll: Poll;
|
||||||
@Input() choice: Choice;
|
@Input() choice: Choice;
|
||||||
public answerEnum = Answer;
|
public answerEnum = Answer;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
|
||||||
import { Poll } from '../../../core/models/poll.model';
|
import { Poll } from '../../../core/models/poll.model';
|
||||||
import { User } from '../../../core/models/user.model';
|
import { Owner } from '../../../core/models/owner.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-answers',
|
selector: 'app-answers',
|
||||||
@ -10,7 +10,7 @@ import { User } from '../../../core/models/user.model';
|
|||||||
})
|
})
|
||||||
export class AnswersComponent implements OnInit {
|
export class AnswersComponent implements OnInit {
|
||||||
@Input() poll: Poll;
|
@Input() poll: Poll;
|
||||||
@Input() user: User;
|
@Input() user: Owner;
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||||||
import { Observable, Subscription } from 'rxjs';
|
import { Observable, Subscription } from 'rxjs';
|
||||||
|
|
||||||
import { Poll } from '../../core/models/poll.model';
|
import { Poll } from '../../core/models/poll.model';
|
||||||
import { User } from '../../core/models/user.model';
|
import { Owner } from '../../core/models/owner.model';
|
||||||
import { ModalService } from '../../core/services/modal.service';
|
import { ModalService } from '../../core/services/modal.service';
|
||||||
import { UserService } from '../../core/services/user.service';
|
import { UserService } from '../../core/services/user.service';
|
||||||
import { SettingsComponent } from '../../shared/components/settings/settings.component';
|
import { SettingsComponent } from '../../shared/components/settings/settings.component';
|
||||||
@ -15,7 +15,7 @@ import { SettingsComponent } from '../../shared/components/settings/settings.com
|
|||||||
})
|
})
|
||||||
export class ParticipationComponent implements OnInit, OnDestroy {
|
export class ParticipationComponent implements OnInit, OnDestroy {
|
||||||
public poll: Poll;
|
public poll: Poll;
|
||||||
public _user: Observable<User> = this.userService.user;
|
public _user: Observable<Owner> = this.userService.user;
|
||||||
private routeSubscription: Subscription;
|
private routeSubscription: Subscription;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { User } from '../../../core/models/user.model';
|
import { Owner } from '../../../core/models/owner.model';
|
||||||
import { UserService } from '../../../core/services/user.service';
|
import { UserService } from '../../../core/services/user.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -10,7 +10,7 @@ import { UserService } from '../../../core/services/user.service';
|
|||||||
styleUrls: ['./user-polls.component.scss'],
|
styleUrls: ['./user-polls.component.scss'],
|
||||||
})
|
})
|
||||||
export class UserPollsComponent implements OnInit {
|
export class UserPollsComponent implements OnInit {
|
||||||
public _user: Observable<User> = this.userService.user;
|
public _user: Observable<Owner> = this.userService.user;
|
||||||
public isModalOpened = false;
|
public isModalOpened = false;
|
||||||
public pollsAreLoaded = false;
|
public pollsAreLoaded = false;
|
||||||
|
|
||||||
|
@ -1,62 +1,8 @@
|
|||||||
<div class="comments padded" id="comments">
|
<div class="comments padded" id="comments">
|
||||||
<section class="add-comment" *ngIf="!poll.is_archived">
|
|
||||||
<h2 class="margin-top-x7">Laisser un commentaire</h2>
|
|
||||||
<article class="message">
|
|
||||||
<div class="message-header">
|
|
||||||
<div class="field">
|
|
||||||
<span class="control has-icons-left has-icons-right">
|
|
||||||
<input
|
|
||||||
type="email"
|
|
||||||
name="cremail"
|
|
||||||
id="email_comment"
|
|
||||||
[(ngModel)]="config.myEmail"
|
|
||||||
placeholder="chuck@norris.com"
|
|
||||||
required="required"
|
|
||||||
/>
|
|
||||||
<span class="icon is-small is-left">
|
|
||||||
<i class="fa fa-envelope"></i>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<span class="control has-icons-left">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="margin-btm-x3"
|
|
||||||
name="crname"
|
|
||||||
[(ngModel)]="config.myName"
|
|
||||||
id="crname"
|
|
||||||
placeholder="pseudo"
|
|
||||||
required="required"
|
|
||||||
/>
|
|
||||||
<span class="icon is-small is-left">
|
|
||||||
<i class="fa fa-user"></i>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <label for="crname"><i class="fa fa-user" aria-hidden="true"></i> Votre nom / pseudo :</label>-->
|
|
||||||
|
|
||||||
<!-- <label for="cremail"><i class="fa fa-envelope" aria-hidden="true"></i> Votre email :</label>-->
|
|
||||||
</div>
|
|
||||||
<div class="message-body">
|
|
||||||
<label for="comment">Votre commentaire :</label>
|
|
||||||
<br />
|
|
||||||
<textarea name="comment" id="comment" [(ngModel)]="config.myComment"> </textarea>
|
|
||||||
|
|
||||||
<input
|
|
||||||
type="submit"
|
|
||||||
name="add-comment"
|
|
||||||
class="btn btn--primary btn--outline"
|
|
||||||
value="Ajouter mon commentaire ✉️"
|
|
||||||
(click)="addComment()"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</section>
|
|
||||||
<div class="message-body" *ngIf="poll.is_archived">
|
<div class="message-body" *ngIf="poll.is_archived">
|
||||||
⚰️ Ce sondage a expiré, il n'est plus possible d'y ajouter de votes ou de commentaires
|
⚰️ Ce sondage a expiré, il n'est plus possible d'y ajouter de votes ou de commentaires
|
||||||
</div>
|
</div>
|
||||||
|
<section class="comments-part" *ngIf="!poll.is_archived && poll.comments">
|
||||||
<section class="comments-part" *ngIf="poll && poll.comments">
|
|
||||||
<h2 class="title is-2">
|
<h2 class="title is-2">
|
||||||
<i class="fa fa-comment"></i>
|
<i class="fa fa-comment"></i>
|
||||||
{{ poll.comments.length }} Commentaires
|
{{ poll.comments.length }} Commentaires
|
||||||
@ -82,4 +28,57 @@
|
|||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="add-comment" *ngIf="!poll.is_archived">
|
||||||
|
<h2 class="margin-top-x7">Laisser un commentaire</h2>
|
||||||
|
<article class="message">
|
||||||
|
<div class="message-header">
|
||||||
|
<div class="field">
|
||||||
|
<span class="control has-icons-left has-icons-right">
|
||||||
|
<input
|
||||||
|
type="email"
|
||||||
|
name="cremail"
|
||||||
|
id="email_comment"
|
||||||
|
[(ngModel)]="vote_stack.owner.email"
|
||||||
|
placeholder="chuck@norris.com"
|
||||||
|
required="required"
|
||||||
|
/>
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fa fa-envelope"></i>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span class="control has-icons-left">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="margin-btm-x3"
|
||||||
|
name="crname"
|
||||||
|
[(ngModel)]="vote_stack.pseudo"
|
||||||
|
id="crname"
|
||||||
|
placeholder="pseudo"
|
||||||
|
required="required"
|
||||||
|
/>
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fa fa-user"></i>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <label for="crname"><i class="fa fa-user" aria-hidden="true"></i> Votre nom / pseudo :</label>-->
|
||||||
|
|
||||||
|
<!-- <label for="cremail"><i class="fa fa-envelope" aria-hidden="true"></i> Votre email :</label>-->
|
||||||
|
</div>
|
||||||
|
<div class="message-body">
|
||||||
|
<label for="comment">Votre commentaire :</label>
|
||||||
|
<br />
|
||||||
|
<textarea name="comment" id="comment" [(ngModel)]="vote_stack.comment"> </textarea>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="submit"
|
||||||
|
name="add-comment"
|
||||||
|
class="btn btn--primary btn--outline"
|
||||||
|
value="Ajouter mon commentaire ✉️"
|
||||||
|
(click)="addComment()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { PollService } from '../../../core/services/poll.service';
|
import { PollService } from '../../../core/services/poll.service';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
|
import { Stack } from '../../../core/models/stack.model';
|
||||||
|
import { Poll } from '../../../core/models/poll.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-comments',
|
selector: 'app-comments',
|
||||||
@ -8,7 +10,8 @@ import * as moment from 'moment';
|
|||||||
styleUrls: ['./comments.component.scss'],
|
styleUrls: ['./comments.component.scss'],
|
||||||
})
|
})
|
||||||
export class CommentsComponent {
|
export class CommentsComponent {
|
||||||
@Input() public poll: any;
|
@Input() public vote_stack: Stack;
|
||||||
|
@Input() public poll: Poll;
|
||||||
|
|
||||||
public config: any = {
|
public config: any = {
|
||||||
myName: '',
|
myName: '',
|
||||||
|
@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
import { MatDialogRef } from '@angular/material/dialog';
|
import { MatDialogRef } from '@angular/material/dialog';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
|
|
||||||
import { User } from '../../../core/models/user.model';
|
import { Owner } from '../../../core/models/owner.model';
|
||||||
import { UserService } from '../../../core/services/user.service';
|
import { UserService } from '../../../core/services/user.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -11,7 +11,7 @@ import { UserService } from '../../../core/services/user.service';
|
|||||||
styleUrls: ['./settings.component.scss'],
|
styleUrls: ['./settings.component.scss'],
|
||||||
})
|
})
|
||||||
export class SettingsComponent implements OnInit {
|
export class SettingsComponent implements OnInit {
|
||||||
public user: User;
|
public user: Owner;
|
||||||
private userSubscription: Subscription;
|
private userSubscription: Subscription;
|
||||||
|
|
||||||
constructor(private userService: UserService, public dialogRef: MatDialogRef<SettingsComponent>) {}
|
constructor(private userService: UserService, public dialogRef: MatDialogRef<SettingsComponent>) {}
|
||||||
|
@ -1014,7 +1014,7 @@ msgid "Respond-to mail address"
|
|||||||
msgstr "Chomlec'h postel respont"
|
msgstr "Chomlec'h postel respont"
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "Arveriad"
|
msgstr "Arveriad"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
@ -1031,7 +1031,7 @@ msgid "Respond-to mail address"
|
|||||||
msgstr "Respon a l'adreça de correu"
|
msgstr "Respon a l'adreça de correu"
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "Usuari"
|
msgstr "Usuari"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
@ -1042,7 +1042,7 @@ msgstr ""
|
|||||||
"werden)"
|
"werden)"
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "Datenbank-Benutzername"
|
msgstr "Datenbank-Benutzername"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
@ -1024,7 +1024,7 @@ msgid "Respond-to mail address"
|
|||||||
msgstr "Email απάντησης"
|
msgstr "Email απάντησης"
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "Χρήστης"
|
msgstr "Χρήστης"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
@ -1029,8 +1029,8 @@ msgid "Respond-to mail address"
|
|||||||
msgstr "Respond-to mail address"
|
msgstr "Respond-to mail address"
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "User"
|
msgstr "Owner"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
msgid "Change language"
|
msgid "Change language"
|
||||||
|
@ -1043,7 +1043,7 @@ msgid "Respond-to mail address"
|
|||||||
msgstr "Correo electrónico para \"responder a\""
|
msgstr "Correo electrónico para \"responder a\""
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "Usuario"
|
msgstr "Usuario"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
@ -1047,7 +1047,7 @@ msgid "Respond-to mail address"
|
|||||||
msgstr "Mail de réponse"
|
msgstr "Mail de réponse"
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "Utilisateur·rice"
|
msgstr "Utilisateur·rice"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
@ -959,7 +959,7 @@ msgid "Respond-to mail address"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
@ -1016,7 +1016,7 @@ msgid "Respond-to mail address"
|
|||||||
msgstr "Correo electrónico para as respostas"
|
msgstr "Correo electrónico para as respostas"
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "Persoa usuaria"
|
msgstr "Persoa usuaria"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
@ -1024,7 +1024,7 @@ msgid "Respond-to mail address"
|
|||||||
msgstr "Válasz e-mail cím"
|
msgstr "Válasz e-mail cím"
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "Felhasználó"
|
msgstr "Felhasználó"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
@ -1039,7 +1039,7 @@ msgid "Respond-to mail address"
|
|||||||
msgstr "E-mail per le risposte"
|
msgstr "E-mail per le risposte"
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "Utente"
|
msgstr "Utente"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
@ -1020,7 +1020,7 @@ msgid "Respond-to mail address"
|
|||||||
msgstr "Antwoordmail"
|
msgstr "Antwoordmail"
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "Gebruiker"
|
msgstr "Gebruiker"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
@ -1040,7 +1040,7 @@ msgid "Respond-to mail address"
|
|||||||
msgstr "Adreça de responsa"
|
msgstr "Adreça de responsa"
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "Utilizaire"
|
msgstr "Utilizaire"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
@ -1015,7 +1015,7 @@ msgid "Respond-to mail address"
|
|||||||
msgstr "E-postadress för svar"
|
msgstr "E-postadress för svar"
|
||||||
|
|
||||||
#: .Installation.User
|
#: .Installation.User
|
||||||
msgid "User"
|
msgid "Owner"
|
||||||
msgstr "Användare"
|
msgstr "Användare"
|
||||||
|
|
||||||
#: .Language+selector.Change+language
|
#: .Language+selector.Change+language
|
||||||
|
Loading…
Reference in New Issue
Block a user