OpenSlides/openslides/agenda/static/js/agenda/pdf.js

81 lines
2.1 KiB
JavaScript
Raw Normal View History

2016-10-05 16:21:00 +02:00
(function () {
'use strict';
angular.module('OpenSlidesApp.agenda.pdf', ['OpenSlidesApp.core.pdf'])
.factory('AgendaContentProvider', [
'gettextCatalog',
'PDFLayout',
function(gettextCatalog, PDFLayout) {
2016-10-05 16:21:00 +02:00
var createInstance = function(items) {
// page title
var title = PDFLayout.createTitle(gettextCatalog.getString("Agenda"));
2016-10-05 16:21:00 +02:00
// generate the item list with all subitems
2016-10-05 16:21:00 +02:00
var createItemList = function() {
var agenda_items = [];
angular.forEach(items, function (item) {
if (item.is_hidden === false) {
var itemIndent = item.parentCount * 20;
var itemStyle;
if (item.parentCount === 0) {
itemStyle = 'listParent';
} else {
itemStyle = 'listChild';
}
var itemNumberWidth;
if (item.item_number === "") {
itemNumberWidth = 0;
} else {
itemNumberWidth = 60;
}
var agendaJsonString = {
style: itemStyle,
columns: [
{
width: itemIndent,
text: ''
},
{
width: itemNumberWidth,
text: item.item_number
},
{
text: item.title
}
]
};
agenda_items.push(agendaJsonString);
}
});
return agenda_items;
};
var getContent = function() {
return [
title,
createItemList()
];
};
return {
getContent: getContent
};
};
return {
createInstance: createInstance
};
}]);
}());