Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-alphabetize app configuration prefs #3556

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 63 additions & 65 deletions core/lib/spree/app_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

module Spree
class AppConfiguration < Preferences::Configuration
# Alphabetized to more easily lookup particular preferences
# Preferences (alphabetized to more easily lookup particular preferences)

# @!attribute [rw] address_requires_state
# @return [Boolean] should state/state_name be required (default: +true+)
Expand All @@ -42,6 +42,12 @@ class AppConfiguration < Preferences::Configuration
# @return [Integer] Number of variants to display in admin (default: +20+)
preference :admin_variants_per_page, :integer, default: 20

# @!attribute [rw] admin_vat_country_iso
# Set this if you want to enter prices in the backend including value added tax.
# @return [String, nil] Two-letter ISO code of that {Spree::Country} for which
# prices are entered in the backend (default: nil)
preference :admin_vat_country_iso, :string, default: nil

# @!attribute [rw] allow_checkout_on_gateway_error
# @return [Boolean] Allow checkout to complete after a failed payment (default: +false+)
preference :allow_checkout_on_gateway_error, :boolean, default: false
Expand Down Expand Up @@ -78,6 +84,14 @@ class AppConfiguration < Preferences::Configuration
# @return [Boolean] Automatically capture the credit card (as opposed to just authorize and capture later) (default: +false+)
preference :auto_capture_exchanges, :boolean, default: false

# @!attribute [rw] automatic_default_address
# The default value of true preserves existing backwards compatible feature of
# treating the most recently used address in checkout as the user's default address.
# Setting to false means that the user should manage their own default via some
# custom UI that uses AddressBookController.
# @return [Boolean] Whether use of an address in checkout marks it as user's default
preference :automatic_default_address, :boolean, default: true

# @!attribute [rw] binary_inventory_cache
# Only invalidate product caches when they change from in stock to out of
# stock. By default, caches are invalidated on any change of inventory
Expand All @@ -88,20 +102,9 @@ class AppConfiguration < Preferences::Configuration
# @return [Boolean]
preference :binary_inventory_cache, :boolean, default: false

# @!attribute [rw] completable_order_created_cutoff
# @return [Integer] the number of days to look back for created orders which get returned to the user as last completed
preference :completable_order_created_cutoff_days, :integer, default: nil

# @!attribute [rw] completable_order_created_cutoff
# @return [Integer] the number of days to look back for updated orders which get returned to the user as last completed
preference :completable_order_updated_cutoff_days, :integer, default: nil

# @!attribute [rw] inventory_cache_threshold
# Only invalidate product caches when the count on hand for a stock item
# falls below or rises about the inventory_cache_threshold. When undefined, the
# product caches will be invalidated anytime the count on hand is changed.
# @return [Integer]
preference :inventory_cache_threshold, :integer
# @!attribute [rw] can_restrict_stock_management
# @return [Boolean] Indicates if stock management can be restricted by location
preference :can_restrict_stock_management, :boolean, default: false

# @!attribute [rw] checkout_zone
# @return [String] Name of a {Spree::Zone}, which limits available countries to those included in that zone. (default: +nil+)
Expand All @@ -111,17 +114,26 @@ class AppConfiguration < Preferences::Configuration
# @return [Boolean] Request company field for billing and shipping addresses. (default: +false+)
preference :company, :boolean, default: false

# @!attribute [rw] completable_order_created_cutoff
# @return [Integer] the number of days to look back for created orders which get returned to the user as last completed
preference :completable_order_created_cutoff_days, :integer, default: nil

# @!attribute [rw] completable_order_created_cutoff
# @return [Integer] the number of days to look back for updated orders which get returned to the user as last completed
preference :completable_order_updated_cutoff_days, :integer, default: nil

# @!attribute [rw] credit_to_new_allocation
# @return [Boolean] Creates a new allocation anytime {Spree::StoreCredit#credit} is called
preference :credit_to_new_allocation, :boolean, default: false

# @!attribute [rw] currency
# Currency to use by default when not defined on the site (default: +"USD"+)
# @return [String] ISO 4217 Three letter currency code
preference :currency, :string, default: "USD"

# @!attribute [rw] raise_with_invalid_currency
# Whether to raise an exception if trying to set a line item currency
# different from the order currency. When false a validation error
# is added to the instance instead.
# @return [Boolean] (default: +true+)
preference :raise_with_invalid_currency, :boolean, default: true
# @!attribute [rw] customer_returns_per_page
# @return [Integer] Customer returns to show per-page in the admin (default: +15+)
preference :customer_returns_per_page, :integer, default: 15

# @!attribute [rw] default_country_id
# @deprecated Use the default country ISO preference instead
Expand All @@ -133,17 +145,18 @@ class AppConfiguration < Preferences::Configuration
# @return [String] Two-letter ISO code of a {Spree::Country} to assumed as the country of an unidentified customer (default: "US")
preference :default_country_iso, :string, default: 'US'

# @!attribute [rw] admin_vat_country_iso
# Set this if you want to enter prices in the backend including value added tax.
# @return [String, nil] Two-letter ISO code of that {Spree::Country} for which
# prices are entered in the backend (default: nil)
preference :admin_vat_country_iso, :string, default: nil

# @!attribute [rw] generate_api_key_for_all_roles
# @return [Boolean] Allow generating api key automatically for user
# at role_user creation for all roles. (default: +false+)
preference :generate_api_key_for_all_roles, :boolean, default: false

# @!attribute [rw] inventory_cache_threshold
# Only invalidate product caches when the count on hand for a stock item
# falls below or rises about the inventory_cache_threshold. When undefined, the
# product caches will be invalidated anytime the count on hand is changed.
# @return [Integer]
preference :inventory_cache_threshold, :integer

# @!attribute [rw] layout
# @return [String] template to use for layout on the frontend (default: +"spree/layouts/spree_application"+)
preference :layout, :string, default: 'spree/layouts/spree_application'
Expand All @@ -152,6 +165,14 @@ class AppConfiguration < Preferences::Configuration
# @return [String] URL of logo used on frontend (default: +'logo/solidus.svg'+)
preference :logo, :string, default: 'logo/solidus.svg'

# @!attribute [rw] mails_from
# @return [String] Email address used as +From:+ field in transactional emails.
preference :mails_from, :string, default: 'spree@example.com'

# @!attribute [rw] max_level_in_taxons_menu
# @return [Integer] maximum nesting level in taxons menu (default: +1+)
preference :max_level_in_taxons_menu, :integer, default: 1

# @!attribute [rw] order_bill_address_used
# @return [Boolean] Use the order's bill address, as opposed to storing
# bill addresses on payment sources. (default: +true+)
Expand All @@ -161,10 +182,6 @@ class AppConfiguration < Preferences::Configuration
# @return [Integer] the number of days to look back for fully-shipped/cancelled orders in order to charge for them
preference :order_capturing_time_window, :integer, default: 14

# @!attribute [rw] max_level_in_taxons_menu
# @return [Integer] maximum nesting level in taxons menu (default: +1+)
preference :max_level_in_taxons_menu, :integer, default: 1

# @!attribute [rw] order_mutex_max_age
# @return [Integer] Max age of {Spree::OrderMutex} in seconds (default: 2 minutes)
preference :order_mutex_max_age, :integer, default: 120
Expand All @@ -185,9 +202,12 @@ class AppConfiguration < Preferences::Configuration
# @return [Integer] Promotions to show per-page in the admin (default: +15+)
preference :promotions_per_page, :integer, default: 15

# @!attribute [rw] customer_returns_per_page
# @return [Integer] Customer returns to show per-page in the admin (default: +15+)
preference :customer_returns_per_page, :integer, default: 15
# @!attribute [rw] raise_with_invalid_currency
# Whether to raise an exception if trying to set a line item currency
# different from the order currency. When false a validation error
# is added to the instance instead.
# @return [Boolean] (default: +true+)
preference :raise_with_invalid_currency, :boolean, default: true

# @!attribute [rw] require_master_price
# @return [Boolean] Require a price on the master variant of a product (default: +true+)
Expand All @@ -207,6 +227,10 @@ class AppConfiguration < Preferences::Configuration
# (default: +['admin']+)
preference :roles_for_auto_api_key, :array, default: ['admin']

# @!attribute [rw] send_core_emails
# @return [Boolean] Whether to send transactional emails (default: true)
preference :send_core_emails, :boolean, default: true

# @!attribute [rw] shipping_instructions
# @return [Boolean] Request instructions/info for shipping (default: +false+)
preference :shipping_instructions, :boolean, default: false
Expand All @@ -227,11 +251,6 @@ class AppConfiguration < Preferences::Configuration
# @return [Boolean] Don't escape HTML of product descriptions. (default: +false+)
preference :show_raw_product_description, :boolean, default: false

# @!attribute [rw] use_combined_first_and_last_name_in_address
# @return [Boolean] Use Spree::Address combined first and last name in HTML views and
# API responses. (default: +false+)
preference :use_combined_first_and_last_name_in_address, :boolean, default: false

# @!attribute [rw] tax_using_ship_address
# @return [Boolean] Use the shipping address rather than the billing address to determine tax (default: +true+)
preference :tax_using_ship_address, :boolean, default: true
Expand All @@ -243,33 +262,12 @@ class AppConfiguration < Preferences::Configuration
# @return [] Track on_hand values for variants / products. (default: true)
preference :track_inventory_levels, :boolean, default: true

# Default mail headers settings

# @!attribute [rw] send_core_emails
# @return [Boolean] Whether to send transactional emails (default: true)
preference :send_core_emails, :boolean, default: true

# @!attribute [rw] mails_from
# @return [String] Email address used as +From:+ field in transactional emails.
preference :mails_from, :string, default: 'spree@example.com'

# Store credits configurations

# @!attribute [rw] credit_to_new_allocation
# @return [Boolean] Creates a new allocation anytime {Spree::StoreCredit#credit} is called
preference :credit_to_new_allocation, :boolean, default: false

# @!attribute [rw] automatic_default_address
# The default value of true preserves existing backwards compatible feature of
# treating the most recently used address in checkout as the user's default address.
# Setting to false means that the user should manage their own default via some
# custom UI that uses AddressBookController.
# @return [Boolean] Whether use of an address in checkout marks it as user's default
preference :automatic_default_address, :boolean, default: true
# @!attribute [rw] use_combined_first_and_last_name_in_address
# @return [Boolean] Use Spree::Address combined first and last name in HTML views and
# API responses. (default: +false+)
preference :use_combined_first_and_last_name_in_address, :boolean, default: false

# @!attribute [rw] can_restrict_stock_management
# @return [Boolean] Indicates if stock management can be restricted by location
preference :can_restrict_stock_management, :boolean, default: false
# Other configurations

# Allows restricting what currencies will be available.
#
Expand Down