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 41 exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig
42 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 47 window.startSpinner = ->
45 48 $('.turbolink-spinner').fadeIn()
46 49  
... ...
app/assets/javascripts/wall.js.coffee
... ... @@ -61,7 +61,7 @@ class Wall
61 61 template = @noteTemplate()
62 62 template = template.replace('{{author_name}}', note.author.name)
63 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 66 if note.attachment
67 67 file = '<i class="icon-paper-clip"/><a href="/files/note/' + note.id + '/' + note.attachment + '">' + note.attachment + '</a>'
... ...