comment nl2br

stable
Juanfran 2014-08-13 13:45:03 +02:00
parent cf61c750cd
commit 445b39b609
2 changed files with 6 additions and 1 deletions

View File

@ -280,7 +280,7 @@ ChangeDirective = ->
avatar: getUserAvatar(comment.user.pk)
userFullName: getUserFullName(comment.user.pk)
creationDate: moment(comment.created_at).format("YYYY/MM/DD HH:mm")
comment: comment.comment_html
comment: taiga.nl2br(comment.comment_html)
changesText: buildChangesText(comment)
hasChanges: countChanges(comment) > 0
})

View File

@ -19,6 +19,10 @@
# File: utils.coffee
###
nl2br = (str) =>
breakTag = '<br />'
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2')
bindOnce = (scope, attr, continuation) =>
val = scope.$eval(attr)
if val != undefined
@ -131,6 +135,7 @@ generateHash = (components=[]) ->
return hex_sha1(components.join(":"))
taiga = @.taiga
taiga.nl2br = nl2br
taiga.bindOnce = bindOnce
taiga.mixOf = mixOf
taiga.trim = trim