Rework on ballot paper layout for using logos.

This commit is contained in:
Emanuel Schütze 2017-08-11 12:46:59 +02:00
parent bf56067d17
commit 2c43bfee47
6 changed files with 34 additions and 47 deletions

View File

@ -276,33 +276,33 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
function($q, $filter, gettextCatalog, PDFLayout, Config, User, ImageConverter) {
var createInstance = function(assignment, poll, pollNumber) {
var logoAssignmentBallotPaperUrl = Config.get('logo_pdf_assignment_ballot_paper').value.path;
var logoBallotPaperUrl = Config.get('logo_pdf_ballot_paper').value.path;
var imageMap = {};
// PDF header
var header = function() {
var columns = [];
var text = Config.get('general_event_name').value
// logo
if (logoBallotPaperUrl) {
columns.push({
image: imageMap[logoBallotPaperUrl].data,
fit: [90,20],
width: '20%'
});
}
var text = Config.get('general_event_name').value;
columns.push({
text: text,
fontSize: 8,
alignment: 'left',
width: '80%'
alignment: 'right',
});
// logo
columns.push({
image: imageMap[logoAssignmentBallotPaperUrl].data,
fit: [90,25],
width: '20%'
});
return {
color: '#555',
fontSize: 10,
margin: [30, 10, 10, 0], // [left, top, right, bottom]
margin: [30, 10, 10, -10], // [left, top, right, bottom]
columns: columns,
columnGap: 5
columnGap: 10
};
};
@ -384,7 +384,6 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
// with a one px width and a fixed top-margin
return {
columns: [
header(),
{
width: 1,
margin: [0, marginTop],
@ -393,6 +392,7 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
{
width: '*',
stack: [
header(),
createTitle(),
createPollHint(),
createSelectionField(),
@ -508,7 +508,7 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
return $q(function (resolve) {
var imageSources = [
logoAssignmentBallotPaperUrl,
logoBallotPaperUrl,
];
ImageConverter.toBase64(imageSources).then(function (_imageMap) {
imageMap = _imageMap;

View File

@ -253,8 +253,7 @@ def get_config_variables():
'logo_web_header',
'logo_pdf_header',
'logo_pdf_footer',
'logo_pdf_assignment_ballot_paper',
'logo_pdf_motion_poll'],
'logo_pdf_ballot_paper'],
weight=300,
group='Logo',
hidden=True)
@ -311,21 +310,11 @@ def get_config_variables():
hidden=True)
yield ConfigVariable(
name='logo_pdf_assignment_ballot_paper',
name='logo_pdf_ballot_paper',
default_value={
'display_name': 'Election ballot paper',
'display_name': 'PDF ballot paper logo',
'path': ''},
input_type='logo',
weight=312,
group='Logo',
hidden=True)
yield ConfigVariable(
name='logo_pdf_motion_poll',
default_value={
'display_name': 'Motion poll',
'path': ''},
input_type='logo',
weight=313,
group='Logo',
hidden=True)

View File

@ -59,12 +59,6 @@ var replacePlaceholder = function (content) {
hLineWidth: function(i, node) {
if (i === 0){
return 0;
} else if (i === node.table.body.length) {
if (node.rowsperpage && node.rowsperpage > i) {
return 0.5;
} else {
return 0;
}
} else {
return 0.5;
}

View File

@ -1907,6 +1907,7 @@ angular.module('OpenSlidesApp.core.site', [
gettext('PDF header logo');
gettext('PDF footer logo');
gettext('Web interface header logo');
gettext('PDF ballot paper logo');
// Mark the string 'Default projector' here, because it does not appear in the templates.
gettext('Default projector');

View File

@ -29,7 +29,7 @@
<!-- Logo -->
<div class="title">
<a ui-sref="home">
<img ng-if="!config('logo_web_header').path" src="/static/img/openslides-logo-dark.png" alt="OpenSlides Logo" height="35">
<img src="/static/img/openslides-logo-dark.png" alt="OpenSlides Logo" height="35">
<img ng-if="config('logo_web_header').path" ng-src="{{ config('logo_web_header').path }}" alt="OpenSlides Logo" height="35">
</a>
</div>

View File

@ -555,31 +555,34 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
*/
var createInstance = function(title, id) {
var logoMotionPollUrl = Config.get('logo_pdf_motion_poll').value.path;
var logoBallotPaperUrl = Config.get('logo_pdf_ballot_paper').value.path;
var imageMap = {};
// PDF header
var header = function() {
var columns = [];
var text = Config.get('general_event_name').value
var text = Config.get('general_event_name').value;
columns.push({
text: text,
fontSize: 8,
alignment: 'left',
width: '80%'
width: '60%'
});
// logo
columns.push({
image: imageMap[logoMotionPollUrl].data,
fit: [90,25],
width: '20%'
});
if (logoBallotPaperUrl) {
columns.push({
image: imageMap[logoBallotPaperUrl].data,
fit: [90,25],
alignment: 'right',
width: '40%'
});
}
return {
color: '#555',
fontSize: 10,
margin: [30, 10, 10, 0], // [left, top, right, bottom]
margin: [30, 10, 10, -10], // [left, top, right, bottom]
columns: columns,
columnGap: 5
};
@ -590,7 +593,7 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
* @function
*/
var createSection = function() {
var sheetend = 75;
var sheetend = 40;
return {
stack: [
header(),
@ -679,7 +682,7 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
return $q(function (resolve) {
var imageSources = [
logoMotionPollUrl,
logoBallotPaperUrl,
];
ImageConverter.toBase64(imageSources).then(function (_imageMap) {
imageMap = _imageMap;