Merge pull request #2716 from emanuelschuetze/fix-motion-pdf
Fixed motion pdf layout
This commit is contained in:
commit
a245236392
@ -89,79 +89,129 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// voting result
|
// voting result
|
||||||
var column1 = [];
|
if (motion.polls.length > 0 && motion.polls[0].has_votes) {
|
||||||
var column2 = [];
|
var column1 = [];
|
||||||
var column3 = [];
|
var column2 = [];
|
||||||
motion.polls.map(function(poll, index) {
|
var column3 = [];
|
||||||
var votenumber = '';
|
motion.polls.map(function(poll, index) {
|
||||||
if (motion.polls.length > 1) {
|
if (poll.has_votes) {
|
||||||
votenumber = index + 1 + '. ' + gettextCatalog.getString('Vote');
|
// votenumber
|
||||||
}
|
if (motion.polls.length > 1) {
|
||||||
|
column1.push(index + 1 + '. ' + gettextCatalog.getString('Vote'));
|
||||||
// yes
|
column2.push('');
|
||||||
var yes = poll.getVote(poll.yes, 'yes');
|
column3.push('');
|
||||||
column1.push(gettextCatalog.getString('Yes') + ':');
|
}
|
||||||
column2.push(yes.value);
|
// yes
|
||||||
column3.push(yes.percentStr);
|
var yes = poll.getVote(poll.yes, 'yes');
|
||||||
// no
|
column1.push(gettextCatalog.getString('Yes') + ':');
|
||||||
var no = poll.getVote(poll.no, 'no');
|
column2.push(yes.value);
|
||||||
column1.push(gettextCatalog.getString('No') + ':');
|
column3.push(yes.percentStr);
|
||||||
column2.push(no.value);
|
// no
|
||||||
column3.push(no.percentStr);
|
var no = poll.getVote(poll.no, 'no');
|
||||||
// abstain
|
column1.push(gettextCatalog.getString('No') + ':');
|
||||||
var abstain = poll.getVote(poll.abstain, 'abstain');
|
column2.push(no.value);
|
||||||
column1.push(gettextCatalog.getString('Abstain') + ':');
|
column3.push(no.percentStr);
|
||||||
column2.push(abstain.value);
|
// abstain
|
||||||
column3.push(abstain.percentStr);
|
var abstain = poll.getVote(poll.abstain, 'abstain');
|
||||||
// votes valid
|
column1.push(gettextCatalog.getString('Abstain') + ':');
|
||||||
if (poll.votesvalid) {
|
column2.push(abstain.value);
|
||||||
var valid = poll.getVote(poll.votesvalid, 'votesvalid');
|
column3.push(abstain.percentStr);
|
||||||
column1.push(gettextCatalog.getString('Valid votes') + ':');
|
// votes valid
|
||||||
column2.push(valid.value);
|
if (poll.votesvalid) {
|
||||||
column3.push(valid.percentStr);
|
var valid = poll.getVote(poll.votesvalid, 'votesvalid');
|
||||||
}
|
column1.push(gettextCatalog.getString('Valid votes') + ':');
|
||||||
// votes invalid
|
column2.push(valid.value);
|
||||||
if (poll.votesvalid) {
|
column3.push(valid.percentStr);
|
||||||
var invalid = poll.getVote(poll.votesinvalid, 'votesinvalid');
|
}
|
||||||
column1.push(gettextCatalog.getString('Invalid votes') + ':');
|
// votes invalid
|
||||||
column2.push(invalid.value);
|
if (poll.votesvalid) {
|
||||||
column3.push(invalid.percentStr);
|
var invalid = poll.getVote(poll.votesinvalid, 'votesinvalid');
|
||||||
}
|
column1.push(gettextCatalog.getString('Invalid votes') + ':');
|
||||||
// votes cast
|
column2.push(invalid.value);
|
||||||
if (poll.votescast) {
|
column3.push(invalid.percentStr);
|
||||||
var cast = poll.getVote(poll.votescast, 'votescast');
|
}
|
||||||
column1.push(gettextCatalog.getString('Votes cast') + ':');
|
// votes cast
|
||||||
column2.push(cast.value);
|
if (poll.votescast) {
|
||||||
column3.push(cast.percentStr);
|
var cast = poll.getVote(poll.votescast, 'votescast');
|
||||||
}
|
column1.push(gettextCatalog.getString('Votes cast') + ':');
|
||||||
});
|
column2.push(cast.value);
|
||||||
metaTableBody.push([
|
column3.push(cast.percentStr);
|
||||||
{
|
}
|
||||||
text: gettextCatalog.getString('Voting result') + ':',
|
}
|
||||||
style: ['bold', 'grey']
|
});
|
||||||
},
|
metaTableBody.push([
|
||||||
{
|
{
|
||||||
columns: [
|
text: gettextCatalog.getString('Voting result') + ':',
|
||||||
{
|
style: ['bold', 'grey']
|
||||||
text: column1.join('\n'),
|
},
|
||||||
width: 'auto'
|
{
|
||||||
},
|
columns: [
|
||||||
{
|
{
|
||||||
text: column2.join('\n'),
|
text: column1.join('\n'),
|
||||||
width: 'auto',
|
width: 'auto'
|
||||||
alignment: 'right'
|
},
|
||||||
},
|
{
|
||||||
{
|
text: column2.join('\n'),
|
||||||
text: column3.join('\n'),
|
width: 'auto',
|
||||||
width: 'auto',
|
alignment: 'right'
|
||||||
alignment: 'right'
|
},
|
||||||
},
|
{
|
||||||
],
|
text: column3.join('\n'),
|
||||||
columnGap: 7,
|
width: 'auto',
|
||||||
style: 'grey'
|
alignment: 'right'
|
||||||
}
|
},
|
||||||
]);
|
],
|
||||||
|
columnGap: 7,
|
||||||
|
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