##// END OF EJS Templates
Merged r13451 (#18119)....
Jean-Philippe Lang -
r13082:3a0a55c8ba37
parent child
Show More
@@ -589,7 +589,7 module ApplicationHelper
589 589 end
590 590 return '' if text.blank?
591 591 project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
592 only_path = options.delete(:only_path) == false ? false : true
592 @only_path = only_path = options.delete(:only_path) == false ? false : true
593 593
594 594 text = text.dup
595 595 macros = catch_macros(text)
@@ -236,8 +236,8 module Redmine
236 236 size = nil unless size > 0
237 237 if obj && obj.respond_to?(:attachments) && attachment = Attachment.latest_attach(obj.attachments, filename)
238 238 title = options[:title] || attachment.title
239 thumbnail_url = url_for(:controller => 'attachments', :action => 'thumbnail', :id => attachment, :size => size, :only_path => false)
240 image_url = url_for(:controller => 'attachments', :action => 'show', :id => attachment, :only_path => false)
239 thumbnail_url = url_for(:controller => 'attachments', :action => 'thumbnail', :id => attachment, :size => size, :only_path => @only_path)
240 image_url = url_for(:controller => 'attachments', :action => 'show', :id => attachment, :only_path => @only_path)
241 241
242 242 img = image_tag(thumbnail_url, :alt => attachment.filename)
243 243 link_to(img, image_url, :class => 'thumbnail', :title => title)
@@ -302,17 +302,26 RAW
302 302 end
303 303
304 304 def test_macro_thumbnail
305 link = link_to('<img alt="testfile.PNG" src="/attachments/thumbnail/17" />'.html_safe,
306 "/attachments/17",
307 :class => "thumbnail",
308 :title => "testfile.PNG")
309 assert_equal "<p>#{link}</p>",
310 textilizable("{{thumbnail(testfile.png)}}", :object => Issue.find(14))
311 end
312
313 def test_macro_thumbnail_with_full_path
305 314 link = link_to('<img alt="testfile.PNG" src="http://test.host/attachments/thumbnail/17" />'.html_safe,
306 315 "http://test.host/attachments/17",
307 316 :class => "thumbnail",
308 317 :title => "testfile.PNG")
309 318 assert_equal "<p>#{link}</p>",
310 textilizable("{{thumbnail(testfile.png)}}", :object => Issue.find(14))
319 textilizable("{{thumbnail(testfile.png)}}", :object => Issue.find(14), :only_path => false)
311 320 end
312 321
313 322 def test_macro_thumbnail_with_size
314 link = link_to('<img alt="testfile.PNG" src="http://test.host/attachments/thumbnail/17/200" />'.html_safe,
315 "http://test.host/attachments/17",
323 link = link_to('<img alt="testfile.PNG" src="/attachments/thumbnail/17/200" />'.html_safe,
324 "/attachments/17",
316 325 :class => "thumbnail",
317 326 :title => "testfile.PNG")
318 327 assert_equal "<p>#{link}</p>",
@@ -320,8 +329,8 RAW
320 329 end
321 330
322 331 def test_macro_thumbnail_with_title
323 link = link_to('<img alt="testfile.PNG" src="http://test.host/attachments/thumbnail/17" />'.html_safe,
324 "http://test.host/attachments/17",
332 link = link_to('<img alt="testfile.PNG" src="/attachments/thumbnail/17" />'.html_safe,
333 "/attachments/17",
325 334 :class => "thumbnail",
326 335 :title => "Cool image")
327 336 assert_equal "<p>#{link}</p>",
General Comments 0
You need to be logged in to leave comments. Login now