From e5b25d7695fb8ce3befbeb59cea533a66f83d45f Mon Sep 17 00:00:00 2001 From: GabrielMeyer Date: Tue, 11 Jun 2019 17:55:56 +0200 Subject: [PATCH] Implements checkboxes In every motion the user has the option to follow the recommendation or not. --- .../core/ui-services/pdf-document.service.ts | 20 +++++++ .../motions/services/motion-pdf.service.ts | 53 +++++++++++++++++-- openslides/motions/config_variables.py | 10 ++++ 3 files changed, 80 insertions(+), 3 deletions(-) diff --git a/client/src/app/core/ui-services/pdf-document.service.ts b/client/src/app/core/ui-services/pdf-document.service.ts index fceefb169..a28577c05 100644 --- a/client/src/app/core/ui-services/pdf-document.service.ts +++ b/client/src/app/core/ui-services/pdf-document.service.ts @@ -735,4 +735,24 @@ export class PdfDocumentService { style: StyleType.SUB_ENTRY }; } + + /** + * Draw a circle on its position on the paper + * + * @param y vertical offset + * @param size the size of the circle + * @returns an array containing one circle definition for pdfMake + */ + public drawCircle(y: number, size: number): object[] { + return [ + { + type: 'ellipse', + x: 0, + y: y, + lineColor: 'black', + r1: size, + r2: size + } + ]; + } } diff --git a/client/src/app/site/motions/services/motion-pdf.service.ts b/client/src/app/site/motions/services/motion-pdf.service.ts index 90f32efa3..748868d35 100644 --- a/client/src/app/site/motions/services/motion-pdf.service.ts +++ b/client/src/app/site/motions/services/motion-pdf.service.ts @@ -101,6 +101,11 @@ export class MotionPdfService { ): object { // get the line length from the config const lineLength = this.configService.instant('motions_line_length'); + // whether to append checkboxes to follow the recommendation or not + const optionToFollowRecommendation = this.configService.instant( + 'motions_export_follow_recommendation' + ); + let motionPdfContent = []; // Enforces that statutes should always have Diff Mode and no line numbers @@ -126,7 +131,13 @@ export class MotionPdfService { motionPdfContent = [title, subtitle]; if ((infoToExport && infoToExport.length > 0) || !infoToExport) { - const metaInfo = this.createMetaInfoTable(motion, lineLength, crMode, infoToExport); + const metaInfo = this.createMetaInfoTable( + motion, + lineLength, + crMode, + infoToExport, + optionToFollowRecommendation + ); motionPdfContent.push(metaInfo); } @@ -206,7 +217,8 @@ export class MotionPdfService { motion: ViewMotion, lineLength: number, crMode: ChangeRecoMode, - infoToExport?: InfoToExport[] + infoToExport?: InfoToExport[], + optionToFollowRecommendation?: boolean ): object { const metaTableBody = []; @@ -427,7 +439,7 @@ export class MotionPdfService { if (columnChangeType.length > 0) { metaTableBody.push([ { - text: this.translate.instant('Summary of changes'), + text: this.translate.instant('Summary of changes:'), style: 'boldText' }, { @@ -447,6 +459,41 @@ export class MotionPdfService { } } + // Checkboxes for resolution + if (optionToFollowRecommendation) { + metaTableBody.push([ + { + text: `${this.translate.instant('Decision')}:`, + style: 'boldText' + }, + { + margin: [5, 2, 0, 2], + columns: [ + { + width: 8, + canvas: this.pdfDocumentService.drawCircle(6.5, 4) + }, + { + width: 'auto', + text: this.translate.instant('As recommendation') + }, + { + width: 20, + text: '' + }, + { + width: 8, + canvas: this.pdfDocumentService.drawCircle(6.5, 4) + }, + { + width: 'auto', + text: this.translate.instant('Divergent:') + } + ] + } + ]); + } + if (metaTableBody.length > 0) { return { table: { diff --git a/openslides/motions/config_variables.py b/openslides/motions/config_variables.py index f5a76a467..968ab9516 100644 --- a/openslides/motions/config_variables.py +++ b/openslides/motions/config_variables.py @@ -383,3 +383,13 @@ def get_config_variables(): group="Motions", subgroup="PDF export", ) + + yield ConfigVariable( + name="motions_export_follow_recommendation", + default_value=False, + label="Show checkbox to record decision", + input_type="boolean", + weight=379, + group="Motions", + subgroup="Export", + )