Class: Pageflow::Chart::Configuration
- Inherits:
-
Object
- Object
- Pageflow::Chart::Configuration
- Defined in:
- lib/pageflow/chart/configuration.rb
Instance Attribute Summary collapse
-
#datawrapper_themes_with_transparent_background_support ⇒ Array<String>
readonly
List of datawrapper theme names for which an additional css rule shall be injected to make the background transparent.
-
#paperclip_base_path ⇒ Object
paperclip_base_path is a prefix for the paperclip options path.
-
#paperclip_s3_default_options ⇒ Hash
Default options for paperclip attachments which are supposed to use s3 storage.
-
#scraped_sites_root_url ⇒ Object
If present scraped_sites_root_url replaces the host/domain-name of the URL paperclip returns for the scraped HTML file.
-
#scraper_options ⇒ Object
readonly
Options to pass to Scraper when it is created in ScrapedSiteJob.
-
#supported_hosts ⇒ Array<String>
readonly
White list of URL prefixes (including protocol) of scraped sites.
-
#use_custom_theme ⇒ Boolean
If enabled, set
has_custom_themetotruefor new scraped sites.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #paperclip_options(options = {}) ⇒ Object private
Constructor Details
#initialize ⇒ Configuration
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/pageflow/chart/configuration.rb', line 55 def initialize = { head_script_blacklist: [/piwik/], inline_script_blacklist: [/piwik/], selector_blacklist: ['body .noscript'] } = {} @paperclip_base_path = ':host' @scraped_sites_root_url = nil @supported_hosts = [ 'http://cf.datawrapper.de', 'http://datawrapper.dwcdn.de', 'http://datawrapper.dwcdn.net' ] @use_custom_theme = false @datawrapper_themes_with_transparent_background_support = ['pageflow'] end |
Instance Attribute Details
#datawrapper_themes_with_transparent_background_support ⇒ Array<String> (readonly)
List of datawrapper theme names for which an additional css rule shall be injected to make the background transparent. This is only recommended for themes with dark backgrounds. By default, this is only done for the pageflow theme.
53 54 55 |
# File 'lib/pageflow/chart/configuration.rb', line 53 def datawrapper_themes_with_transparent_background_support @datawrapper_themes_with_transparent_background_support end |
#paperclip_base_path ⇒ Object
paperclip_base_path is a prefix for the paperclip options path
8 9 10 |
# File 'lib/pageflow/chart/configuration.rb', line 8 def paperclip_base_path @paperclip_base_path end |
#paperclip_s3_default_options ⇒ Hash
Default options for paperclip attachments which are supposed to use s3 storage. All options allowed in paperclip has_attached_file calls are allowed. This defaults to the configuration in config/initializers/pageflow.rb by the same name.
28 29 30 |
# File 'lib/pageflow/chart/configuration.rb', line 28 def end |
#scraped_sites_root_url ⇒ Object
If present scraped_sites_root_url replaces the host/domain-name of the URL paperclip returns for the scraped HTML file.
This can be used to circumvent the same-domain policy by setting it to ie “/datawrapper” and redirecting from there to the S3 host alias that holds the files.
16 17 18 |
# File 'lib/pageflow/chart/configuration.rb', line 16 def scraped_sites_root_url @scraped_sites_root_url end |
#scraper_options ⇒ Object (readonly)
Options to pass to Scraper when it is created in ScrapedSiteJob
5 6 7 |
# File 'lib/pageflow/chart/configuration.rb', line 5 def end |
#supported_hosts ⇒ Array<String> (readonly)
White list of URL prefixes (including protocol) of scraped sites.
33 34 35 |
# File 'lib/pageflow/chart/configuration.rb', line 33 def supported_hosts @supported_hosts end |
#use_custom_theme ⇒ Boolean
If enabled, set has_custom_theme to true for new scraped sites. This causes styles from pageflow/chart/custom.scss to be injected into their iframe on page creation.
This used to be the default, but is disabled in favor of custom Datawrapper themes now.
43 44 45 |
# File 'lib/pageflow/chart/configuration.rb', line 43 def use_custom_theme @use_custom_theme end |
Instance Method Details
#paperclip_options(options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
74 75 76 77 78 |
# File 'lib/pageflow/chart/configuration.rb', line 74 def ( = {}) Pageflow.config. .deep_merge(()) .deep_merge() end |