Module: Pwb::ImagesHelper
- Defined in:
- app/helpers/pwb/images_helper.rb
Instance Method Summary collapse
- #bg_image(photo, options = {}) ⇒ Object
- #opt_image_tag(photo, options = {}) ⇒ Object
- #opt_image_url(photo, options = {}) ⇒ Object
Instance Method Details
#bg_image(photo, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/helpers/pwb/images_helper.rb', line 3 def bg_image(photo, = {}) image_url = get_opt_image_url photo, # style="background-image:linear-gradient( rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.1) ),url(<%= carousel_item.default_photo %>);" if [:gradient] "background-image: linear-gradient(#{options[:gradient]}), url(#{image_url});".html_safe else "background-image: url(#{image_url});".html_safe end end |
#opt_image_tag(photo, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/pwb/images_helper.rb', line 13 def opt_image_tag(photo, = {}) unless photo && photo.image.present? return nil end if Rails.application.config.use_cloudinary cl_image_tag photo.image, else image_tag photo.image.url, end end |
#opt_image_url(photo, options = {}) ⇒ Object
24 25 26 |
# File 'app/helpers/pwb/images_helper.rb', line 24 def opt_image_url(photo, = {}) get_opt_image_url photo, end |