@@ -247,7 +247,7 module ApplicationHelper | |||||
247 |
|
247 | |||
248 | if attachments |
|
248 | if attachments | |
249 | attachments = attachments.sort_by(&:created_on).reverse |
|
249 | attachments = attachments.sort_by(&:created_on).reverse | |
250 | text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(gif|jpg|jpeg|png))!/) do |m| |
|
250 | text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(bmp|gif|jpg|jpeg|png))!/i) do |m| | |
251 | style = $1 |
|
251 | style = $1 | |
252 | filename = $6 |
|
252 | filename = $6 | |
253 | rf = Regexp.new(Regexp.escape(filename), Regexp::IGNORECASE) |
|
253 | rf = Regexp.new(Regexp.escape(filename), Regexp::IGNORECASE) |
@@ -24,7 +24,8 class ApplicationHelperTest < HelperTestCase | |||||
24 | :repositories, :changesets, |
|
24 | :repositories, :changesets, | |
25 | :trackers, :issue_statuses, :issues, :versions, :documents, |
|
25 | :trackers, :issue_statuses, :issues, :versions, :documents, | |
26 | :wikis, :wiki_pages, :wiki_contents, |
|
26 | :wikis, :wiki_pages, :wiki_contents, | |
27 | :boards, :messages |
|
27 | :boards, :messages, | |
|
28 | :attachments | |||
28 |
|
29 | |||
29 | def setup |
|
30 | def setup | |
30 | super |
|
31 | super | |
@@ -70,6 +71,15 class ApplicationHelperTest < HelperTestCase | |||||
70 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
|
71 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } | |
71 | end |
|
72 | end | |
72 |
|
73 | |||
|
74 | def test_attached_images | |||
|
75 | to_test = { | |||
|
76 | 'Inline image: !logo.gif!' => 'Inline image: <img src="/attachments/download/3" title="This is a logo" alt="This is a logo" />', | |||
|
77 | 'Inline image: !logo.GIF!' => 'Inline image: <img src="/attachments/download/3" title="This is a logo" alt="This is a logo" />' | |||
|
78 | } | |||
|
79 | attachments = Attachment.find(:all) | |||
|
80 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) } | |||
|
81 | end | |||
|
82 | ||||
73 | def test_textile_external_links |
|
83 | def test_textile_external_links | |
74 | to_test = { |
|
84 | to_test = { | |
75 | 'This is a "link":http://foo.bar' => 'This is a <a href="http://foo.bar" class="external">link</a>', |
|
85 | 'This is a "link":http://foo.bar' => 'This is a <a href="http://foo.bar" class="external">link</a>', |
General Comments 0
You need to be logged in to leave comments.
Login now