Commit bd6dfe7d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

respect newlines for wall messages

parent 76ffd116
...@@ -41,6 +41,9 @@ window.linkify = (str) -> ...@@ -41,6 +41,9 @@ window.linkify = (str) ->
exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig
return str.replace(exp,"<a href='$1'>$1</a>") return str.replace(exp,"<a href='$1'>$1</a>")
window.simpleFormat = (str) ->
linkify(sanitize(str).replace(/\n/g, '<br />'))
window.startSpinner = -> window.startSpinner = ->
$('.turbolink-spinner').fadeIn() $('.turbolink-spinner').fadeIn()
......
...@@ -61,7 +61,7 @@ class Wall ...@@ -61,7 +61,7 @@ class Wall
template = @noteTemplate() template = @noteTemplate()
template = template.replace('{{author_name}}', note.author.name) template = template.replace('{{author_name}}', note.author.name)
template = template.replace(/{{created_at}}/g, note.created_at) 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 if note.attachment
file = '<i class="icon-paper-clip"/><a href="/files/note/' + note.id + '/' + note.attachment + '">' + note.attachment + '</a>' file = '<i class="icon-paper-clip"/><a href="/files/note/' + note.id + '/' + note.attachment + '">' + note.attachment + '</a>'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment