MDL-49176 gradingform_guide: display newline characters as <br> tags

This commit is contained in:
Davo Smith 2015-06-22 08:14:02 +01:00
parent f4bfbd5aa2
commit 556e33d77c
2 changed files with 8 additions and 1 deletions

View File

@ -111,7 +111,8 @@ M.gradingform_guideeditor.editmode = function(el, editmode) {
value = M.util.get_string('clicktoedit', 'gradingform_guide')
taplain.addClass('empty')
}
taplain.one('.textvalue').set('innerHTML', Y.Escape.html(value))
// Replace newlines with <br> tags, when displaying in the page.
taplain.one('.textvalue').set('innerHTML', Y.Escape.html(value).replace(/(?:\r\n|\r|\n)/g, '<br>'))
if (tb) {
tbplain.one('.textvalue').set('innerHTML', Y.Escape.html(tb.get('value')))
}

View File

@ -145,6 +145,10 @@ class gradingform_guide_renderer extends plugin_renderer_base {
'name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]'));
$maxscore = html_writer::tag('div', s($criterion['maxscore']),
array('class'=>'criteriondescriptionscore', 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]'));
// Retain newlines as <br> tags when displaying the marking guide.
$description = nl2br($description);
$descriptionmarkers = nl2br($descriptionmarkers);
}
if (isset($criterion['error_description'])) {
@ -290,6 +294,8 @@ class gradingform_guide_renderer extends plugin_renderer_base {
} else {
$description = s($comment['description']);
}
// Retain newlines as <br> tags when displaying 'frequently used comments'.
$description = nl2br($description);
}
$descriptionclass = 'description';
if (isset($comment['error_description'])) {