Commit 1f3323f9088b897220dc4989ac8da0ef71001ce1

Authored by Nihad Abbasov
1 parent 6c7706eb

use helper to markdown text

app/helpers/application_helper.rb
@@ -30,6 +30,10 @@ module ApplicationHelper @@ -30,6 +30,10 @@ module ApplicationHelper
30 end 30 end
31 end 31 end
32 32
  33 + def markdown(text)
  34 + RDiscount.new(text, :autolink, :no_pseudo_protocols, :safelink, :smart, :filter_html).to_html.html_safe
  35 + end
  36 +
33 def search_autocomplete_source 37 def search_autocomplete_source
34 projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } } 38 projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } }
35 default_nav = [ 39 default_nav = [
app/views/notes/_show.html.haml
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 %div.note_author 2 %div.note_author
3 = image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;" 3 = image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;"
4 %div.note_content.left 4 %div.note_content.left
5 - = raw RDiscount.new(note.note, :smart, :filter_html).to_html 5 + = markdown(note.note)
6 - if note.attachment.url 6 - if note.attachment.url
7 Attachment: 7 Attachment:
8 = link_to note.attachment_identifier, note.attachment.url, :target => "_blank" 8 = link_to note.attachment_identifier, note.attachment.url, :target => "_blank"
app/views/projects/_recent_messages.html.haml
@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 %p{:style => "margin-bottom: 3px;"} 40 %p{:style => "margin-bottom: 3px;"}
41 %span.author 41 %span.author
42 = note.author.name 42 = note.author.name
43 - = link_to truncate(note.note, :length => 200), link_to_item + "#note_#{note.id}" 43 + = link_to truncate(markdown(note.note), :length => 200), link_to_item + "#note_#{note.id}"
44 - if note.attachment.url 44 - if note.attachment.url
45 %br 45 %br
46 Attachment: 46 Attachment: