Class: Pageflow::Configuration
- Inherits:
-
Object
- Object
- Pageflow::Configuration
- Defined in:
- lib/pageflow/configuration.rb,
lib/pageflow/configuration/defaults.rb,
lib/pageflow/configuration/permissions.rb
Overview
Options to be defined in the pageflow initializer of the main app.
Defined Under Namespace
Modules: Defaults Classes: ConfigView, FeatureLevelConfiguration, Permissions
Instance Attribute Summary collapse
-
#account_admin_menu_options ⇒ Object
Options hash for account admin menu.
-
#additional_public_entry_headers ⇒ AdditionalHeaders
readonly
Provide additional response headers for published entries.
-
#admin_attributes_table_rows ⇒ Admin::AttributesTableRows
readonly
Insert additional rows into admin attributes tables.
-
#admin_form_inputs ⇒ Admin::FormInputs
readonly
Add custom form fields to admin forms.
-
#admin_resource_tabs ⇒ Admin::Tabs
readonly
Used by Pageflow extensions to provide new tabs to be displayed in the admin.
-
#after_entry_create_redirect_to ⇒ Object
Where to redirect after creating an entry.
-
#allow_multiaccount_users ⇒ Object
Allow one user to be member of multiple accounts.
-
#authorize_user_deletion ⇒ Object
Whether a user can be deleted.
-
#available_file_licenses ⇒ Object
Array of values that the
licenseattribute on files can take. -
#available_locales ⇒ Object
Array of locales which can be chosen as interface language by a user.
-
#available_public_locales ⇒ Object
Array of locales which can be chosen as interface language for an entry.
-
#available_share_providers ⇒ Object
Array of sharing providers which can be configured on site level.
-
#available_text_track_kinds ⇒ Object
Array of values that the
kindattribute on text tracks can take. -
#confirm_encoding_jobs ⇒ Object
Submit video/audio encoding jobs only after the user has explicitly confirmed in the editor.
-
#css_rendered_thumbnail_styles ⇒ Object
Names of Paperclip styles that shall be rendered into entry specific stylesheets.
-
#cutoff_modes ⇒ CutoffModes
readonly
Define strategies to determine whether entries should be cut off (e.g., to preview paywalled premium content).
-
#default_author_meta_tag ⇒ Object
Returns the value of attribute default_author_meta_tag.
-
#default_entry_type ⇒ #call
Either a lambda or an object with a
callmethod taking an Account as paramater and returing the entry type that shall be selected by default when creating a new entry. -
#default_keywords_meta_tag ⇒ Object
Meta tag defaults.
-
#default_published_until_duration_in_months ⇒ Object
Controls default value of "published until" date field in editor publish entry view.
-
#default_publisher_meta_tag ⇒ Object
Returns the value of attribute default_publisher_meta_tag.
-
#default_share_providers ⇒ Object
Share provider defaults.
-
#edit_lock_polling_interval ⇒ number
Defines the editor lock polling interval.
-
#editor_route_constraint ⇒ Object
A constraint used by the pageflow engine to restrict access to the editor related HTTP end points.
-
#editor_routing_constraint ⇒ Object
Either a lambda or an object with a
match?method, to restrict access to the editor routes defined by Pageflow. -
#encryption_options ⇒ Object
Contains key and iv used to encrypt string used by SymmetricEncryption.
-
#entry_embed_url_options ⇒ Object
Either a lambda or an object with a
callmethod taking a Site as paramater and returing a hash of options used to construct the embed url of a published entry. -
#entry_structured_data_types ⇒ EntryStructuredDataTypes
readonly
Used to register different structured data types for entries.
-
#entry_translator_url ⇒ Object
URL to a form that is used to translate an entry via an external service.
-
#entry_types ⇒ EntryTypes
readonly
Register new types of entries.
-
#features ⇒ Object
readonly
Extend the configuration based on feature flags set for accounts or entries.
-
#file_importers ⇒ fileImporters
readonly
Used to register new file importers, to be used for importing files.
-
#file_types ⇒ FileTypes
readonly
List of FileType instances.
-
#help_entries ⇒ HelpEntries
readonly
Used to add new sections to the help dialog displayed in the editor.
-
#hooks ⇒ Object
readonly
Subscribe to hooks in order to be notified of events.
-
#mailer_sender ⇒ Object
The email address to use as from header in invitation mails to new users.
-
#news ⇒ #item
News collection to add items to.
-
#oembed_providers ⇒ OembedProviders
readonly
Registry for oEmbed providers that can be used to resolve URLs.
-
#paperclip_attachments_version ⇒ Object
String to interpolate into paths of files generated by paperclip preprocessors.
-
#paperclip_direct_upload_options ⇒ Object
Upload options provided to direct upload form.
-
#paperclip_s3_default_options ⇒ Object
Default options for paperclip attachments which are supposed to use s3 storage.
-
#paperclip_s3_root ⇒ Object
Root folder in S3 bucket to store files in.
-
#permissions ⇒ Object
readonly
Sublayer for permissions related config.
-
#public_entry_cache_control_header ⇒ String
Cache-Control header to set for published entries that have been published without a password.
-
#public_entry_redirect ⇒ Object
Either a lambda or an object with a
callmethod taking an PublishedEntry record and an ActionDispatch::Request object and returningnilor a path to redirect to. -
#public_entry_request_scope ⇒ Object
Either a lambda or an object with a
callmethod taking two parameters: AnActiveRecordscope ofPageflow::Entryrecords and anActionDispatch::Requestobject. -
#public_entry_url_options ⇒ Object
Either a hash, a lambda or an object with a
callmethod returing a hash of options used to construct the url of a published entry. -
#public_https_mode ⇒ Object
How to handle https requests for URLs which will have assets in the page.
-
#quotas ⇒ Object
Limit the use of certain resources.
-
#revision_components ⇒ RevisionComponents
readonly
Used to register components whose current state must be persisted as part of a revision.
-
#site_request_scope ⇒ Object
Either a lambda or an object with a
callmethod taking two parameters: AnActiveRecordscope of Site records and an ActionDispatch::Request object. -
#site_url_options ⇒ Object
Either a lambda or an object with a
callmethod taking a Site as paramater and returing a hash of options used to construct the url of a site. -
#themes ⇒ Themes
readonly
Additional themes can be registered to use custom css.
-
#thumbnail_styles ⇒ Object
Paperclip style definitions of thumbnails used by Pageflow.
-
#transform_theme_customization_files ⇒ Object
Either a lambda or an object with a
callmethod taking a hash of theme customization files and an EntryAtRevision and returning a transformed hash of files. -
#transform_theme_customization_overrides ⇒ Object
Either a lambda or an object with a
callmethod taking a hash of theme option overrides and an EntryAtRevision and returning a transformed hash of overrides. -
#widget_types ⇒ WidgetTypes
readonly
Used to register new types of widgets to be displayed in entries.
-
#zencoder_options ⇒ Object
Refer to the pageflow initializer template for a list of supported options.
Instance Method Summary collapse
- #confirm_encoding_jobs?(file) ⇒ Boolean private
- #enable_all_features ⇒ Object private
- #enable_features(names) ⇒ Object private
-
#for_entry_type(type) {|entry_type_config| ... } ⇒ Object
Scope configuration to entries of a certain entry type or access entry type specific configuration.
- #get_entry_type_config(type) ⇒ Object private
-
#initialize(target_type_name = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #lint! ⇒ Object private
-
#page_types ⇒ PageTypes
Provide backwards compatibility as long as paged entry type has not been extracted completely.
-
#paperclip_filesystem_root ⇒ Object
deprecated
Deprecated.
Pageflow now supports direct uploads to S3 via signed post requests.
- #paperclip_filesystem_root=(_val) ⇒ Object
-
#plugin(plugin) ⇒ Object
Activate a plugin.
- #public_entry_url_options_for(entry) ⇒ Object private
-
#register_page_type(page_type) ⇒ Object
deprecated
Deprecated.
Use
config.page_types.registerinstead. - #site_url_options_for(site) ⇒ Object private
Constructor Details
#initialize(target_type_name = nil) ⇒ Configuration
Returns a new instance of Configuration.
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 |
# File 'lib/pageflow/configuration.rb', line 503 def initialize(target_type_name = nil) @target_type_name = target_type_name = 'v1' @paperclip_s3_root = 'main' = Defaults::PAPERCLIP_S3_DEFAULT_OPTIONS.dup = lambda { || max_upload_size = 4_294_967_296 # max file size in bytes presigned_post_config = .s3_bucket .presigned_post(key: .path, success_action_status: '201', acl: 'public-read', content_length_range: 0..max_upload_size) { url: presigned_post_config.url, fields: presigned_post_config.fields } } = {} = {} @mailer_sender = '[email protected]' @features = Features.new @hooks = Hooks.new @quotas = Quotas.new @themes = Themes.new @entry_types = EntryTypes.new @entry_type_configs = {} @entry_type_configure_blocks = Hash.new { |h, k| h[k] = [] } @file_types = FileTypes.new = WidgetTypes.new @file_importers = FileImporters.new @entry_structured_data_types = EntryStructuredDataTypes.new @entry_structured_data_types.register(:article, lambda do |_entry| { '@type' => 'Article', articleSection: 'longform' } end, default: true) @help_entries = HelpEntries.new @revision_components = RevisionComponents.new @thumbnail_styles = Defaults::THUMBNAIL_STYLES.dup @css_rendered_thumbnail_styles = Defaults::CSS_RENDERED_THUMBNAIL_STYLES.dup @site_request_scope = CnameSiteRequestScope.new @public_entry_request_scope = ->(entries, _request) { entries } @public_entry_redirect = ->(_entry, _request) {} @additional_public_entry_headers = AdditionalHeaders.new = {protocol: 'https'} @cutoff_modes = CutoffModes.new @transform_theme_customization_overrides = ->(overrides, _entry) { overrides } @transform_theme_customization_files = ->(files, _entry) { files } @after_entry_create_redirect_to = :admin @confirm_encoding_jobs = false @default_published_until_duration_in_months = 12 @admin_resource_tabs = Pageflow::Admin::Tabs.new @admin_form_inputs = Pageflow::Admin::FormInputs.new @admin_attributes_table_rows = Pageflow::Admin::AttributesTableRows.new @available_locales = [:en, :de] @available_public_locales = PublicI18n.available_locales @available_share_providers = [:email, :facebook, :linked_in, :bluesky, :threads, :twitter, :telegram, :whats_app] @public_https_mode = :prevent = 'pageflow, multimedia, reportage' = 'Pageflow' = 'Pageflow' @default_share_providers = @available_share_providers = ->(_user) { true } @available_file_licenses = [ :cc_by_4, :cc_by_sa_4, :cc_by_nc_4, :cc_by_nc_sa_4, :cc_by_nd_4, :cc_by_nc_nd_4 ] @available_text_track_kinds = [:captions, :subtitles, :descriptions] @allow_multiaccount_users = true = {} = Permissions.new @edit_lock_polling_interval = 15.seconds = .new .register( :bluesky, endpoint: 'https://embed.bsky.app/oembed', url_patterns: ['https://bsky.app/profile/*/post/*'] ) end |
Instance Attribute Details
#account_admin_menu_options ⇒ Object
Options hash for account admin menu. Options from config precede defaults.
463 464 465 |
# File 'lib/pageflow/configuration.rb', line 463 def end |
#additional_public_entry_headers ⇒ AdditionalHeaders (readonly)
Provide additional response headers for published entries.
241 242 243 |
# File 'lib/pageflow/configuration.rb', line 241 def additional_public_entry_headers @additional_public_entry_headers end |
#admin_attributes_table_rows ⇒ Admin::AttributesTableRows (readonly)
Insert additional rows into admin attributes tables.
387 388 389 |
# File 'lib/pageflow/configuration.rb', line 387 def admin_attributes_table_rows @admin_attributes_table_rows end |
#admin_form_inputs ⇒ Admin::FormInputs (readonly)
Add custom form fields to admin forms.
369 370 371 |
# File 'lib/pageflow/configuration.rb', line 369 def admin_form_inputs @admin_form_inputs end |
#admin_resource_tabs ⇒ Admin::Tabs (readonly)
Used by Pageflow extensions to provide new tabs to be displayed in the admin.
359 360 361 |
# File 'lib/pageflow/configuration.rb', line 359 def admin_resource_tabs @admin_resource_tabs end |
#after_entry_create_redirect_to ⇒ Object
Where to redirect after creating an entry.
Possible values:
:admin: Go to entry admin page (default)
:editor: Open created entry in editor
337 338 339 |
# File 'lib/pageflow/configuration.rb', line 337 def after_entry_create_redirect_to @after_entry_create_redirect_to end |
#allow_multiaccount_users ⇒ Object
Allow one user to be member of multiple accounts. Defaults to true.
458 459 460 |
# File 'lib/pageflow/configuration.rb', line 458 def allow_multiaccount_users @allow_multiaccount_users end |
#authorize_user_deletion ⇒ Object
Whether a user can be deleted.
446 447 448 |
# File 'lib/pageflow/configuration.rb', line 446 def end |
#available_file_licenses ⇒ Object
Array of values that the license attribute on files can take.
449 450 451 |
# File 'lib/pageflow/configuration.rb', line 449 def available_file_licenses @available_file_licenses end |
#available_locales ⇒ Object
Array of locales which can be chosen as interface language by a
user. Defaults to [:en, :de].
392 393 394 |
# File 'lib/pageflow/configuration.rb', line 392 def available_locales @available_locales end |
#available_public_locales ⇒ Object
Array of locales which can be chosen as interface language for
an entry. Defaults to the locales supported by the
pageflow-public-i18n gem.
398 399 400 |
# File 'lib/pageflow/configuration.rb', line 398 def available_public_locales @available_public_locales end |
#available_share_providers ⇒ Object
Array of sharing providers which can be configured on site level.
Defaults to [:facebook, :twitter, :linked_in, :whats_app, :telegram, :email].
403 404 405 |
# File 'lib/pageflow/configuration.rb', line 403 def available_share_providers @available_share_providers end |
#available_text_track_kinds ⇒ Object
Array of values that the kind attribute on text tracks can
take. Defaults to [:captions, :subtitles, :descriptions].
453 454 455 |
# File 'lib/pageflow/configuration.rb', line 453 def available_text_track_kinds @available_text_track_kinds end |
#confirm_encoding_jobs ⇒ Object
Submit video/audio encoding jobs only after the user has explicitly confirmed in the editor. Can either be set to a boolean or a lambda that is passed the file and returns a boolean. Defaults to false.
343 344 345 |
# File 'lib/pageflow/configuration.rb', line 343 def confirm_encoding_jobs @confirm_encoding_jobs end |
#css_rendered_thumbnail_styles ⇒ Object
Names of Paperclip styles that shall be rendered into entry specific stylesheets.
157 158 159 |
# File 'lib/pageflow/configuration.rb', line 157 def css_rendered_thumbnail_styles @css_rendered_thumbnail_styles end |
#cutoff_modes ⇒ CutoffModes (readonly)
Define strategies to determine whether entries should be cut off (e.g., to preview paywalled premium content).
317 318 319 |
# File 'lib/pageflow/configuration.rb', line 317 def cutoff_modes @cutoff_modes end |
#default_author_meta_tag ⇒ Object
Returns the value of attribute default_author_meta_tag.
424 425 426 |
# File 'lib/pageflow/configuration.rb', line 424 def end |
#default_entry_type ⇒ #call
Either a lambda or an object with a call method taking an
Account as paramater and returing the entry type that shall be
selected by default when creating a new entry.
103 104 105 |
# File 'lib/pageflow/configuration.rb', line 103 def default_entry_type @default_entry_type end |
#default_keywords_meta_tag ⇒ Object
Meta tag defaults.
These defaults will be included in the page
unless overriden by the Entry. If you set these to nil or "" the meta tag won't be included.
423 424 425 |
# File 'lib/pageflow/configuration.rb', line 423 def end |
#default_published_until_duration_in_months ⇒ Object
Controls default value of "published until" date field in editor publish entry view.
349 350 351 |
# File 'lib/pageflow/configuration.rb', line 349 def default_published_until_duration_in_months @default_published_until_duration_in_months end |
#default_publisher_meta_tag ⇒ Object
Returns the value of attribute default_publisher_meta_tag.
424 425 426 |
# File 'lib/pageflow/configuration.rb', line 424 def end |
#default_share_providers ⇒ Object
Share provider defaults.
Default share providers for new sites.
Must be a subset or equal to available_share_providers
431 432 433 |
# File 'lib/pageflow/configuration.rb', line 431 def default_share_providers @default_share_providers end |
#edit_lock_polling_interval ⇒ number
Defines the editor lock polling interval.
472 473 474 |
# File 'lib/pageflow/configuration.rb', line 472 def edit_lock_polling_interval @edit_lock_polling_interval end |
#editor_route_constraint ⇒ Object
A constraint used by the pageflow engine to restrict access to the editor related HTTP end points. This can be used to ensure the editor is only accessable via a certain host when different CNAMES are used to access the public end points of pageflow.
44 45 46 |
# File 'lib/pageflow/configuration.rb', line 44 def editor_route_constraint @editor_route_constraint end |
#editor_routing_constraint ⇒ Object
Either a lambda or an object with a match? method, to restrict
access to the editor routes defined by Pageflow.
This can be used if published entries shall be available under different CNAMES but the admin and the editor shall only be accessible via one official url.
165 166 167 |
# File 'lib/pageflow/configuration.rb', line 165 def editor_routing_constraint @editor_routing_constraint end |
#encryption_options ⇒ Object
Contains key and iv used to encrypt string used by SymmetricEncryption
38 39 40 |
# File 'lib/pageflow/configuration.rb', line 38 def end |
#entry_embed_url_options ⇒ Object
Either a lambda or an object with a call method taking a
Site as paramater and returing a hash of options used to
construct the embed url of a published entry.
300 301 302 |
# File 'lib/pageflow/configuration.rb', line 300 def end |
#entry_structured_data_types ⇒ EntryStructuredDataTypes (readonly)
Used to register different structured data types for entries.
135 136 137 |
# File 'lib/pageflow/configuration.rb', line 135 def entry_structured_data_types @entry_structured_data_types end |
#entry_translator_url ⇒ Object
URL to a form that is used to translate an entry via an external service.
488 489 490 |
# File 'lib/pageflow/configuration.rb', line 488 def entry_translator_url @entry_translator_url end |
#entry_types ⇒ EntryTypes (readonly)
Register new types of entries.
96 97 98 |
# File 'lib/pageflow/configuration.rb', line 96 def entry_types @entry_types end |
#features ⇒ Object (readonly)
Extend the configuration based on feature flags set for accounts or entries.
Make a widget type only available if a feature flag is set on the entry or its account
config.features.register('some_special_widget_type' do |config
config..register(Pageflow::SomeSpecial.)
end
64 65 66 |
# File 'lib/pageflow/configuration.rb', line 64 def features @features end |
#file_importers ⇒ fileImporters (readonly)
Used to register new file importers, to be used for importing files
121 122 123 |
# File 'lib/pageflow/configuration.rb', line 121 def file_importers @file_importers end |
#file_types ⇒ FileTypes (readonly)
List of FileType instances. Can be registered globally or provided by page types.
108 109 110 |
# File 'lib/pageflow/configuration.rb', line 108 def file_types @file_types end |
#help_entries ⇒ HelpEntries (readonly)
Used to add new sections to the help dialog displayed in the editor.
148 149 150 |
# File 'lib/pageflow/configuration.rb', line 148 def help_entries @help_entries end |
#hooks ⇒ Object (readonly)
Subscribe to hooks in order to be notified of events. Any object with a call method can be a subscriber
Example:
config.hooks.subscribe(:submit_file, -> { do_something })
73 74 75 |
# File 'lib/pageflow/configuration.rb', line 73 def hooks @hooks end |
#mailer_sender ⇒ Object
The email address to use as from header in invitation mails to new users
48 49 50 |
# File 'lib/pageflow/configuration.rb', line 48 def mailer_sender @mailer_sender end |
#news ⇒ #item
News collection to add items to. Can be used to integrate Pageflow with Krant (see https://github.com/codevise/krant).
478 479 480 |
# File 'lib/pageflow/configuration.rb', line 478 def news @news end |
#oembed_providers ⇒ OembedProviders (readonly)
Registry for oEmbed providers that can be used to resolve URLs.
501 502 503 |
# File 'lib/pageflow/configuration.rb', line 501 def end |
#paperclip_attachments_version ⇒ Object
String to interpolate into paths of files generated by paperclip preprocessors. This allows to refresh cdn caches after reprocessing attachments.
11 12 13 |
# File 'lib/pageflow/configuration.rb', line 11 def end |
#paperclip_direct_upload_options ⇒ Object
Upload options provided to direct upload form. Defaults to S3 storage options. returns a hash with keys:
- url: The URL to use as the action of the form
- fields: A hash of fields that will be included in the direct upload form. This hash should include the signed POST policy, the access key ID and security token (if present), etc. These fields will be included as input elements of type 'hidden' on the form
@since 14.0
30 31 32 |
# File 'lib/pageflow/configuration.rb', line 30 def end |
#paperclip_s3_default_options ⇒ Object
Default options for paperclip attachments which are supposed to use s3 storage.
6 7 8 |
# File 'lib/pageflow/configuration.rb', line 6 def end |
#paperclip_s3_root ⇒ Object
Root folder in S3 bucket to store files in. Can be used to separate files of multiple development instances in a shared development S3 bucket.
18 19 20 |
# File 'lib/pageflow/configuration.rb', line 18 def paperclip_s3_root @paperclip_s3_root end |
#permissions ⇒ Object (readonly)
Sublayer for permissions related config.
467 468 469 |
# File 'lib/pageflow/configuration.rb', line 467 def end |
#public_entry_cache_control_header ⇒ String
Cache-Control header to set for published entries that have been published without a password. For password protected entries, cache control is always set to private to prevent caching authenticated responses in public caches like CDNs and serving them to unauthenticated users.
Can be wrapped in a features.register block to use different
caching strategies for different entries or accounts.
223 224 225 |
# File 'lib/pageflow/configuration.rb', line 223 def public_entry_cache_control_header @public_entry_cache_control_header end |
#public_entry_redirect ⇒ Object
Either a lambda or an object with a call method taking an
PublishedEntry record and an ActionDispatch::Request object
and returning nil or a path to redirect to. Can be used in
conjuction with PrimaryDomainEntryRedirect to make sure
entries are accessed via their account's configured cname.
210 211 212 |
# File 'lib/pageflow/configuration.rb', line 210 def public_entry_redirect @public_entry_redirect end |
#public_entry_request_scope ⇒ Object
Either a lambda or an object with a call method taking two
parameters: An ActiveRecord scope of Pageflow::Entry records
and an ActionDispatch::Request object. Has to return the scope
in which to find entries.
Used by all public actions that display entries to restrict the available entries by hostname or other request attributes.
Use #public_entry_url_options to make sure urls of published entries conform twith the restrictions.
Example:
# Only make entries of one account available under <account.name>.example.com
config.public_entry_request_scope = lambda do |entries, request|
entries.includes(:account).where(pageflow_accounts: {name: request.subdomain})
end
201 202 203 |
# File 'lib/pageflow/configuration.rb', line 201 def public_entry_request_scope @public_entry_request_scope end |
#public_entry_url_options ⇒ Object
Either a hash, a lambda or an object with a call method
returing a hash of options used to construct the url of a
published entry.
Can be used to change the host of the url under which entries are available.
If site_url_options is blank, the lambda receives a Site as parameter. This case is only supported for legacy reasons. Prefer setting site_url_options instead.
Example:
config. = lambda do |site|
{host: "#{site.account.name}.example.com"}
end
If both site_url_options and public_entry_url_options are present, public_entry_url_options is called exclusively to construct url options for public entries. The lambda then receives a PublishedEntry to allow for entry specific url options.
Example:
config. = lambda do |site|
{host: "#{site.account.name}.example.com"}
end
config. = lambda do |entry|
{
host: "#{entry.site.account.name}.example.com",
some_entry_specific_param: entry.id
}
end
295 296 297 |
# File 'lib/pageflow/configuration.rb', line 295 def end |
#public_https_mode ⇒ Object
How to handle https requests for URLs which will have assets in the page. If you wish to serve all assets over http and prevent mixed-content warnings, you can force a redirect to http. The inverse is also true: you can force a redirect to https for all http requests.
416 417 418 |
# File 'lib/pageflow/configuration.rb', line 416 def public_https_mode @public_https_mode end |
#quotas ⇒ Object
Limit the use of certain resources. Any object implementing the interface of Pageflow::Quota can be registered.
Example:
config.quotas.register(:users, UserQuota)
82 83 84 |
# File 'lib/pageflow/configuration.rb', line 82 def quotas @quotas end |
#revision_components ⇒ RevisionComponents (readonly)
Used to register components whose current state must be persisted as part of a revision.
113 114 115 |
# File 'lib/pageflow/configuration.rb', line 113 def revision_components @revision_components end |
#site_request_scope ⇒ Object
Either a lambda or an object with a call method taking two
parameters: An ActiveRecord scope of Site records
and an ActionDispatch::Request object. Has to return the scope
in which to find sites.
Defaults to Pageflow::CnameSiteRequestScope which finds sites based on the request subdomain. Can be used to alter the logic of finding a site whose home_url to redirect to when visiting the public root path.
Example:
config.site_request_scope = lambda do |sites, request|
sites.where(id: Pageflow::Account.find_by_name!(request.subdomain).default_site_id)
end
182 183 184 |
# File 'lib/pageflow/configuration.rb', line 182 def site_request_scope @site_request_scope end |
#site_url_options ⇒ Object
Either a lambda or an object with a call method taking a
Site as paramater and returing a hash of options used to
construct the url of a site.
Can be used to change the host of the url under which entries and feeds are available.
If the option is not set, public_entry_url_options is used as a fallback.
Example:
config. = lambda do |site|
{host: "#{site.account.name}.example.com"}
end
258 259 260 |
# File 'lib/pageflow/configuration.rb', line 258 def end |
#themes ⇒ Themes (readonly)
Additional themes can be registered to use custom css.
Example:
config.themes.register(:custom)
91 92 93 |
# File 'lib/pageflow/configuration.rb', line 91 def themes @themes end |
#thumbnail_styles ⇒ Object
Paperclip style definitions of thumbnails used by Pageflow.
152 153 154 |
# File 'lib/pageflow/configuration.rb', line 152 def thumbnail_styles @thumbnail_styles end |
#transform_theme_customization_files ⇒ Object
Either a lambda or an object with a call method taking a hash
of theme customization files and an EntryAtRevision and
returning a transformed hash of files. Can be used to filter
files based on feature flags and other entry or account traits.
329 330 331 |
# File 'lib/pageflow/configuration.rb', line 329 def transform_theme_customization_files @transform_theme_customization_files end |
#transform_theme_customization_overrides ⇒ Object
Either a lambda or an object with a call method taking a hash
of theme option overrides and an EntryAtRevision and returning
a transformed hash of overrides. Can be used to filter overrides
based on feature flags and other entry or account traits.
323 324 325 |
# File 'lib/pageflow/configuration.rb', line 323 def transform_theme_customization_overrides @transform_theme_customization_overrides end |
#widget_types ⇒ WidgetTypes (readonly)
Used to register new types of widgets to be displayed in entries.
117 118 119 |
# File 'lib/pageflow/configuration.rb', line 117 def end |
#zencoder_options ⇒ Object
Refer to the pageflow initializer template for a list of supported options.
34 35 36 |
# File 'lib/pageflow/configuration.rb', line 34 def end |
Instance Method Details
#confirm_encoding_jobs?(file) ⇒ Boolean
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.
679 680 681 682 683 684 685 |
# File 'lib/pageflow/configuration.rb', line 679 def confirm_encoding_jobs?(file) if confirm_encoding_jobs.respond_to?(:call) confirm_encoding_jobs.call(file) else confirm_encoding_jobs end end |
#enable_all_features ⇒ 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.
715 716 717 |
# File 'lib/pageflow/configuration.rb', line 715 def enable_all_features features.enable_all(FeatureLevelConfiguration.new(self)) end |
#enable_features(names) ⇒ 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.
710 711 712 |
# File 'lib/pageflow/configuration.rb', line 710 def enable_features(names) features.enable(names, FeatureLevelConfiguration.new(self)) end |
#for_entry_type(type) {|entry_type_config| ... } ⇒ Object
Scope configuration to entries of a certain entry type or access
entry type specific configuration. When building a configuration
object for an entry, the passed block is only evaluated when
types match. When building Pageflow.config, all
for_entry_type blocks are evaluated.
662 663 664 665 666 |
# File 'lib/pageflow/configuration.rb', line 662 def for_entry_type(type) return if @target_type_name && @target_type_name != type.name yield get_entry_type_config(type) end |
#get_entry_type_config(type) ⇒ 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.
669 670 671 |
# File 'lib/pageflow/configuration.rb', line 669 def get_entry_type_config(type) @entry_type_configs[type.name] ||= type.configuration.new(self, type) end |
#lint! ⇒ 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.
674 675 676 |
# File 'lib/pageflow/configuration.rb', line 674 def lint! @features.lint! end |
#page_types ⇒ PageTypes
Provide backwards compatibility as long as paged entry type has not been extracted completely. Prefer accessing entry type specific config via #for_entry_type for new code.
622 623 624 |
# File 'lib/pageflow/configuration.rb', line 622 def page_types get_entry_type_config(PageflowPaged.entry_type).page_types end |
#paperclip_filesystem_root ⇒ Object
Pageflow now supports direct uploads to S3 via signed post requests.
Please change your forms accordingly.
637 638 639 640 641 |
# File 'lib/pageflow/configuration.rb', line 637 def paperclip_filesystem_root Pageflow::Deprecation.warn( 'Pageflow::Configuration#paperclip_filesystem_root is deprecated.' ) end |
#paperclip_filesystem_root=(_val) ⇒ Object
643 644 645 646 647 |
# File 'lib/pageflow/configuration.rb', line 643 def paperclip_filesystem_root=(_val) Pageflow::Deprecation.warn( 'Pageflow::Configuration#paperclip_filesystem_root is deprecated.' ) end |
#plugin(plugin) ⇒ Object
Activate a plugin.
612 613 614 |
# File 'lib/pageflow/configuration.rb', line 612 def plugin(plugin) plugin.configure(self) end |
#public_entry_url_options_for(entry) ⇒ 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.
697 698 699 700 701 702 703 704 705 706 707 |
# File 'lib/pageflow/configuration.rb', line 697 def (entry) return (entry.site) unless = if .respond_to?(:call) .call( ? entry : entry.site) else end end |
#register_page_type(page_type) ⇒ Object
Use config.page_types.register instead.
627 628 629 630 631 632 633 |
# File 'lib/pageflow/configuration.rb', line 627 def register_page_type(page_type) Pageflow::Deprecation.warn( 'Pageflow::Configuration#register_page_type is deprecated. ' \ 'Use config.page_types.register instead.' ) page_types.register(page_type) end |
#site_url_options_for(site) ⇒ 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.
688 689 690 691 692 693 694 |
# File 'lib/pageflow/configuration.rb', line 688 def (site) = || || Pageflow::SitesHelper::DEFAULT_SITE_URL_OPTIONS .respond_to?(:call) ? .call(site) : end |