From 80b9ce138fa8056d6fa08f0d452eb9f47e5c581b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Mon, 6 Feb 2017 12:32:15 +0100 Subject: [PATCH] PDF Layout improvements - Added parent motion into subtitle of motion pdf. (for amendments only). - Adapted page margin and footer. - Use same line height also for outside line numbering. - Add more margin-top for motion reason heading. --- openslides/core/static/js/core/pdf-worker.js | 1 + openslides/core/static/js/core/pdf.js | 15 ++++++++------- openslides/motions/static/js/motions/pdf.js | 19 ++++++++++++++----- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/openslides/core/static/js/core/pdf-worker.js b/openslides/core/static/js/core/pdf-worker.js index c4c374f54..27b851bfd 100644 --- a/openslides/core/static/js/core/pdf-worker.js +++ b/openslides/core/static/js/core/pdf-worker.js @@ -42,6 +42,7 @@ self.addEventListener('message', function(e) { return { text: footerText, alignment: data.footerTpl.alignment, + margin: data.footerTpl.margin, fontSize: data.footerTpl.fontSize, color: data.footerTpl.color }; diff --git a/openslides/core/static/js/core/pdf.js b/openslides/core/static/js/core/pdf.js index 9c49513e3..db6bbaad3 100644 --- a/openslides/core/static/js/core/pdf.js +++ b/openslides/core/static/js/core/pdf.js @@ -26,7 +26,7 @@ angular.module('OpenSlidesApp.core.pdf', []) // page subtitle PDFLayout.createSubtitle = function(subtitle) { return { - text: subtitle, + text: subtitle.join('\n'), style: "subtitle" }; }; @@ -156,7 +156,7 @@ angular.module('OpenSlidesApp.core.pdf', []) return { color: '#555', fontSize: 9, - margin: [80, 30, 80, 10], // [left, top, right, bottom] + margin: [75, 30, 75, 10], // [left, top, right, bottom] columns: columns, columnGap: 10 }; @@ -168,11 +168,11 @@ angular.module('OpenSlidesApp.core.pdf', []) // are replaced by dynamic footer function in pdf-worker.js. var getFooter = function() { return { - alignment: 'center', - fontSize: 8, + alignment: 'right', + margin: [0, 15, 75, 0], + fontSize: 9, color: '#555', - text: gettextCatalog.getString('Page') + - ' {{currentPage}} / {{pageCount}}' + text: '{{currentPage}} / {{pageCount}}' }; }; // Generates the document(definition) for pdfMake @@ -180,7 +180,7 @@ angular.module('OpenSlidesApp.core.pdf', []) var content = contentProvider.getContent(); return { pageSize: 'A4', - pageMargins: [80, 90, 80, 100], + pageMargins: [75, 90, 75, 100], defaultStyle: { font: 'PdfFont', fontSize: 10 @@ -625,6 +625,7 @@ angular.module('OpenSlidesApp.core.pdf', []) ] }; currentParagraph = create("text"); + currentParagraph.lineHeight = 1.25; col.columns.push(currentParagraph); alreadyConverted.push(col); } diff --git a/openslides/motions/static/js/motions/pdf.js b/openslides/motions/static/js/motions/pdf.js index 47a020348..31ed30857 100644 --- a/openslides/motions/static/js/motions/pdf.js +++ b/openslides/motions/static/js/motions/pdf.js @@ -9,7 +9,8 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf']) 'PDFLayout', 'Category', 'Config', - function(gettextCatalog, PDFLayout, Category, Config) { + 'Motion', + function(gettextCatalog, PDFLayout, Category, Config, Motion) { /** * Provides the content as JS objects for Motions in pdfMake context * @constructor @@ -25,9 +26,16 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf']) ); // subtitle - var subtitle = PDFLayout.createSubtitle( - gettextCatalog.getString('Sequential number') + ': ' + motion.id - ); + var subtitleLines = []; + if (motion.parent_id) { + var parentMotion = Motion.get(motion.parent_id); + subtitleLines.push( + gettextCatalog.getString('Amendment of motion') + ': ' + + (parentMotion.identifier ? parentMotion.identifier : parentMotion.getTitle()) + ); + } + subtitleLines.push(gettextCatalog.getString('Sequential number') + ': ' + motion.id); + var subtitle = PDFLayout.createSubtitle(subtitleLines); // meta data table var metaTable = function() { @@ -269,7 +277,8 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf']) if (motion.getReason($scope.version)) { reason.push({ text: gettextCatalog.getString('Reason'), - style: 'heading3' + style: 'heading3', + marginTop: 25, }); reason.push(converter.convertHTML(motion.getReason($scope.version), $scope.lineNumberMode)); }