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_theme` to `true` for new scraped sites.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #paperclip_options(options = {}) ⇒ Object private
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/pageflow/chart/configuration.rb', line 56 def initialize @scraper_options = { head_script_blacklist: [/piwik/], body_script_blacklist: [/piwik/], inline_script_blacklist: [/piwik/], selector_blacklist: ['body .noscript'] } @paperclip_s3_default_options = {} @paperclip_base_path = ':pageflow_s3_root' @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.
54 55 56 |
# File 'lib/pageflow/chart/configuration.rb', line 54 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.
29 30 31 |
# File 'lib/pageflow/chart/configuration.rb', line 29 def @paperclip_s3_default_options 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 @scraper_options end |
#supported_hosts ⇒ Array<String> (readonly)
White list of URL prefixes (including protocol) of scraped sites.
34 35 36 |
# File 'lib/pageflow/chart/configuration.rb', line 34 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.
44 45 46 |
# File 'lib/pageflow/chart/configuration.rb', line 44 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.
76 77 78 79 80 |
# File 'lib/pageflow/chart/configuration.rb', line 76 def ( = {}) Pageflow.config. .deep_merge(()) .deep_merge() end |