Commit 741b63dbb8a2fc2d3fa1e7224fff03dddd045173
1 parent
772ba1bc
Exists in
master
and in
29 other branches
ActionItem339: comments respects line breaks and make links on urls
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1723 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
11 additions
and
1 deletions
Show diff stats
app/views/content_viewer/_comment.rhtml
... | ... | @@ -27,6 +27,16 @@ |
27 | 27 | <%= '<br/>' + _('(unauthenticated user)') if ! comment.author %> |
28 | 28 | </div> |
29 | 29 | <div class="comment-text"> |
30 | - <%= comment.body %> | |
30 | + <p/> | |
31 | + <%= | |
32 | + comment.body. | |
33 | + gsub( /\n\s*\n/, ' <p/> ' ). | |
34 | + gsub( /\n/, ' <br/> ' ). | |
35 | + gsub( /(^|\s)(www\.[^\s])/, '\1http://\2' ). | |
36 | + gsub( /(https?:\/\/([^\s]+))/, | |
37 | + '<a href="\1" target="_blank" rel="nofolow" onclick="return confirm(\'' + | |
38 | + escape_javascript( _('Are you sure you want to visit this web site?') ) + | |
39 | + '\n\n\'+this.href)">\2</a>' ) | |
40 | + %> | |
31 | 41 | </div> |
32 | 42 | </div> | ... | ... |