@@ -207,8 +207,10 module ApplicationHelper | |||
|
207 | 207 | rf = Regexp.new(filename, Regexp::IGNORECASE) |
|
208 | 208 | # search for the picture in attachments |
|
209 | 209 | if found = attachments.detect { |att| att.filename =~ rf } |
|
210 |
image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found |
|
|
211 | "!#{style}#{image_url}!" | |
|
210 | image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found | |
|
211 | desc = found.description.to_s.gsub(/^([^\(\)]*).*$/, "\\1") | |
|
212 | alt = desc.blank? ? nil : "(#{desc})" | |
|
213 | "!#{style}#{image_url}#{alt}!" | |
|
212 | 214 | else |
|
213 | 215 | "!#{style}#{filename}!" |
|
214 | 216 | end |
@@ -34,5 +34,6 attachments_003: | |||
|
34 | 34 | container_type: WikiPage |
|
35 | 35 | filesize: 280 |
|
36 | 36 | filename: logo.gif |
|
37 | description: This is a logo | |
|
37 | 38 | author_id: 2 |
|
38 | 39 | No newline at end of file |
@@ -45,7 +45,8 class WikiControllerTest < Test::Unit::TestCase | |||
|
45 | 45 | assert_tag :tag => 'h1', :content => /Another page/ |
|
46 | 46 | # Included page with an inline image |
|
47 | 47 | assert_tag :tag => 'p', :content => /This is an inline image/ |
|
48 |
assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3' |
|
|
48 | assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3', | |
|
49 | :alt => 'This is a logo' } | |
|
49 | 50 | end |
|
50 | 51 | |
|
51 | 52 | def test_show_unexistent_page_without_edit_right |
General Comments 0
You need to be logged in to leave comments.
Login now