Module: Pageflow::TextPage::ImageHelper

Defined in:
app/helper/pageflow/text_page/image_helper.rb

Instance Method Summary collapse

Instance Method Details

#background_asset_present_css_class(configuration) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'app/helper/pageflow/text_page/image_helper.rb', line 31

def background_asset_present_css_class(configuration)
  file =
    if configuration['background_type'] == 'video'
      Pageflow::VideoFile.find_by_id(configuration['video_file_id'])
    else
      Pageflow::ImageFile.find_by_id(configuration['background_image_id'])
    end

  file ? '' : 'no_background_asset'
end

#content_image(id, alt, format = :medium) ⇒ Object



4
5
6
7
8
9
10
11
# File 'app/helper/pageflow/text_page/image_helper.rb', line 4

def content_image(id, alt, format = :medium)
  image = Pageflow::ImageFile.find_by_id(id)
  if image
    image_tag(image.attachment.url(:medium))
  else
    ''
  end
end

#content_image_large(id, alt, format = :large) ⇒ Object



13
14
15
16
17
18
19
20
# File 'app/helper/pageflow/text_page/image_helper.rb', line 13

def content_image_large(id, alt, format = :large)
  image = Pageflow::ImageFile.find_by_id(id)
  if image
    image_tag(image.attachment.url(:large))
  else
    ''
  end
end

#fullscreen_image_url(id, format = :large) ⇒ Object



22
23
24
25
26
27
28
29
# File 'app/helper/pageflow/text_page/image_helper.rb', line 22

def fullscreen_image_url(id, format = :large)
  image = Pageflow::ImageFile.find_by_id(id)
  if image
    return image.attachment.url(:large)
  else
    '#'
  end
end