Sha256: 69cd29e396171669ffd3d5bd7fdcc3350a718c0f71ac307f0f4f6bc02cef2946
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
module Pageflow module Chart module ScrapedSitesHelper include RevisionFileHelper IFRAME_ATTRIBUTES = { style: 'width: 100%; height: 100%', scrolling: 'auto', frameborder: '0', align: 'aus', allowfullscreen: 'true', mozallowfullscreen: 'true', webkitallowfullscreen: 'true' } 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 content_tag(:iframe, '', IFRAME_ATTRIBUTES.merge(data: data_attributes)) end private def find_scraped_site(configuration) find_file_in_entry(ScrapedSite, configuration['scraped_site_id']) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems