Validize assignment description, if old-style play intext is in the database

This commit is contained in:
FinnStutzenstein 2018-04-10 08:14:42 +02:00
parent ba579637bd
commit 5b8d11d661
2 changed files with 6 additions and 4 deletions

View File

@ -6,9 +6,10 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
.factory('AssignmentContentProvider', [ .factory('AssignmentContentProvider', [
'$filter', '$filter',
'HTMLValidizer',
'gettextCatalog', 'gettextCatalog',
'PDFLayout', 'PDFLayout',
function($filter, gettextCatalog, PDFLayout) { function($filter, HTMLValidizer, gettextCatalog, PDFLayout) {
var createInstance = function(assignment) { var createInstance = function(assignment) {
@ -39,6 +40,7 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
// description // description
var createDescription = function() { var createDescription = function() {
if (assignment.description) { if (assignment.description) {
var html = HTMLValidizer.validize(assignment.description);
var descriptionText = gettextCatalog.getString("Description") + ":"; var descriptionText = gettextCatalog.getString("Description") + ":";
var description = [ var description = [
{ {
@ -47,7 +49,7 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
style: 'textItem' style: 'textItem'
}, },
{ {
text: $(assignment.description).text(), text: $(html).text(),
style: 'textItem', style: 'textItem',
margin: [10, 0, 0, 0] margin: [10, 0, 0, 0]
} }

View File

@ -144,9 +144,9 @@ angular.module('OpenSlidesApp.core.pdf', [])
return str; return str;
} }
}); });
return "<p>" + str + "</p>"; return '<p>' + str + '</p>';
} else { } else {
return ""; //needed for blank "reasons" field return ''; //needed for blank "reasons" field
} }
}; };
return HTMLValidizer; return HTMLValidizer;