relying on ActionView's helper methods to construct the HTML
This commit is contained in:
parent
06888a9039
commit
79b5706eda
@ -2,7 +2,9 @@ module Zoomifier
|
||||
module ViewHelpers
|
||||
def zoomify_image_tag(source, options = {})
|
||||
raise ArgumentError unless options[:id]
|
||||
"<div id=\"#{options[:id]}\"><img src=\"#{source}\" alt=\"\"/></div>"
|
||||
content_tag :div, { :id => options[:id] } do
|
||||
image_tag source, options.merge({ :id => nil })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -16,7 +16,7 @@ describe Zoomifier::ViewHelpers do
|
||||
end
|
||||
|
||||
it "should generate the zoomify markup" do
|
||||
@view.zoomify_image_tag('foo.jpg', { :id => 'foo' }).should ==
|
||||
'<div id="foo"><img src="foo.jpg" alt=""/></div>'
|
||||
@view.zoomify_image_tag('foo.jpg', { :id => 'foo', :alt => 'Foo Bar' }).should ==
|
||||
'<div id="foo"><img alt="Foo Bar" src="/images/foo.jpg" /></div>'
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user