From 56b48038e0eb806bc5cbe0ea37f17cb89c44eeef Mon Sep 17 00:00:00 2001 From: Tykayn Date: Thu, 18 Nov 2021 10:02:13 +0100 Subject: [PATCH] move consultation action buttons in actions-menu component --- .../actions-menu/actions-menu.component.html | 56 ++++++++++++++++++- .../actions-menu/actions-menu.component.ts | 40 ++++++++++++- .../administration/administration.module.ts | 1 + .../consultation/consultation.component.html | 51 +++-------------- .../consultation/consultation.component.ts | 19 ------- .../consultation/consultation.module.ts | 9 ++- 6 files changed, 110 insertions(+), 66 deletions(-) diff --git a/src/app/features/administration/actions-menu/actions-menu.component.html b/src/app/features/administration/actions-menu/actions-menu.component.html index ea1e4c12..5ab65818 100644 --- a/src/app/features/administration/actions-menu/actions-menu.component.html +++ b/src/app/features/administration/actions-menu/actions-menu.component.html @@ -1 +1,55 @@ -

actions-menu works!

+
+ + + + + + + + +
+ +
+
+ + + +
+
diff --git a/src/app/features/administration/actions-menu/actions-menu.component.ts b/src/app/features/administration/actions-menu/actions-menu.component.ts index 5eee4780..7706469d 100644 --- a/src/app/features/administration/actions-menu/actions-menu.component.ts +++ b/src/app/features/administration/actions-menu/actions-menu.component.ts @@ -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'); + } } diff --git a/src/app/features/administration/administration.module.ts b/src/app/features/administration/administration.module.ts index ff358ddf..dff20f0b 100644 --- a/src/app/features/administration/administration.module.ts +++ b/src/app/features/administration/administration.module.ts @@ -77,5 +77,6 @@ import { ActionsMenuComponent } from './actions-menu/actions-menu.component'; DragDropModule, ConfirmDialogModule, ], + exports: [ActionsMenuComponent], }) export class AdministrationModule {} diff --git a/src/app/features/consultation/consultation.component.html b/src/app/features/consultation/consultation.component.html index 6447b16e..5d769b1f 100644 --- a/src/app/features/consultation/consultation.component.html +++ b/src/app/features/consultation/consultation.component.html @@ -37,40 +37,7 @@

author : {{ poll.owner?.pseudo }}

- - - - - - -
- -
+
@@ -120,13 +87,11 @@ - - - - diff --git a/src/app/features/consultation/consultation.component.ts b/src/app/features/consultation/consultation.component.ts index 63195644..b227b4c8 100644 --- a/src/app/features/consultation/consultation.component.ts +++ b/src/app/features/consultation/consultation.component.ts @@ -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'); - } } diff --git a/src/app/features/consultation/consultation.module.ts b/src/app/features/consultation/consultation.module.ts index 57aa22ef..9c2d7450 100644 --- a/src/app/features/consultation/consultation.module.ts +++ b/src/app/features/consultation/consultation.module.ts @@ -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 {}