Commit bd6dfe7d443efc51c3b8502b632ce2e2816424d8

Authored by Dmitriy Zaporozhets
1 parent 76ffd116

respect newlines for wall messages

app/assets/javascripts/main.js.coffee
@@ -41,6 +41,9 @@ window.linkify = (str) -> @@ -41,6 +41,9 @@ window.linkify = (str) ->
41 exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig 41 exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig
42 return str.replace(exp,"<a href='$1'>$1</a>") 42 return str.replace(exp,"<a href='$1'>$1</a>")
43 43
  44 +window.simpleFormat = (str) ->
  45 + linkify(sanitize(str).replace(/\n/g, '<br />'))
  46 +
44 window.startSpinner = -> 47 window.startSpinner = ->
45 $('.turbolink-spinner').fadeIn() 48 $('.turbolink-spinner').fadeIn()
46 49
app/assets/javascripts/wall.js.coffee
@@ -61,7 +61,7 @@ class Wall @@ -61,7 +61,7 @@ class Wall
61 template = @noteTemplate() 61 template = @noteTemplate()
62 template = template.replace('{{author_name}}', note.author.name) 62 template = template.replace('{{author_name}}', note.author.name)
63 template = template.replace(/{{created_at}}/g, note.created_at) 63 template = template.replace(/{{created_at}}/g, note.created_at)
64 - template = template.replace('{{text}}', linkify(sanitize(note.body))) 64 + template = template.replace('{{text}}', simpleFormat(note.body))
65 65
66 if note.attachment 66 if note.attachment
67 file = '<i class="icon-paper-clip"/><a href="/files/note/' + note.id + '/' + note.attachment + '">' + note.attachment + '</a>' 67 file = '<i class="icon-paper-clip"/><a href="/files/note/' + note.id + '/' + note.attachment + '">' + note.attachment + '</a>'