Module: Pageflow::BackgroundImageHelper
Defined Under Namespace
Classes: Div, DivWithSizeAttributes
Instance Method Summary
collapse
#find_file_in_entry
Instance Method Details
#background_image_div(configuration, property_base_name, options = {}) ⇒ Object
5
6
7
|
# File 'app/helpers/pageflow/background_image_helper.rb', line 5
def background_image_div(configuration, property_base_name, options = {})
Div.new(@entry, self, configuration, property_base_name, options).render
end
|
#background_image_div_with_size(configuration, property_base_name, options = {}) ⇒ Object
9
10
11
|
# File 'app/helpers/pageflow/background_image_helper.rb', line 9
def background_image_div_with_size(configuration, property_base_name, options = {})
DivWithSizeAttributes.new(@entry, self, configuration, property_base_name, options).render
end
|
#background_image_lazy_loading_css_class(prefix, model) ⇒ Object
22
23
24
25
|
# File 'app/helpers/pageflow/background_image_helper.rb', line 22
def background_image_lazy_loading_css_class(prefix, model)
css_class = [prefix, model.perma_id].join('_')
".load_all_images .#{css_class}, .load_image.#{css_class}"
end
|
#background_image_tag(image_perma_id, options = {}) ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'app/helpers/pageflow/background_image_helper.rb', line 13
def background_image_tag(image_perma_id, options = {})
image = find_file_in_entry(ImageFile, image_perma_id)
return unless image&.ready?
options = options.merge('data-src': image.attachment.url(:medium))
options = options.merge('data-printsrc': image.attachment.url(:print))
image_tag('', options)
end
|