menu to nav on poll display - #64

This commit is contained in:
Baptiste Lemoine 2020-01-22 10:00:03 +01:00
parent 195259bb72
commit d2c726012b
2 changed files with 69 additions and 18 deletions

View File

@ -1,28 +1,70 @@
<div class="poll" >
<nav class='sections-nav' >
<ul >
<li ><a href='#title' >{{config.currentPoll.data.title}}</a ></li >
<li ><a href='#graph' >Graphique</a ></li >
<li >
<a href='#comments' >
<i class='fa fa-comments' ></i >
<span
*ngIf='config.currentPoll && config.currentPoll.comments'
class='comments-count' >
{{config.currentPoll.comments.length}}
</span >
commentaires</a >
</li >
</ul >
</nav >
<div class='heading' >
<div class='col-xs-6' >
<h1 >{{pollConfigFetched.data.title}}</h1 >
<p >{{pollConfigFetched.data.description}}</p >
<h1 id='title' >{{config.currentPoll.data.title}}</h1 >
<p >{{config.currentPoll.data.description}}</p >
<span class="creationDate" >
Créé le {{pollConfigFetched.data.creationDate.date}}
Créé le {{config.currentPoll.data.creationDate.date}}
</span >
<span class="expiracyDate" >
Expire le {{pollConfigFetched.data.expiracyDate.date}}
Expire le {{config.currentPoll.data.expiracyDate.date}}
</span >
<div class="votants" >
<i class='fa fa-users' ></i >
{{pollConfigFetched.stacks.length}} votants,
{{pollConfigFetched.choices.length}} choix,
{{config.currentPoll.stacks.length}} votants,
{{config.currentPoll.choices.length}} choix,
</div >
</div >
<div class='col-xs-6' >
<div
*ngIf='config.isAdmin'
class='col-xs-6 admin-actions' >
<button
class='btn btn--primary btn--outline btn--full'
*ngIf='config.isAdmin'
(click)='config.todo()' >
<i class='fa fa-pencil' ></i >
Je veux modifier le vote de quelqu'un
</button >
<button
(click)='config.deleteComments()'
class='btn btn--danger btn--outline' >
<i class='fa fa-comments-o' ></i >
Supprimer tous les commentaires
</button >
<button
(click)='config.deleteVotes()'
class='btn btn--danger btn--outline' >
<i class='fa fa-stack' ></i >
Supprimer tous les votes
</button >
<button
(click)='config.deletePoll()'
class='btn btn--danger btn--outline' >
<i class='fa fa-trash' ></i >
Supprimer ce sondage entièrement
</button >
<button
(click)='config.checkIfSlugIsUniqueInDatabase()'
class='btn btn--primary btn--outline' >
<i class='fa fa-file-text' ></i >
vérifier la disponibilité de l'url personnalisée
</button >
</div >
</div >
@ -36,9 +78,15 @@
id="name"
[(ngModel)]="config.myName" >
</section >
<div class="list-of-choices" >
<div *ngFor="let choice of pollConfigFetched.choices" >
<framadate-vote-choice [choice]="choice" ></framadate-vote-choice >
<div
*ngIf='config.currentPoll'
class="list-of-choices" >
<div *ngFor="let choice of config.currentPoll.choices" >
<framadate-vote-choice
[choice]="choice"
[pollIsSpecialDate]="config.currentPoll.data.kind == 'date'"
[simpleAnswer]="config.currentPoll.data.allowedAnswers == ['yes']" ></framadate-vote-choice >
</div >
</div >
<button
@ -46,9 +94,14 @@
(click)='config.addVote()' >
<i class='fa fa-paper-plane' ></i > Envoyer
</button >
<framadate-voting-graph ></framadate-voting-graph >
<framadate-voting-summary ></framadate-voting-summary >
<div class="comments" >
<div id='graph' >
<!--<framadate-voting-graph ></framadate-voting-graph >-->
</div >
<!--<framadate-voting-summary ></framadate-voting-summary >-->
<div
class="comments"
id='comments' >
<h2 class="margin-top-x7" >Laisser un commentaire</h2 >
<label for="crname" >Votre nom :</label >
<input
@ -75,8 +128,7 @@
(click)='config.addComment()' >
<framadate-voting-comment
[comment]="c"
*ngFor="let c of comments" >
*ngFor="let c of comments " >
</framadate-voting-comment >
</div >
<div class="sharing" >

View File

@ -11,7 +11,6 @@ import {ActivatedRoute} from "@angular/router";
})
export class PollDisplayComponent extends BaseComponent implements OnInit {
pollConfigFetched;
comments = mockComments;
constructor(public config: ConfigService,
@ -20,7 +19,7 @@ export class PollDisplayComponent extends BaseComponent implements OnInit {
}
ngOnInit() {
this.pollConfigFetched = this.config.currentPoll;
this.config.currentPoll;
// fetch poll with its ID or slug.
const id = this.activeRoute.snapshot.params.poll;