mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
Render notes using RedCloth without formatize
Removes the outdated bluecloth dependency
This commit is contained in:
parent
053e3fc8d6
commit
dc311221f1
10 changed files with 16 additions and 21 deletions
1
Gemfile
1
Gemfile
|
|
@ -9,7 +9,6 @@ gem "sqlite3"
|
||||||
gem "mysql2"
|
gem "mysql2"
|
||||||
|
|
||||||
gem "RedCloth"
|
gem "RedCloth"
|
||||||
gem "formatize"
|
|
||||||
gem "sanitize"
|
gem "sanitize"
|
||||||
gem "will_paginate"
|
gem "will_paginate"
|
||||||
gem "acts_as_list"
|
gem "acts_as_list"
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ GEM
|
||||||
cucumber (>= 1.1.1)
|
cucumber (>= 1.1.1)
|
||||||
rspec-expectations (>= 2.7.0)
|
rspec-expectations (>= 2.7.0)
|
||||||
bcrypt-ruby (3.0.1)
|
bcrypt-ruby (3.0.1)
|
||||||
bluecloth (2.2.0)
|
|
||||||
builder (3.0.4)
|
builder (3.0.4)
|
||||||
bullet (4.3.1)
|
bullet (4.3.1)
|
||||||
uniform_notifier
|
uniform_notifier
|
||||||
|
|
@ -80,10 +79,6 @@ GEM
|
||||||
factory_girl (~> 4.2.0)
|
factory_girl (~> 4.2.0)
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
ffi (1.4.0)
|
ffi (1.4.0)
|
||||||
formatize (1.1.0)
|
|
||||||
RedCloth (~> 4.2)
|
|
||||||
actionpack (~> 3.0)
|
|
||||||
bluecloth (~> 2.2)
|
|
||||||
gherkin (2.11.6)
|
gherkin (2.11.6)
|
||||||
json (>= 1.7.6)
|
json (>= 1.7.6)
|
||||||
hike (1.2.1)
|
hike (1.2.1)
|
||||||
|
|
@ -205,7 +200,6 @@ DEPENDENCIES
|
||||||
cucumber-rails
|
cucumber-rails
|
||||||
database_cleaner
|
database_cleaner
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
formatize
|
|
||||||
htmlentities
|
htmlentities
|
||||||
jquery-rails
|
jquery-rails
|
||||||
mocha
|
mocha
|
||||||
|
|
|
||||||
|
|
@ -280,3 +280,7 @@ input#todo_description, input#tag_list, textarea#todo_notes, select#todo_project
|
||||||
background: #cc3334 image-url('next.png') right center no-repeat;
|
background: #cc3334 image-url('next.png') right center no-repeat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.note_wrapper p {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class ApplicationController < ActionController::Base
|
||||||
protect_from_forgery
|
protect_from_forgery
|
||||||
|
|
||||||
include LoginSystem
|
include LoginSystem
|
||||||
helper_method :current_user, :prefs, :format_date, :markdown
|
helper_method :current_user, :prefs, :format_date
|
||||||
|
|
||||||
layout proc{ |controller| controller.mobile? ? "mobile" : "application" }
|
layout proc{ |controller| controller.mobile? ? "mobile" : "application" }
|
||||||
# exempt_from_layout /\.js\.erb$/
|
# exempt_from_layout /\.js\.erb$/
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
module NotesHelper
|
module NotesHelper
|
||||||
def truncated_note(note, characters = 50)
|
def truncated_note(note, characters = 50)
|
||||||
sanitize(textilize_without_paragraph(truncate(note.body, :length => characters, :omission => "...")))
|
Tracks::Utils.render_text(truncate(note.body, :length => characters, :omission => "..."))
|
||||||
end
|
end
|
||||||
|
|
||||||
def rendered_note(note)
|
def rendered_note(note)
|
||||||
sanitize(textilize_without_paragraph(note.body))
|
Tracks::Utils.render_text(note.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_to_delete_note(note, descriptor = sanitize(note.id.to_s))
|
def link_to_delete_note(note, descriptor = sanitize(note.id.to_s))
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="mobile_note">
|
<div class="mobile_note">
|
||||||
<%= sanitize(textilize_without_paragraph(note.body)) %>
|
<%= rendered_note(note) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="mobile_note_info">
|
<div class="mobile_note_info">
|
||||||
<br/>
|
<br/>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<% note = note_details -%>
|
<% note = note_details -%>
|
||||||
<div class="note_boby"><%= Tracks::Utils.render_text(note.body) %></div>
|
<div class="note_body"><%= rendered_note(note) %></div>
|
||||||
|
|
||||||
<div class="note_footer">
|
<div class="note_footer">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
<% note = notes_summary -%>
|
<% note = notes_summary -%>
|
||||||
<div class="note"><%= link_to( truncated_note(note), note_path(note, :format => 'm')) %></div>
|
<div class="note_wrapper">
|
||||||
|
<div class="note"><%= link_to( truncated_note(note), note_path(note, :format => 'm')) %></div>
|
||||||
|
</div>
|
||||||
<% note = nil -%>
|
<% note = nil -%>
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ module Tracks
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.render_text(text)
|
def self.render_text(text)
|
||||||
rendered = Tracks::Utils.auto_link_message(text)
|
rendered = auto_link_message(text)
|
||||||
rendered = markdown(rendered)
|
rendered = textile(rendered)
|
||||||
rendered = helpers.auto_link(rendered, :link => :urls)
|
rendered = helpers.auto_link(rendered, :link => :urls)
|
||||||
|
|
||||||
# add onenote and message protocols
|
# add onenote and message protocols
|
||||||
|
|
@ -34,11 +34,7 @@ module Tracks
|
||||||
return rendered.html_safe
|
return rendered.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
# Uses RedCloth to transform text using either Textile or Markdown Need to
|
def self.textile(text)
|
||||||
# require redcloth above RedCloth 3.0 or greater is needed to use Markdown,
|
|
||||||
# otherwise it only handles Textile
|
|
||||||
#
|
|
||||||
def self.markdown(text)
|
|
||||||
RedCloth.new(text).to_html
|
RedCloth.new(text).to_html
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -746,7 +746,7 @@ class TodosControllerTest < ActionController::TestCase
|
||||||
assert_select("div#notes_todo_#{todo.id}", "A normal description.")
|
assert_select("div#notes_todo_#{todo.id}", "A normal description.")
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_format_note_markdown
|
def test_format_note_textile
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
todo = users(:admin_user).todos.first
|
todo = users(:admin_user).todos.first
|
||||||
todo.notes = "A *bold description*."
|
todo.notes = "A *bold description*."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue