4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/unveil/rails/view_helper.rb', line 4
def lazy_image_tag(source, options = {})
placeholder_source = options[:placeholder] || Unveil::Rails.config.default_placeholder
options[:alt] = options[:alt] || image_alt(source)
lazy_options = options.merge('data-src' => image_path(source))
if options.has_key?(:retina)
lazy_options['data-src-retina'] = image_path(options[:retina])
end
html = [image_tag(placeholder_source, lazy_options)]
html << '<noscript>'
html << image_tag(source, options)
html << '</noscript>'
html.join("\n").html_safe
end
|