move consultation action buttons in actions-menu component

This commit is contained in:
Tykayn 2021-11-18 10:02:13 +01:00 committed by tykayn
parent 4e449b38a8
commit 56b48038e0
6 changed files with 110 additions and 66 deletions

View File

@ -1 +1,55 @@
<p>actions-menu works!</p>
<div class="actions">
<button class="button">
Fermer
<i class="fa fa-times"></i>
</button>
<button class="export export-print btn" (click)="print()">
<i class="fa fa-print"></i>
Imprimer le sondage
</button>
<button class="export export-csv btn" (click)="exportCSV()">
<i class="fa fa-file-calc-o" aria-hidden="true"></i>
Exporter en .csv
</button>
<button class="export export-json btn" (click)="exportJson()">
<i class="fa fa-file-archive-o" aria-hidden="true"></i>
export json
</button>
<button class="replicate duplicate btn" [routerLink]="['']">
<i class="fa fa-pencil" aria-hidden="true"></i>
Modifier
</button>
<button class="replicate duplicate btn" (click)="duplicate()">
<i class="fa fa-copy" aria-hidden="true"></i>
Dupliquer
</button>
<div id="export_and_share">
<div class="sharing" *ngIf="pollService.poll">
<div class="margin-top-x8">
Lien administrateur
<i class="fa fa-share" aria-hidden="true"></i>
</div>
<p class="nobold text-14" for="copyLink">
<a href="{{ pollService.getParticipationUrl() }}"> {{ pollService.getParticipationUrl() }} </a>
<app-copy-text [textToCopy]="pollService.getParticipationUrl()"></app-copy-text>
</p>
</div>
</div>
<div class="admin-actions" *ngIf="pollService.admin_key">
<button class="replicate duplicate button has-text-warning" [routerLink]="['']">
<i class="fa fa-user-times" aria-hidden="true"></i>
Supprimer tous les votes
</button>
<button class="replicate duplicate button has-text-warning" [routerLink]="['']">
<i class="fa fa-comments-o" aria-hidden="true"></i>
Supprimer tous les commentaires
</button>
<button class="replicate duplicate button has-text-danger" [routerLink]="['']">
<i class="fa fa-trash" aria-hidden="true"></i>
Supprimer le sondage
</button>
</div>
</div>

View File

@ -1,4 +1,11 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { PollUtilitiesService } from '../../../core/services/poll.utilities.service';
import { StorageService } from '../../../core/services/storage.service';
import { ApiService } from '../../../core/services/api.service';
import { PollService } from '../../../core/services/poll.service';
import { DateService } from '../../../core/services/date.service';
import { ToastService } from '../../../core/services/toast.service';
@Component({
selector: 'app-actions-menu',
@ -6,7 +13,38 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./actions-menu.component.scss'],
})
export class ActionsMenuComponent implements OnInit {
constructor() {}
constructor(
private router: Router,
private utils: PollUtilitiesService,
private _Activatedroute: ActivatedRoute,
public storageService: StorageService,
public api: ApiService,
public pollService: PollService,
public dateService: DateService,
public toastService: ToastService
) {}
ngOnInit(): void {}
/**
* export all the poll data available to the public as a CSV single file
*/
exportCSV(): void {
this.utils.exportCSV(this.pollService._poll.getValue());
}
exportJson(): void {
this.utils.download(
'export_poll_' + this.pollService._poll.getValue().custom_url + '.json',
JSON.stringify(this.pollService._poll.getValue())
);
}
duplicate(): void {
alert('TODO');
}
print(): void {
alert('TODO');
}
}

View File

@ -77,5 +77,6 @@ import { ActionsMenuComponent } from './actions-menu/actions-menu.component';
DragDropModule,
ConfirmDialogModule,
],
exports: [ActionsMenuComponent],
})
export class AdministrationModule {}

View File

@ -37,40 +37,7 @@
<p class="card-header-icon" *ngIf="poll.owner">author : {{ poll.owner?.pseudo }}</p>
</div>
<div class="column">
<button class="export export-print btn" (click)="print()">
<i class="fa fa-print"></i>
Imprimer le sondage
</button>
<button class="export export-csv btn" (click)="exportCSV()">
<i class="fa fa-file-calc-o" aria-hidden="true"></i>
Exporter en .csv
</button>
<button class="export export-json btn" (click)="exportJson()">
<i class="fa fa-file-archive-o" aria-hidden="true"></i>
export json
</button>
<button class="replicate duplicate btn" (click)="duplicate()">
<i class="fa fa-copy" aria-hidden="true"></i>
Dupliquer
</button>
<div id="export_and_share">
<div class="sharing" *ngIf="poll">
<div class="margin-top-x8">
Partager le sondage
<i class="fa fa-share" aria-hidden="true"></i>
</div>
<p class="nobold text-14" for="copyLink">
<a href="{{ pollService.getParticipationUrl() }}">
{{ pollService.getParticipationUrl() }} </a
><app-copy-text
[textToCopy]="pollService.getParticipationUrl()"
></app-copy-text>
</p>
</div>
</div>
<app-actions-menu></app-actions-menu>
</div>
</div>
</header>
@ -120,13 +87,11 @@
<i class="fa fa-spinner fa-4x"></i>
</section>
<button
class="btn btn-block submit-votestack is-primary"
class="button is-block submit-votestack is-primary"
(click)="addVoteStack()"
*ngIf="!storageService.vote_stack || !storageService.vote_stack.id"
>
<i class="fa fa-paper-plane" aria-hidden="true"></i> Envoyer
<!-- {{ storageService.vote_stack.votes.length }} réponses-->
</button>
<button
class="btn btn--primary btn-block submit-votestack update"
@ -139,7 +104,11 @@
<div class="columns">
<div class="column">
<app-comments [poll]="poll" [vote_stack]="storageService.vote_stack"></app-comments>
<app-comments
*ngIf="poll.allow_comments"
[poll]="poll"
[vote_stack]="storageService.vote_stack"
></app-comments>
</div>
</div>
@ -151,8 +120,6 @@
*ngIf="!storageService.vote_stack || !storageService.vote_stack.id"
>
<i class="fa fa-paper-plane" aria-hidden="true"></i> Envoyer
<!-- {{ storageService.vote_stack.votes.length }} réponses-->
</button>
<button
class="btn btn--primary btn-block submit-votestack update"
@ -162,10 +129,6 @@
<i class="fa fa-edit" aria-hidden="true"></i> Mettre à jour
</button>
</div>
<!-- <footer class="card-footer" *ngIf="!isArchived">-->
<!-- TODO links-->
<!-- </footer>-->
</div>
</div>
</div>

View File

@ -139,23 +139,4 @@ export class ConsultationComponent implements OnInit, OnDestroy {
this.toastService.display('erreur à l enregistrement');
}
}
/**
* export all the poll data available to the public as a CSV single file
*/
exportCSV(): void {
this.utils.exportCSV(this.poll);
}
exportJson(): void {
this.utils.download('export_poll_' + this.pollSlug + '.json', JSON.stringify(this.poll));
}
duplicate(): void {
alert('TODO');
}
print(): void {
alert('TODO');
}
}

View File

@ -14,6 +14,7 @@ import { CoreModule } from '../../core/core.module';
import { ConsultationLandingComponent } from './consultation-landing/consultation-landing.component';
import { ConsultationUserComponent } from './consultation-user/consultation-user.component';
import { SuccessComponent } from './success/success.component';
import { AdministrationModule } from '../administration/administration.module';
@NgModule({
declarations: [
@ -26,6 +27,12 @@ import { SuccessComponent } from './success/success.component';
ConsultationUserComponent,
SuccessComponent,
],
imports: [CommonModule, ConsultationRoutingModule, SharedModule, TranslateModule.forChild({ extend: true })],
imports: [
CommonModule,
ConsultationRoutingModule,
SharedModule,
TranslateModule.forChild({ extend: true }),
AdministrationModule,
],
})
export class ConsultationModule {}