diff --git a/client/src/app/site/motions/modules/motion-list/components/motion-export-dialog/motion-export-dialog.component.html b/client/src/app/site/motions/modules/motion-list/components/motion-export-dialog/motion-export-dialog.component.html index f15dcac23..dfb1587d8 100644 --- a/client/src/app/site/motions/modules/motion-list/components/motion-export-dialog/motion-export-dialog.component.html +++ b/client/src/app/site/motions/modules/motion-list/components/motion-export-dialog/motion-export-dialog.component.html @@ -46,17 +46,12 @@

Meta information

- Submitters - State - Recommendation - Category - Tags - Origin - Motion block + + {{ getLabelForMetadata(metaInfo) }} + Voting result - Sequential number
diff --git a/client/src/app/site/motions/modules/motion-list/components/motion-export-dialog/motion-export-dialog.component.ts b/client/src/app/site/motions/modules/motion-list/components/motion-export-dialog/motion-export-dialog.component.ts index f3d1c3058..052a21d5a 100644 --- a/client/src/app/site/motions/modules/motion-list/components/motion-export-dialog/motion-export-dialog.component.ts +++ b/client/src/app/site/motions/modules/motion-list/components/motion-export-dialog/motion-export-dialog.component.ts @@ -7,6 +7,7 @@ import { MotionCommentSectionRepositoryService } from 'app/core/repositories/mot import { LineNumberingMode, ChangeRecoMode } from 'app/site/motions/models/view-motion'; import { InfoToExport } from 'app/site/motions/services/motion-pdf.service'; import { ViewMotionCommentSection } from 'app/site/motions/models/view-motion-comment-section'; +import { motionImportExportHeaderOrder, noMetaData } from 'app/site/motions/motion-import-export-order'; /** * Dialog component to determine exporting. @@ -42,6 +43,11 @@ export class MotionExportDialogComponent implements OnInit { */ private defaultContentToExport = ['text', 'reason']; + /** + * Determine the export order of the meta data + */ + public metaInfoExportOrder: string[]; + /** * Determine the default meta info to export. */ @@ -104,6 +110,10 @@ export class MotionExportDialogComponent implements OnInit { ) { this.defaultLnMode = this.configService.instant('motions_default_line_numbering'); this.defaultCrMode = this.configService.instant('motions_recommendation_text_mode'); + // Get the export order, exclude everything that does not count as meta-data + this.metaInfoExportOrder = motionImportExportHeaderOrder.filter(metaData => { + return !noMetaData.some(noMeta => metaData === noMeta); + }); this.createForm(); } @@ -195,4 +205,24 @@ export class MotionExportDialogComponent implements OnInit { public onCloseClick(): void { this.dialogRef.close(); } + + /** + * Gets the untranslated label for metaData + */ + public getLabelForMetadata(metaDataName: string): string { + switch (metaDataName) { + case 'polls': { + return 'Voting result'; + } + case 'id': { + return 'Sequential number'; + } + case 'motion_block': { + return 'Motion block'; + } + default: { + return metaDataName.charAt(0).toUpperCase() + metaDataName.slice(1); + } + } + } } diff --git a/client/src/app/site/motions/modules/motion-list/components/motion-list/motion-list.component.ts b/client/src/app/site/motions/modules/motion-list/components/motion-list/motion-list.component.ts index 495600d90..3537f7069 100644 --- a/client/src/app/site/motions/modules/motion-list/components/motion-list/motion-list.component.ts +++ b/client/src/app/site/motions/modules/motion-list/components/motion-list/motion-list.component.ts @@ -260,8 +260,7 @@ export class MotionListComponent extends ListViewBaseComponent propertyList.includes(property)); +} diff --git a/client/src/app/site/motions/services/motion-csv-export.service.ts b/client/src/app/site/motions/services/motion-csv-export.service.ts index 9b136a819..0d09882ac 100644 --- a/client/src/app/site/motions/services/motion-csv-export.service.ts +++ b/client/src/app/site/motions/services/motion-csv-export.service.ts @@ -7,7 +7,7 @@ import { CsvColumnDefinitionProperty, CsvColumnDefinitionMap } from 'app/core/ui-services/csv-export.service'; -import { motionImportExportHeaderOrder } from '../motion-import-export-order'; +import { sortMotionPropertyList } from '../motion-import-export-order'; import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service'; import { ViewMotion } from '../models/view-motion'; @@ -37,11 +37,10 @@ export class MotionCsvExportService { * @param contentToExport content properties to export */ public exportMotionList(motions: ViewMotion[], contentToExport: string[]): void { - // reorders the exported properties according to motionImportExportHeaderOrder - const propertyList = motionImportExportHeaderOrder.filter(property => contentToExport.includes(property)); + const properties = sortMotionPropertyList(['identifier', 'title'].concat(contentToExport)); const exportProperties: ( | CsvColumnDefinitionProperty - | CsvColumnDefinitionMap)[] = propertyList.map(option => { + | CsvColumnDefinitionMap)[] = properties.map(option => { if (option === 'recommendation') { return { label: 'recommendation', diff --git a/client/src/app/site/motions/services/motion-xlsx-export.service.ts b/client/src/app/site/motions/services/motion-xlsx-export.service.ts index 7387c91b1..5d3b69b86 100644 --- a/client/src/app/site/motions/services/motion-xlsx-export.service.ts +++ b/client/src/app/site/motions/services/motion-xlsx-export.service.ts @@ -3,7 +3,7 @@ import { Injectable } from '@angular/core'; import { Workbook } from 'exceljs/dist/exceljs.min.js'; import { InfoToExport } from './motion-pdf.service'; -import { motionImportExportHeaderOrder } from '../motion-import-export-order'; +import { sortMotionPropertyList } from '../motion-import-export-order'; import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service'; import { TranslateService } from '@ngx-translate/core'; import { ViewMotion } from '../models/view-motion'; @@ -52,9 +52,8 @@ export class MotionXlsxExportService { */ public exportMotionList(motions: ViewMotion[], infoToExport: InfoToExport[]): void { const workbook = new Workbook(); - const propertyList = ['identifier', 'title'].concat(infoToExport); - // reorders the exported properties according to motionImportExportHeaderOrder - const properties = motionImportExportHeaderOrder.filter(property => propertyList.includes(property)); + const properties = sortMotionPropertyList(['identifier', 'title'].concat(infoToExport)); + const worksheet = workbook.addWorksheet(this.translate.instant('Motions'), { pageSetup: { paperSize: 9,