Module: Pageflow::Chart::ScrapedSitesHelper

Includes:
RevisionFileHelper
Defined in:
app/helpers/pageflow/chart/scraped_sites_helper.rb

Constant Summary collapse

IFRAME_ATTRIBUTES =
{
  style: 'width: 100%; height: 100%',
  scrolling: 'auto',
  frameborder: '0',
  align: 'aus',
  allowfullscreen: 'true',
  mozallowfullscreen: 'true',
  webkitallowfullscreen: 'true'
}

Instance Method Summary collapse

Instance Method Details

#scraped_site_iframe(configuration) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/helpers/pageflow/chart/scraped_sites_helper.rb', line 16

def scraped_site_iframe(configuration)
  data_attributes = {}

  if configuration['chart_url']
    data_attributes = {
      src: configuration['chart_url'].gsub(/^https?:/, '')
    }
  elsif (scraped_site = find_scraped_site(configuration))
    data_attributes = {
      src: scraped_site.html_file_url,
      customize_layout: true,
      use_custom_theme: scraped_site.use_custom_theme ? true : nil
    }
  end

  (:iframe, '', IFRAME_ATTRIBUTES.merge(data: data_attributes))
end