respect newlines for wall messages

This commit is contained in:
Dmitriy Zaporozhets 2013-05-24 09:49:49 +03:00
parent 76ffd11684
commit bd6dfe7d44
2 changed files with 4 additions and 1 deletions

View file

@ -41,6 +41,9 @@ window.linkify = (str) ->
exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig
return str.replace(exp,"<a href='$1'>$1</a>")
window.simpleFormat = (str) ->
linkify(sanitize(str).replace(/\n/g, '<br />'))
window.startSpinner = ->
$('.turbolink-spinner').fadeIn()

View file

@ -61,7 +61,7 @@ class Wall
template = @noteTemplate()
template = template.replace('{{author_name}}', note.author.name)
template = template.replace(/{{created_at}}/g, note.created_at)
template = template.replace('{{text}}', linkify(sanitize(note.body)))
template = template.replace('{{text}}', simpleFormat(note.body))
if note.attachment
file = '<i class="icon-paper-clip"/><a href="/files/note/' + note.id + '/' + note.attachment + '">' + note.attachment + '</a>'