2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/helpers/blurred_image_tag_helper.rb', line 2
def blurred_image_tag(source, options = {})
parent_div_classes = [options[:class], 'blurred-image-wrapper'].join(' ')
original_img_classes = [options[:class], 'original'].join(' ')
blurred_img_classes = [options[:class], 'blurred'].join(' ')
width = options[:width].nil? ? '100%' : options[:width]
height = options[:height].nil? ? '100%' : options[:height]
output = '<div class="' + parent_div_classes + '" style="width: ' + width + '; padding-top: ' + height + '">'
output += image_tag source, options.merge(class: blurred_img_classes).except(:width, :height)
output += image_tag source, options.merge(class: original_img_classes).except(:width, :height)
output += '</div>'
output.html_safe
end
|