Fixed motion pdf layout
for voting result and summary change recommendations
This commit is contained in:
parent
cdc37b4dd5
commit
52b9c651bb
@ -89,15 +89,18 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// voting result
|
// voting result
|
||||||
|
if (motion.polls.length > 0 && motion.polls[0].has_votes) {
|
||||||
var column1 = [];
|
var column1 = [];
|
||||||
var column2 = [];
|
var column2 = [];
|
||||||
var column3 = [];
|
var column3 = [];
|
||||||
motion.polls.map(function(poll, index) {
|
motion.polls.map(function(poll, index) {
|
||||||
var votenumber = '';
|
if (poll.has_votes) {
|
||||||
|
// votenumber
|
||||||
if (motion.polls.length > 1) {
|
if (motion.polls.length > 1) {
|
||||||
votenumber = index + 1 + '. ' + gettextCatalog.getString('Vote');
|
column1.push(index + 1 + '. ' + gettextCatalog.getString('Vote'));
|
||||||
|
column2.push('');
|
||||||
|
column3.push('');
|
||||||
}
|
}
|
||||||
|
|
||||||
// yes
|
// yes
|
||||||
var yes = poll.getVote(poll.yes, 'yes');
|
var yes = poll.getVote(poll.yes, 'yes');
|
||||||
column1.push(gettextCatalog.getString('Yes') + ':');
|
column1.push(gettextCatalog.getString('Yes') + ':');
|
||||||
@ -134,6 +137,7 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
|
|||||||
column2.push(cast.value);
|
column2.push(cast.value);
|
||||||
column3.push(cast.percentStr);
|
column3.push(cast.percentStr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
metaTableBody.push([
|
metaTableBody.push([
|
||||||
{
|
{
|
||||||
@ -161,7 +165,53 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
|
|||||||
style: 'grey'
|
style: 'grey'
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// summary of change recommendations (for motion diff version only)
|
||||||
|
if ($scope.viewChangeRecommendations.mode == "diff") {
|
||||||
|
var columnLineNumbers = [];
|
||||||
|
var columnChangeType = [];
|
||||||
|
angular.forEach($scope.change_recommendations, function(change) {
|
||||||
|
// line numbers column
|
||||||
|
var line;
|
||||||
|
if (change.line_from >= change.line_to - 1) {
|
||||||
|
line = change.line_from;
|
||||||
|
} else {
|
||||||
|
line = change.line_from + ' - ' + (change.line_to - 1);
|
||||||
|
}
|
||||||
|
columnLineNumbers.push(
|
||||||
|
gettextCatalog.getString('Line') + ' ' + line + ': '
|
||||||
|
);
|
||||||
|
// change type column
|
||||||
|
if (change.getType(motion.getVersion($scope.version).text) === 0) {
|
||||||
|
columnChangeType.push(gettextCatalog.getString("Replacement"));
|
||||||
|
} else if (change.getType(motion.getVersion($scope.version).text) === 1) {
|
||||||
|
columnChangeType.push(gettextCatalog.getString("Insertion"));
|
||||||
|
} else if (change.getType(motion.getVersion($scope.version).text) === 2) {
|
||||||
|
columnChangeType.push(gettextCatalog.getString("Deletion"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
metaTableBody.push([
|
||||||
|
{
|
||||||
|
text: gettextCatalog.getString('Summary of change recommendations'),
|
||||||
|
style: ['bold', 'grey']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
text: columnLineNumbers.join('\n'),
|
||||||
|
width: 'auto'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: columnChangeType.join('\n'),
|
||||||
|
width: 'auto'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
columnGap: 7,
|
||||||
|
style: 'grey'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// build table
|
// build table
|
||||||
var metaTableJsonString = {
|
var metaTableJsonString = {
|
||||||
@ -188,45 +238,6 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
|
|||||||
return metaTableJsonString;
|
return metaTableJsonString;
|
||||||
};
|
};
|
||||||
|
|
||||||
// summary of change recommendations (for motion diff version only)
|
|
||||||
var motionDiffSummary = function() {
|
|
||||||
if ($scope.viewChangeRecommendations.mode == "diff") {
|
|
||||||
var motionDiffLogBox = [];
|
|
||||||
motionDiffLogBox.push({
|
|
||||||
text: gettextCatalog.getString('Summary of change recommendations'),
|
|
||||||
style: 'bold'
|
|
||||||
});
|
|
||||||
|
|
||||||
angular.forEach($scope.change_recommendations, function(change) {
|
|
||||||
var changeType = "";
|
|
||||||
var lineNumbers = "";
|
|
||||||
|
|
||||||
if (change.getType(motion.getVersion($scope.version).text) === 0) {
|
|
||||||
changeType = gettextCatalog.getString("Replacement");
|
|
||||||
} else if (change.getType(motion.getVersion($scope.version).text) === 1) {
|
|
||||||
changeType = gettextCatalog.getString("Insertion");
|
|
||||||
} else if (change.getType(motion.getVersion($scope.version).text) === 2) {
|
|
||||||
changeType = gettextCatalog.getString("Deletion");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (change.line_from >= change.line_to - 1) {
|
|
||||||
lineNumbers = change.line_from;
|
|
||||||
} else {
|
|
||||||
lineNumbers = change.line_from + " - " + (change.line_to - 1);
|
|
||||||
}
|
|
||||||
motionDiffLogBox.push({
|
|
||||||
text: gettextCatalog.getString('Line') + " " + lineNumbers + ": " + changeType + "\n"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
motionDiffLogBox.push({
|
|
||||||
text: "\n\n"
|
|
||||||
});
|
|
||||||
return motionDiffLogBox;
|
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// motion title
|
// motion title
|
||||||
var motionTitle = function() {
|
var motionTitle = function() {
|
||||||
return [{
|
return [{
|
||||||
@ -285,7 +296,6 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
|
|||||||
title,
|
title,
|
||||||
subtitle,
|
subtitle,
|
||||||
metaTable(),
|
metaTable(),
|
||||||
motionDiffSummary(),
|
|
||||||
motionTitle(),
|
motionTitle(),
|
||||||
motionText(),
|
motionText(),
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user