Commit fb33ccd87f742db0a8e6e5d106ebc98d07124e70
Exists in
master
and in
4 other branches
Merge branch 'dev' into new_layout
Showing
5 changed files
with
10 additions
and
3 deletions
Show diff stats
Gemfile
| ... | ... | @@ -19,6 +19,7 @@ gem "pygments.rb", "0.2.3" |
| 19 | 19 | gem "thin" |
| 20 | 20 | gem "git" |
| 21 | 21 | gem "acts_as_list" |
| 22 | +gem 'rdiscount' | |
| 22 | 23 | |
| 23 | 24 | group :assets do |
| 24 | 25 | gem 'sass-rails', " ~> 3.1.0" |
| ... | ... | @@ -26,7 +27,7 @@ group :assets do |
| 26 | 27 | gem 'uglifier' |
| 27 | 28 | end |
| 28 | 29 | |
| 29 | -group :development do | |
| 30 | +group :development do | |
| 30 | 31 | gem 'rails-footnotes', '>= 3.7.5.rc4' |
| 31 | 32 | gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git' |
| 32 | 33 | end | ... | ... |
Gemfile.lock
| ... | ... | @@ -161,6 +161,7 @@ GEM |
| 161 | 161 | rdoc (~> 3.4) |
| 162 | 162 | thor (~> 0.14.6) |
| 163 | 163 | rake (0.9.2) |
| 164 | + rdiscount (1.6.8) | |
| 164 | 165 | rdoc (3.9.4) |
| 165 | 166 | rspec (2.6.0) |
| 166 | 167 | rspec-core (~> 2.6.0) |
| ... | ... | @@ -264,6 +265,7 @@ DEPENDENCIES |
| 264 | 265 | pygments.rb (= 0.2.3) |
| 265 | 266 | rails (= 3.1.0) |
| 266 | 267 | rails-footnotes (>= 3.7.5.rc4) |
| 268 | + rdiscount | |
| 267 | 269 | rspec-rails |
| 268 | 270 | ruby-debug19 |
| 269 | 271 | sass-rails (~> 3.1.0) | ... | ... |
app/helpers/application_helper.rb
| ... | ... | @@ -30,6 +30,10 @@ module ApplicationHelper |
| 30 | 30 | end |
| 31 | 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 | 37 | def search_autocomplete_source |
| 34 | 38 | projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } } |
| 35 | 39 | default_nav = [ | ... | ... |
app/views/notes/_show.html.haml
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | %div.note_author |
| 3 | 3 | = image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;" |
| 4 | 4 | %div.note_content.left |
| 5 | - = simple_format(html_escape(note.note)) | |
| 5 | + = markdown(note.note) | |
| 6 | 6 | - if note.attachment.url |
| 7 | 7 | Attachment: |
| 8 | 8 | = link_to note.attachment_identifier, note.attachment.url, :target => "_blank" | ... | ... |
app/views/projects/_recent_messages.html.haml
| ... | ... | @@ -40,7 +40,7 @@ |
| 40 | 40 | %p{:style => "margin-bottom: 3px;"} |
| 41 | 41 | %span.author |
| 42 | 42 | = note.author.name |
| 43 | - = link_to truncate(note.note, :length => 200), link_to_item + "#note_#{note.id}" | |
| 43 | + = link_to markdown(truncate(note.note, :length => 200)), link_to_item + "#note_#{note.id}" | |
| 44 | 44 | - if note.attachment.url |
| 45 | 45 | %br |
| 46 | 46 | Attachment: | ... | ... |