Commit 406076731ec23eb52b52c03fba606aa60cc72926
Exists in
master
and in
4 other branches
Merge branch 'refs/heads/markdown_notes' into dev
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,6 +19,7 @@ gem "pygments.rb", "0.2.3" | ||
| 19 | gem "thin" | 19 | gem "thin" |
| 20 | gem "git" | 20 | gem "git" |
| 21 | gem "acts_as_list" | 21 | gem "acts_as_list" |
| 22 | +gem 'rdiscount' | ||
| 22 | 23 | ||
| 23 | group :assets do | 24 | group :assets do |
| 24 | gem 'sass-rails', " ~> 3.1.0" | 25 | gem 'sass-rails', " ~> 3.1.0" |
| @@ -26,7 +27,7 @@ group :assets do | @@ -26,7 +27,7 @@ group :assets do | ||
| 26 | gem 'uglifier' | 27 | gem 'uglifier' |
| 27 | end | 28 | end |
| 28 | 29 | ||
| 29 | -group :development do | 30 | +group :development do |
| 30 | gem 'rails-footnotes', '>= 3.7.5.rc4' | 31 | gem 'rails-footnotes', '>= 3.7.5.rc4' |
| 31 | gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git' | 32 | gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git' |
| 32 | end | 33 | end |
Gemfile.lock
| @@ -161,6 +161,7 @@ GEM | @@ -161,6 +161,7 @@ GEM | ||
| 161 | rdoc (~> 3.4) | 161 | rdoc (~> 3.4) |
| 162 | thor (~> 0.14.6) | 162 | thor (~> 0.14.6) |
| 163 | rake (0.9.2) | 163 | rake (0.9.2) |
| 164 | + rdiscount (1.6.8) | ||
| 164 | rdoc (3.9.4) | 165 | rdoc (3.9.4) |
| 165 | rspec (2.6.0) | 166 | rspec (2.6.0) |
| 166 | rspec-core (~> 2.6.0) | 167 | rspec-core (~> 2.6.0) |
| @@ -264,6 +265,7 @@ DEPENDENCIES | @@ -264,6 +265,7 @@ DEPENDENCIES | ||
| 264 | pygments.rb (= 0.2.3) | 265 | pygments.rb (= 0.2.3) |
| 265 | rails (= 3.1.0) | 266 | rails (= 3.1.0) |
| 266 | rails-footnotes (>= 3.7.5.rc4) | 267 | rails-footnotes (>= 3.7.5.rc4) |
| 268 | + rdiscount | ||
| 267 | rspec-rails | 269 | rspec-rails |
| 268 | ruby-debug19 | 270 | ruby-debug19 |
| 269 | sass-rails (~> 3.1.0) | 271 | sass-rails (~> 3.1.0) |
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 | - = simple_format(html_escape(note.note)) | 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: |