Turn newlines into linebreaks.

(imported from commit 67999641a8cff471be1430e421f259b1c558444d)
This commit is contained in:
Jessica McKellar
2012-08-29 16:47:53 -04:00
parent 13ee85f886
commit a8fa6b156a
2 changed files with 6 additions and 2 deletions

View File

@@ -26,7 +26,7 @@
{% endif %}
<span onclick="prepare_personal('{{ zephyr.sender.user.username }}')" class="label zephyr_sender">{{ zephyr.sender.user.username }}</span><br />
{{ zephyr.content }}
{{ zephyr.content|linebreaksbr }}
</p></td>
</tr>
{% endfor %}

View File

@@ -183,6 +183,10 @@ $(function() {
setInterval(get_updates, 1000);
});
function newline2br(content) {
return content.replace(/\n/g, '<br />');
}
function add_message(index, zephyr) {
var new_str = "<tr id=" + zephyr.id + ">" +
"<td class='pointer'><p></p></td>" +
@@ -200,7 +204,7 @@ function add_message(index, zephyr) {
}
new_str += "<span onclick=\"prepare_personal('" + zephyr.sender + "')\" class='label zephyr_sender'>"
+ zephyr.sender + "</span><br />"
+ zephyr.content +
+ newline2br(zephyr.content) +
"</p></td>" +
"</tr>";
$("#table tr:last").after(new_str);