mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b17d3e447c | ||
|
|
2ae4234015 | ||
|
|
20874dec98 | ||
|
|
288cd367bc | ||
|
|
68902021ab | ||
|
|
7f9c578fca | ||
|
|
782c9150a2 | ||
|
|
447b040020 |
@@ -1 +1 @@
|
|||||||
17.9.1
|
14.21.2
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400`
|
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400`
|
||||||
# on 2023-04-01 00:21:28 UTC using RuboCop version 1.47.0.
|
# on 2022-08-29 05:26:26 UTC using RuboCop version 1.35.1.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
# versions of RuboCop, may require this file to be generated again.
|
# versions of RuboCop, may require this file to be generated again.
|
||||||
|
|
||||||
# Offense count: 4
|
# Offense count: 2
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
||||||
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
||||||
@@ -15,7 +15,7 @@ Bundler/OrderedGems:
|
|||||||
- 'Gemfile'
|
- 'Gemfile'
|
||||||
|
|
||||||
# Offense count: 4
|
# Offense count: 4
|
||||||
# Configuration parameters: Severity, Include.
|
# Configuration parameters: Include.
|
||||||
# Include: **/*.gemspec
|
# Include: **/*.gemspec
|
||||||
Gemspec/RequiredRubyVersion:
|
Gemspec/RequiredRubyVersion:
|
||||||
Exclude:
|
Exclude:
|
||||||
@@ -24,65 +24,11 @@ Gemspec/RequiredRubyVersion:
|
|||||||
- 'engines/order_management/order_management.gemspec'
|
- 'engines/order_management/order_management.gemspec'
|
||||||
- 'engines/web/web.gemspec'
|
- 'engines/web/web.gemspec'
|
||||||
|
|
||||||
# Offense count: 28
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
||||||
# SupportedStyles: with_first_argument, with_fixed_indentation
|
|
||||||
Layout/ArgumentAlignment:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/spree/users_controller.rb'
|
|
||||||
- 'app/controllers/user_confirmations_controller.rb'
|
|
||||||
- 'app/models/enterprise.rb'
|
|
||||||
- 'spec/lib/reports/packing/packing_report_spec.rb'
|
|
||||||
- 'spec/migrations/migrate_customer_names_spec.rb'
|
|
||||||
- 'spec/services/products_renderer_spec.rb'
|
|
||||||
- 'spec/system/admin/bulk_order_management_spec.rb'
|
|
||||||
- 'spec/system/admin/enterprise_fees_spec.rb'
|
|
||||||
- 'spec/system/admin/order_cycles/list_spec.rb'
|
|
||||||
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
|
||||||
- 'spec/system/consumer/shopping/cart_spec.rb'
|
|
||||||
- 'spec/system/consumer/shopping/checkout_auth_spec.rb'
|
|
||||||
- 'spec/system/consumer/shopping/products_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
||||||
# SupportedStyles: with_first_element, with_fixed_indentation
|
|
||||||
Layout/ArrayAlignment:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/system/admin/customers_spec.rb'
|
|
||||||
- 'spec/system/admin/order_spec.rb'
|
|
||||||
- 'spec/system/admin/orders_spec.rb'
|
|
||||||
- 'spec/system/consumer/shopping/cart_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: EnforcedStyleAlignWith.
|
|
||||||
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
||||||
Layout/BlockAlignment:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/services/products_renderer_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 5
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Layout/BlockEndNewline:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/admin/subscriptions_controller.rb'
|
|
||||||
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
|
|
||||||
- 'spec/system/admin/orders_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Layout/ClosingParenthesisIndentation:
|
Layout/ClosingParenthesisIndentation:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/reporting/queries/joins.rb'
|
- 'lib/reporting/queries/joins.rb'
|
||||||
- 'spec/system/admin/orders_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Layout/EmptyLines:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/spree/payment.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
@@ -93,71 +39,6 @@ Layout/EmptyLinesAroundBlockBody:
|
|||||||
- 'spec/requests/checkout/concurrency_spec.rb'
|
- 'spec/requests/checkout/concurrency_spec.rb'
|
||||||
- 'spec/system/admin/order_cycles/list_spec.rb'
|
- 'spec/system/admin/order_cycles/list_spec.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
|
||||||
Layout/ExtraSpacing:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/spec_helper.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
||||||
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
|
||||||
Layout/FirstArgumentIndentation:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/system/admin/orders_spec.rb'
|
|
||||||
- 'spec/system/admin/products_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
||||||
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
|
||||||
Layout/FirstHashElementIndentation:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/services/products_renderer_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 13
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
||||||
# SupportedHashRocketStyles: key, separator, table
|
|
||||||
# SupportedColonStyles: key, separator, table
|
|
||||||
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
||||||
Layout/HashAlignment:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/admin/subscriptions_controller.rb'
|
|
||||||
- 'app/controllers/spree/users_controller.rb'
|
|
||||||
- 'app/models/spree/image.rb'
|
|
||||||
- 'spec/migrations/migrate_customer_names_spec.rb'
|
|
||||||
- 'spec/models/enterprise_spec.rb'
|
|
||||||
- 'spec/support/request/stripe_stubs.rb'
|
|
||||||
- 'spec/system/admin/customers_spec.rb'
|
|
||||||
- 'spec/system/admin/order_spec.rb'
|
|
||||||
- 'spec/system/admin/orders_spec.rb'
|
|
||||||
- 'spec/system/admin/tag_rules_spec.rb'
|
|
||||||
- 'spec/system/consumer/shopping/cart_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 18
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: normal, indented_internal_methods
|
|
||||||
Layout/IndentationConsistency:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/system/admin/order_cycles/complex_editing_spec.rb'
|
|
||||||
- 'spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb'
|
|
||||||
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
|
||||||
- 'spec/system/admin/order_spec.rb'
|
|
||||||
- 'spec/system/admin/orders_spec.rb'
|
|
||||||
- 'spec/system/admin/product_import_spec.rb'
|
|
||||||
- 'spec/system/consumer/split_checkout_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: Width, AllowedPatterns.
|
|
||||||
Layout/IndentationWidth:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/services/products_renderer_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
|
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
|
||||||
@@ -165,9 +46,9 @@ Layout/LeadingCommentSpace:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/system/admin/enterprises_spec.rb'
|
- 'spec/system/admin/enterprises_spec.rb'
|
||||||
|
|
||||||
# Offense count: 603
|
# Offense count: 862
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
|
||||||
# URISchemes: http, https
|
# URISchemes: http, https
|
||||||
Layout/LineLength:
|
Layout/LineLength:
|
||||||
Exclude:
|
Exclude:
|
||||||
@@ -180,8 +61,11 @@ Layout/LineLength:
|
|||||||
- 'app/controllers/admin/subscriptions_controller.rb'
|
- 'app/controllers/admin/subscriptions_controller.rb'
|
||||||
- 'app/controllers/api/v0/order_cycles_controller.rb'
|
- 'app/controllers/api/v0/order_cycles_controller.rb'
|
||||||
- 'app/controllers/payment_gateways/paypal_controller.rb'
|
- 'app/controllers/payment_gateways/paypal_controller.rb'
|
||||||
|
- 'app/controllers/spree/users_controller.rb'
|
||||||
|
- 'app/controllers/user_confirmations_controller.rb'
|
||||||
- 'app/helpers/angular_form_builder.rb'
|
- 'app/helpers/angular_form_builder.rb'
|
||||||
- 'app/helpers/angular_form_helper.rb'
|
- 'app/helpers/angular_form_helper.rb'
|
||||||
|
- 'app/helpers/checkout_helper.rb'
|
||||||
- 'app/helpers/enterprises_helper.rb'
|
- 'app/helpers/enterprises_helper.rb'
|
||||||
- 'app/helpers/order_cycles_helper.rb'
|
- 'app/helpers/order_cycles_helper.rb'
|
||||||
- 'app/helpers/spree/orders_helper.rb'
|
- 'app/helpers/spree/orders_helper.rb'
|
||||||
@@ -200,6 +84,7 @@ Layout/LineLength:
|
|||||||
- 'app/models/schedule.rb'
|
- 'app/models/schedule.rb'
|
||||||
- 'app/models/spree/app_configuration.rb'
|
- 'app/models/spree/app_configuration.rb'
|
||||||
- 'app/models/spree/gateway/stripe_sca.rb'
|
- 'app/models/spree/gateway/stripe_sca.rb'
|
||||||
|
- 'app/models/spree/image.rb'
|
||||||
- 'app/models/spree/line_item.rb'
|
- 'app/models/spree/line_item.rb'
|
||||||
- 'app/models/spree/order.rb'
|
- 'app/models/spree/order.rb'
|
||||||
- 'app/models/spree/payment_method.rb'
|
- 'app/models/spree/payment_method.rb'
|
||||||
@@ -243,13 +128,17 @@ Layout/LineLength:
|
|||||||
- 'spec/controllers/admin/variant_overrides_controller_spec.rb'
|
- 'spec/controllers/admin/variant_overrides_controller_spec.rb'
|
||||||
- 'spec/controllers/api/v0/base_controller_spec.rb'
|
- 'spec/controllers/api/v0/base_controller_spec.rb'
|
||||||
- 'spec/controllers/api/v0/exchange_products_controller_spec.rb'
|
- 'spec/controllers/api/v0/exchange_products_controller_spec.rb'
|
||||||
|
- 'spec/controllers/api/v0/logos_controller_spec.rb'
|
||||||
- 'spec/controllers/api/v0/order_cycles_controller_spec.rb'
|
- 'spec/controllers/api/v0/order_cycles_controller_spec.rb'
|
||||||
- 'spec/controllers/api/v0/orders_controller_spec.rb'
|
- 'spec/controllers/api/v0/orders_controller_spec.rb'
|
||||||
- 'spec/controllers/api/v0/products_controller_spec.rb'
|
- 'spec/controllers/api/v0/products_controller_spec.rb'
|
||||||
|
- 'spec/controllers/api/v0/promo_images_controller_spec.rb'
|
||||||
|
- 'spec/controllers/api/v0/terms_and_conditions_controller_spec.rb'
|
||||||
- 'spec/controllers/cart_controller_spec.rb'
|
- 'spec/controllers/cart_controller_spec.rb'
|
||||||
- 'spec/controllers/checkout_controller_spec.rb'
|
- 'spec/controllers/checkout_controller_spec.rb'
|
||||||
- 'spec/controllers/enterprises_controller_spec.rb'
|
- 'spec/controllers/enterprises_controller_spec.rb'
|
||||||
- 'spec/controllers/line_items_controller_spec.rb'
|
- 'spec/controllers/line_items_controller_spec.rb'
|
||||||
|
- 'spec/controllers/registration_controller_spec.rb'
|
||||||
- 'spec/controllers/shops_controller_spec.rb'
|
- 'spec/controllers/shops_controller_spec.rb'
|
||||||
- 'spec/controllers/spree/admin/orders/customer_details_controller_spec.rb'
|
- 'spec/controllers/spree/admin/orders/customer_details_controller_spec.rb'
|
||||||
- 'spec/controllers/spree/admin/orders/invoices_spec.rb'
|
- 'spec/controllers/spree/admin/orders/invoices_spec.rb'
|
||||||
@@ -258,8 +147,12 @@ Layout/LineLength:
|
|||||||
- 'spec/controllers/spree/admin/variants_controller_spec.rb'
|
- 'spec/controllers/spree/admin/variants_controller_spec.rb'
|
||||||
- 'spec/controllers/spree/credit_cards_controller_spec.rb'
|
- 'spec/controllers/spree/credit_cards_controller_spec.rb'
|
||||||
- 'spec/controllers/spree/orders_controller_spec.rb'
|
- 'spec/controllers/spree/orders_controller_spec.rb'
|
||||||
|
- 'spec/controllers/stripe/callbacks_controller_spec.rb'
|
||||||
- 'spec/controllers/stripe/webhooks_controller_spec.rb'
|
- 'spec/controllers/stripe/webhooks_controller_spec.rb'
|
||||||
|
- 'spec/controllers/user_confirmations_controller_spec.rb'
|
||||||
|
- 'spec/factories/order_factory.rb'
|
||||||
- 'spec/factories/stock_location_factory.rb'
|
- 'spec/factories/stock_location_factory.rb'
|
||||||
|
- 'spec/helpers/enterprises_helper_spec.rb'
|
||||||
- 'spec/helpers/injection_helper_spec.rb'
|
- 'spec/helpers/injection_helper_spec.rb'
|
||||||
- 'spec/helpers/order_cycles_helper_spec.rb'
|
- 'spec/helpers/order_cycles_helper_spec.rb'
|
||||||
- 'spec/helpers/spree/admin/base_helper_spec.rb'
|
- 'spec/helpers/spree/admin/base_helper_spec.rb'
|
||||||
@@ -273,11 +166,13 @@ Layout/LineLength:
|
|||||||
- 'spec/lib/open_food_network/tag_rule_applicator_spec.rb'
|
- 'spec/lib/open_food_network/tag_rule_applicator_spec.rb'
|
||||||
- 'spec/lib/reports/customers_report_spec.rb'
|
- 'spec/lib/reports/customers_report_spec.rb'
|
||||||
- 'spec/lib/reports/order_cycle_management_report_spec.rb'
|
- 'spec/lib/reports/order_cycle_management_report_spec.rb'
|
||||||
|
- 'spec/lib/reports/packing/packing_report_spec.rb'
|
||||||
- 'spec/lib/reports/products_and_inventory_report_spec.rb'
|
- 'spec/lib/reports/products_and_inventory_report_spec.rb'
|
||||||
- 'spec/lib/reports/users_and_enterprises_report_spec.rb'
|
- 'spec/lib/reports/users_and_enterprises_report_spec.rb'
|
||||||
- 'spec/mailers/order_mailer_spec.rb'
|
- 'spec/mailers/order_mailer_spec.rb'
|
||||||
- 'spec/mailers/producer_mailer_spec.rb'
|
- 'spec/mailers/producer_mailer_spec.rb'
|
||||||
- 'spec/mailers/subscription_mailer_spec.rb'
|
- 'spec/mailers/subscription_mailer_spec.rb'
|
||||||
|
- 'spec/migrations/migrate_customer_names_spec.rb'
|
||||||
- 'spec/models/concerns/calculated_adjustments_spec.rb'
|
- 'spec/models/concerns/calculated_adjustments_spec.rb'
|
||||||
- 'spec/models/concerns/order_shipment_spec.rb'
|
- 'spec/models/concerns/order_shipment_spec.rb'
|
||||||
- 'spec/models/concerns/product_stock_spec.rb'
|
- 'spec/models/concerns/product_stock_spec.rb'
|
||||||
@@ -309,6 +204,7 @@ Layout/LineLength:
|
|||||||
- 'spec/models/variant_override_spec.rb'
|
- 'spec/models/variant_override_spec.rb'
|
||||||
- 'spec/requests/api/orders_spec.rb'
|
- 'spec/requests/api/orders_spec.rb'
|
||||||
- 'spec/requests/checkout/failed_checkout_spec.rb'
|
- 'spec/requests/checkout/failed_checkout_spec.rb'
|
||||||
|
- 'spec/routing/stripe_spec.rb'
|
||||||
- 'spec/serializers/api/admin/exchange_serializer_spec.rb'
|
- 'spec/serializers/api/admin/exchange_serializer_spec.rb'
|
||||||
- 'spec/serializers/api/admin/order_cycle_serializer_spec.rb'
|
- 'spec/serializers/api/admin/order_cycle_serializer_spec.rb'
|
||||||
- 'spec/services/address_geocoder_spec.rb'
|
- 'spec/services/address_geocoder_spec.rb'
|
||||||
@@ -329,82 +225,72 @@ Layout/LineLength:
|
|||||||
- 'spec/support/features/datepicker_helper.rb'
|
- 'spec/support/features/datepicker_helper.rb'
|
||||||
- 'spec/support/matchers/select2_matchers.rb'
|
- 'spec/support/matchers/select2_matchers.rb'
|
||||||
- 'spec/support/matchers/table_matchers.rb'
|
- 'spec/support/matchers/table_matchers.rb'
|
||||||
|
- 'spec/support/request/stripe_stubs.rb'
|
||||||
- 'spec/support/request/web_helper.rb'
|
- 'spec/support/request/web_helper.rb'
|
||||||
- 'spec/system/admin/adjustments_spec.rb'
|
- 'spec/system/admin/adjustments_spec.rb'
|
||||||
- 'spec/system/admin/bulk_order_management_spec.rb'
|
- 'spec/system/admin/bulk_order_management_spec.rb'
|
||||||
- 'spec/system/admin/bulk_product_update_spec.rb'
|
- 'spec/system/admin/bulk_product_update_spec.rb'
|
||||||
|
- 'spec/system/admin/configuration/content_spec.rb'
|
||||||
|
- 'spec/system/admin/customers_spec.rb'
|
||||||
|
- 'spec/system/admin/enterprise_fees_spec.rb'
|
||||||
|
- 'spec/system/admin/enterprise_relationships_spec.rb'
|
||||||
|
- 'spec/system/admin/enterprises/business_address_form_spec.rb'
|
||||||
|
- 'spec/system/admin/enterprises/images_spec.rb'
|
||||||
|
- 'spec/system/admin/enterprises/index_spec.rb'
|
||||||
|
- 'spec/system/admin/enterprises_spec.rb'
|
||||||
|
- 'spec/system/admin/multilingual_spec.rb'
|
||||||
|
- 'spec/system/admin/order_cycles/complex_editing_multiple_product_pages_spec.rb'
|
||||||
|
- 'spec/system/admin/order_cycles/complex_editing_spec.rb'
|
||||||
|
- 'spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb'
|
||||||
|
- 'spec/system/admin/order_cycles/list_spec.rb'
|
||||||
|
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
||||||
|
- 'spec/system/admin/order_spec.rb'
|
||||||
|
- 'spec/system/admin/orders_spec.rb'
|
||||||
|
- 'spec/system/admin/overview_spec.rb'
|
||||||
|
- 'spec/system/admin/payment_method_spec.rb'
|
||||||
|
- 'spec/system/admin/payments_stripe_spec.rb'
|
||||||
|
- 'spec/system/admin/product_import_spec.rb'
|
||||||
|
- 'spec/system/admin/products_spec.rb'
|
||||||
|
- 'spec/system/admin/reports/packing_report_spec.rb'
|
||||||
|
- 'spec/system/admin/schedules_spec.rb'
|
||||||
|
- 'spec/system/admin/shipping_methods_spec.rb'
|
||||||
|
- 'spec/system/admin/subscriptions_spec.rb'
|
||||||
|
- 'spec/system/admin/tag_rules_spec.rb'
|
||||||
|
- 'spec/system/admin/users_spec.rb'
|
||||||
|
- 'spec/system/admin/variant_overrides_spec.rb'
|
||||||
|
- 'spec/system/consumer/authentication_spec.rb'
|
||||||
|
- 'spec/system/consumer/caching/shops_caching_spec.rb'
|
||||||
|
- 'spec/system/consumer/cookies_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/cart_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/checkout_auth_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/checkout_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/checkout_stripe_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/products_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/shopping_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/unit_price_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/variant_overrides_spec.rb'
|
||||||
|
- 'spec/system/consumer/split_checkout_spec.rb'
|
||||||
|
- 'spec/system/support/precompile_assets.rb'
|
||||||
|
- 'spec/views/spree/admin/payment_methods/index.html.haml_spec.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
Layout/MultilineBlockLayout:
|
|
||||||
Exclude:
|
|
||||||
- 'engines/order_management/app/services/order_management/subscriptions/validator.rb'
|
|
||||||
|
|
||||||
# Offense count: 7
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
# SupportedStyles: symmetrical, new_line, same_line
|
# SupportedStyles: symmetrical, new_line, same_line
|
||||||
Layout/MultilineMethodCallBraceLayout:
|
Layout/MultilineMethodCallBraceLayout:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/reporting/queries/joins.rb'
|
- 'lib/reporting/queries/joins.rb'
|
||||||
- 'spec/system/admin/orders_spec.rb'
|
|
||||||
- 'spec/system/admin/products_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 6
|
# Offense count: 22
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
||||||
# SupportedStyles: aligned, indented, indented_relative_to_receiver
|
|
||||||
Layout/MultilineMethodCallIndentation:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/controllers/api/v0/orders_controller_spec.rb'
|
|
||||||
- 'spec/system/admin/order_cycles/complex_editing_spec.rb'
|
|
||||||
- 'spec/system/admin/overview_spec.rb'
|
|
||||||
- 'spec/system/admin/payment_method_spec.rb'
|
|
||||||
- 'spec/system/admin/variant_overrides_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
||||||
# SupportedStyles: aligned, indented
|
|
||||||
Layout/MultilineOperationIndentation:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/spree/order.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: final_newline, final_blank_line
|
|
||||||
Layout/TrailingEmptyLines:
|
|
||||||
Exclude:
|
|
||||||
- 'Rakefile'
|
|
||||||
|
|
||||||
# Offense count: 69
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: AllowInHeredoc.
|
# Configuration parameters: AllowInHeredoc.
|
||||||
Layout/TrailingWhitespace:
|
Layout/TrailingWhitespace:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/spree/users_controller.rb'
|
- 'app/controllers/spree/admin/shipping_methods_controller.rb'
|
||||||
- 'app/controllers/user_confirmations_controller.rb'
|
- 'spec/controllers/spree/admin/shipping_methods_controller_spec.rb'
|
||||||
- 'app/models/enterprise.rb'
|
|
||||||
- 'app/models/spree/image.rb'
|
|
||||||
- 'spec/controllers/spree/credit_cards_controller_spec.rb'
|
|
||||||
- 'spec/controllers/user_confirmations_controller_spec.rb'
|
|
||||||
- 'spec/factories/order_factory.rb'
|
|
||||||
- 'spec/lib/reports/packing/packing_report_spec.rb'
|
|
||||||
- 'spec/models/enterprise_spec.rb'
|
|
||||||
- 'spec/services/products_renderer_spec.rb'
|
|
||||||
- 'spec/support/request/stripe_stubs.rb'
|
|
||||||
- 'spec/system/admin/bulk_order_management_spec.rb'
|
|
||||||
- 'spec/system/admin/customers_spec.rb'
|
|
||||||
- 'spec/system/admin/enterprise_fees_spec.rb'
|
|
||||||
- 'spec/system/admin/flatpickr_spec.rb'
|
|
||||||
- 'spec/system/admin/order_cycles/complex_editing_spec.rb'
|
|
||||||
- 'spec/system/admin/order_cycles/list_spec.rb'
|
|
||||||
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
|
||||||
- 'spec/system/admin/order_spec.rb'
|
- 'spec/system/admin/order_spec.rb'
|
||||||
- 'spec/system/admin/product_import_spec.rb'
|
|
||||||
- 'spec/system/admin/shipping_methods_spec.rb'
|
- 'spec/system/admin/shipping_methods_spec.rb'
|
||||||
- 'spec/system/consumer/split_checkout_spec.rb'
|
- 'spec/system/flatpickr_spec.rb'
|
||||||
|
|
||||||
# Offense count: 17
|
# Offense count: 17
|
||||||
# Configuration parameters: AllowedMethods.
|
# Configuration parameters: AllowedMethods.
|
||||||
@@ -476,23 +362,15 @@ Lint/UnusedMethodArgument:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/reporting/queries/query_interface.rb'
|
- 'lib/reporting/queries/query_interface.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 5
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
Lint/UselessMethodDefinition:
|
Lint/UselessMethodDefinition:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
- 'app/controllers/spree/user_registrations_controller.rb'
|
||||||
- 'app/models/spree/gateway.rb'
|
- 'app/models/spree/gateway.rb'
|
||||||
|
|
||||||
# Offense count: 13
|
# Offense count: 28
|
||||||
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes, Max.
|
||||||
Lint/Void:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/system/admin/order_cycles/complex_editing_spec.rb'
|
|
||||||
- 'spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb'
|
|
||||||
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
|
||||||
- 'spec/system/admin/order_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 27
|
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
||||||
Metrics/AbcSize:
|
Metrics/AbcSize:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/admin/enterprises_controller.rb'
|
- 'app/controllers/admin/enterprises_controller.rb'
|
||||||
@@ -502,6 +380,7 @@ Metrics/AbcSize:
|
|||||||
- 'app/controllers/spree/admin/taxons_controller.rb'
|
- 'app/controllers/spree/admin/taxons_controller.rb'
|
||||||
- 'app/controllers/spree/admin/variants_controller.rb'
|
- 'app/controllers/spree/admin/variants_controller.rb'
|
||||||
- 'app/controllers/spree/orders_controller.rb'
|
- 'app/controllers/spree/orders_controller.rb'
|
||||||
|
- 'app/helpers/checkout_helper.rb'
|
||||||
- 'app/helpers/spree/admin/navigation_helper.rb'
|
- 'app/helpers/spree/admin/navigation_helper.rb'
|
||||||
- 'app/models/enterprise_group.rb'
|
- 'app/models/enterprise_group.rb'
|
||||||
- 'app/models/enterprise_relationship.rb'
|
- 'app/models/enterprise_relationship.rb'
|
||||||
@@ -518,8 +397,8 @@ Metrics/AbcSize:
|
|||||||
- 'lib/tasks/enterprises.rake'
|
- 'lib/tasks/enterprises.rake'
|
||||||
- 'spec/services/order_checkout_restart_spec.rb'
|
- 'spec/services/order_checkout_restart_spec.rb'
|
||||||
|
|
||||||
# Offense count: 41
|
# Offense count: 42
|
||||||
# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
|
# Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||||
# AllowedMethods: refine
|
# AllowedMethods: refine
|
||||||
Metrics/BlockLength:
|
Metrics/BlockLength:
|
||||||
Exclude:
|
Exclude:
|
||||||
@@ -543,6 +422,7 @@ Metrics/BlockLength:
|
|||||||
- 'spec/factories/user_factory.rb'
|
- 'spec/factories/user_factory.rb'
|
||||||
- 'spec/factories/variant_factory.rb'
|
- 'spec/factories/variant_factory.rb'
|
||||||
- 'spec/requests/api/orders_spec.rb'
|
- 'spec/requests/api/orders_spec.rb'
|
||||||
|
- 'spec/spec_helper.rb'
|
||||||
- 'spec/support/cancan_helper.rb'
|
- 'spec/support/cancan_helper.rb'
|
||||||
- 'spec/support/matchers/select2_matchers.rb'
|
- 'spec/support/matchers/select2_matchers.rb'
|
||||||
- 'spec/support/matchers/table_matchers.rb'
|
- 'spec/support/matchers/table_matchers.rb'
|
||||||
@@ -555,11 +435,12 @@ Metrics/BlockNesting:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/spree/payment/processing.rb'
|
- 'app/models/spree/payment/processing.rb'
|
||||||
|
|
||||||
# Offense count: 46
|
# Offense count: 45
|
||||||
# Configuration parameters: CountComments, Max, CountAsOne.
|
# Configuration parameters: CountComments, Max, CountAsOne.
|
||||||
Metrics/ClassLength:
|
Metrics/ClassLength:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/components/products_table_component.rb'
|
- 'app/components/products_table_component.rb'
|
||||||
|
- 'app/controllers/admin/customers_controller.rb'
|
||||||
- 'app/controllers/admin/enterprises_controller.rb'
|
- 'app/controllers/admin/enterprises_controller.rb'
|
||||||
- 'app/controllers/admin/order_cycles_controller.rb'
|
- 'app/controllers/admin/order_cycles_controller.rb'
|
||||||
- 'app/controllers/admin/resource_controller.rb'
|
- 'app/controllers/admin/resource_controller.rb'
|
||||||
@@ -596,8 +477,8 @@ Metrics/ClassLength:
|
|||||||
- 'app/serializers/api/cached_enterprise_serializer.rb'
|
- 'app/serializers/api/cached_enterprise_serializer.rb'
|
||||||
- 'app/serializers/api/enterprise_shopfront_serializer.rb'
|
- 'app/serializers/api/enterprise_shopfront_serializer.rb'
|
||||||
- 'app/services/cart_service.rb'
|
- 'app/services/cart_service.rb'
|
||||||
- 'app/services/order_cycle_form.rb'
|
|
||||||
- 'app/services/order_syncer.rb'
|
- 'app/services/order_syncer.rb'
|
||||||
|
- 'app/services/order_cycle_form.rb'
|
||||||
- 'engines/order_management/app/services/order_management/order/updater.rb'
|
- 'engines/order_management/app/services/order_management/order/updater.rb'
|
||||||
- 'lib/open_food_network/enterprise_fee_calculator.rb'
|
- 'lib/open_food_network/enterprise_fee_calculator.rb'
|
||||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||||
@@ -607,7 +488,7 @@ Metrics/ClassLength:
|
|||||||
- 'lib/reporting/reports/xero_invoices/base.rb'
|
- 'lib/reporting/reports/xero_invoices/base.rb'
|
||||||
|
|
||||||
# Offense count: 35
|
# Offense count: 35
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, Max.
|
||||||
Metrics/CyclomaticComplexity:
|
Metrics/CyclomaticComplexity:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/admin/enterprises_controller.rb'
|
- 'app/controllers/admin/enterprises_controller.rb'
|
||||||
@@ -640,15 +521,17 @@ Metrics/CyclomaticComplexity:
|
|||||||
- 'lib/spree/localized_number.rb'
|
- 'lib/spree/localized_number.rb'
|
||||||
- 'spec/models/product_importer_spec.rb'
|
- 'spec/models/product_importer_spec.rb'
|
||||||
|
|
||||||
# Offense count: 24
|
# Offense count: 26
|
||||||
# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
|
# Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||||
Metrics/MethodLength:
|
Metrics/MethodLength:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/admin/enterprises_controller.rb'
|
- 'app/controllers/admin/enterprises_controller.rb'
|
||||||
- 'app/controllers/payment_gateways/paypal_controller.rb'
|
- 'app/controllers/payment_gateways/paypal_controller.rb'
|
||||||
- 'app/controllers/spree/admin/taxons_controller.rb'
|
- 'app/controllers/spree/admin/taxons_controller.rb'
|
||||||
- 'app/controllers/spree/orders_controller.rb'
|
- 'app/controllers/spree/orders_controller.rb'
|
||||||
|
- 'app/helpers/checkout_helper.rb'
|
||||||
- 'app/helpers/spree/admin/navigation_helper.rb'
|
- 'app/helpers/spree/admin/navigation_helper.rb'
|
||||||
|
- 'app/json_schemas/json_api_schema.rb'
|
||||||
- 'app/models/spree/ability.rb'
|
- 'app/models/spree/ability.rb'
|
||||||
- 'app/models/spree/gateway/pay_pal_express.rb'
|
- 'app/models/spree/gateway/pay_pal_express.rb'
|
||||||
- 'app/models/spree/order/checkout.rb'
|
- 'app/models/spree/order/checkout.rb'
|
||||||
@@ -661,7 +544,7 @@ Metrics/MethodLength:
|
|||||||
- 'lib/reporting/reports/xero_invoices/base.rb'
|
- 'lib/reporting/reports/xero_invoices/base.rb'
|
||||||
- 'lib/tasks/sample_data/product_factory.rb'
|
- 'lib/tasks/sample_data/product_factory.rb'
|
||||||
|
|
||||||
# Offense count: 50
|
# Offense count: 51
|
||||||
# Configuration parameters: CountComments, Max, CountAsOne.
|
# Configuration parameters: CountComments, Max, CountAsOne.
|
||||||
Metrics/ModuleLength:
|
Metrics/ModuleLength:
|
||||||
Exclude:
|
Exclude:
|
||||||
@@ -715,6 +598,7 @@ Metrics/ModuleLength:
|
|||||||
- 'spec/services/variant_units/option_value_namer_spec.rb'
|
- 'spec/services/variant_units/option_value_namer_spec.rb'
|
||||||
- 'spec/support/request/shop_workflow.rb'
|
- 'spec/support/request/shop_workflow.rb'
|
||||||
- 'spec/support/request/stripe_stubs.rb'
|
- 'spec/support/request/stripe_stubs.rb'
|
||||||
|
- 'spec/support/request/web_helper.rb'
|
||||||
|
|
||||||
# Offense count: 7
|
# Offense count: 7
|
||||||
# Configuration parameters: Max, CountKeywordArgs, MaxOptionalParameters.
|
# Configuration parameters: Max, CountKeywordArgs, MaxOptionalParameters.
|
||||||
@@ -726,11 +610,12 @@ Metrics/ParameterLists:
|
|||||||
- 'spec/support/controller_requests_helper.rb'
|
- 'spec/support/controller_requests_helper.rb'
|
||||||
- 'spec/system/admin/reports_spec.rb'
|
- 'spec/system/admin/reports_spec.rb'
|
||||||
|
|
||||||
# Offense count: 4
|
# Offense count: 5
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, Max.
|
||||||
Metrics/PerceivedComplexity:
|
Metrics/PerceivedComplexity:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/spree/admin/taxons_controller.rb'
|
- 'app/controllers/spree/admin/taxons_controller.rb'
|
||||||
|
- 'app/helpers/checkout_helper.rb'
|
||||||
- 'app/models/enterprise_relationship.rb'
|
- 'app/models/enterprise_relationship.rb'
|
||||||
- 'app/models/spree/ability.rb'
|
- 'app/models/spree/ability.rb'
|
||||||
- 'app/models/spree/order/checkout.rb'
|
- 'app/models/spree/order/checkout.rb'
|
||||||
@@ -746,15 +631,9 @@ Naming/AccessorMethodName:
|
|||||||
- 'spec/support/request/shop_workflow.rb'
|
- 'spec/support/request/shop_workflow.rb'
|
||||||
- 'spec/support/request/web_helper.rb'
|
- 'spec/support/request/web_helper.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: AsciiConstants.
|
|
||||||
Naming/AsciiIdentifiers:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/system/admin/products_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: ForbiddenDelimiters.
|
# Configuration parameters: ForbiddenDelimiters.
|
||||||
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
||||||
Naming/HeredocDelimiterNaming:
|
Naming/HeredocDelimiterNaming:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/content_configuration.rb'
|
- 'app/models/content_configuration.rb'
|
||||||
@@ -770,7 +649,7 @@ Naming/MemoizedInstanceVariableName:
|
|||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
||||||
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
|
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
|
||||||
Naming/MethodParameterName:
|
Naming/MethodParameterName:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/services/process_payment_intent.rb'
|
- 'app/services/process_payment_intent.rb'
|
||||||
@@ -778,7 +657,7 @@ Naming/MethodParameterName:
|
|||||||
# Offense count: 28
|
# Offense count: 28
|
||||||
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
||||||
# SupportedStyles: snake_case, normalcase, non_integer
|
# SupportedStyles: snake_case, normalcase, non_integer
|
||||||
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
|
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
|
||||||
Naming/VariableNumber:
|
Naming/VariableNumber:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/spree/orders_controller.rb'
|
- 'app/controllers/spree/orders_controller.rb'
|
||||||
@@ -792,7 +671,7 @@ Naming/VariableNumber:
|
|||||||
- 'spec/requests/api/orders_spec.rb'
|
- 'spec/requests/api/orders_spec.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: Severity, Include.
|
# Configuration parameters: Include.
|
||||||
# Include: app/models/**/*.rb
|
# Include: app/models/**/*.rb
|
||||||
Rails/ActiveRecordOverride:
|
Rails/ActiveRecordOverride:
|
||||||
Exclude:
|
Exclude:
|
||||||
@@ -804,12 +683,6 @@ Rails/ApplicationController:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'engines/dfc_provider/app/controllers/dfc_provider/base_controller.rb'
|
- 'engines/dfc_provider/app/controllers/dfc_provider/base_controller.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
Rails/ApplicationJob:
|
|
||||||
Exclude:
|
|
||||||
- 'app/jobs/report_job.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
Rails/ApplicationMailer:
|
Rails/ApplicationMailer:
|
||||||
@@ -826,22 +699,29 @@ Rails/Blank:
|
|||||||
- 'engines/order_management/app/services/order_management/stock/package.rb'
|
- 'engines/order_management/app/services/order_management/stock/package.rb'
|
||||||
- 'lib/stripe/authorize_response_patcher.rb'
|
- 'lib/stripe/authorize_response_patcher.rb'
|
||||||
|
|
||||||
# Offense count: 5
|
# Offense count: 1
|
||||||
|
# Configuration parameters: EnforcedStyle, AllowToTime.
|
||||||
|
# SupportedStyles: strict, flexible
|
||||||
|
Rails/Date:
|
||||||
|
Exclude:
|
||||||
|
- 'spec/system/flatpickr_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 4
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
# SupportedStyles: slashes, arguments
|
# SupportedStyles: slashes, arguments
|
||||||
Rails/FilePath:
|
Rails/FilePath:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/product_import/product_importer.rb'
|
- 'app/models/product_import/product_importer.rb'
|
||||||
- 'lib/tasks/karma.rake'
|
- 'lib/tasks/karma.rake'
|
||||||
- 'spec/base_spec_helper.rb'
|
|
||||||
- 'spec/models/content_configuration_spec.rb'
|
- 'spec/models/content_configuration_spec.rb'
|
||||||
- 'spec/support/downloads_helper.rb'
|
- 'spec/support/downloads_helper.rb'
|
||||||
|
|
||||||
# Offense count: 11
|
# Offense count: 12
|
||||||
# Configuration parameters: Include.
|
# Configuration parameters: Include.
|
||||||
# Include: app/models/**/*.rb
|
# Include: app/models/**/*.rb
|
||||||
Rails/HasAndBelongsToMany:
|
Rails/HasAndBelongsToMany:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
- 'app/models/concerns/payment_method_distributors.rb'
|
||||||
- 'app/models/enterprise.rb'
|
- 'app/models/enterprise.rb'
|
||||||
- 'app/models/enterprise_group.rb'
|
- 'app/models/enterprise_group.rb'
|
||||||
- 'app/models/order_cycle.rb'
|
- 'app/models/order_cycle.rb'
|
||||||
@@ -853,7 +733,7 @@ Rails/HasAndBelongsToMany:
|
|||||||
- 'app/models/spree/variant.rb'
|
- 'app/models/spree/variant.rb'
|
||||||
- 'app/models/spree/zone.rb'
|
- 'app/models/spree/zone.rb'
|
||||||
|
|
||||||
# Offense count: 47
|
# Offense count: 45
|
||||||
# Configuration parameters: Include.
|
# Configuration parameters: Include.
|
||||||
# Include: app/models/**/*.rb
|
# Include: app/models/**/*.rb
|
||||||
Rails/HasManyOrHasOneDependent:
|
Rails/HasManyOrHasOneDependent:
|
||||||
@@ -880,7 +760,7 @@ Rails/HasManyOrHasOneDependent:
|
|||||||
- 'app/models/spree/user.rb'
|
- 'app/models/spree/user.rb'
|
||||||
- 'app/models/spree/variant.rb'
|
- 'app/models/spree/variant.rb'
|
||||||
|
|
||||||
# Offense count: 59
|
# Offense count: 62
|
||||||
# Configuration parameters: Include.
|
# Configuration parameters: Include.
|
||||||
# Include: app/helpers/**/*.rb
|
# Include: app/helpers/**/*.rb
|
||||||
Rails/HelperInstanceVariable:
|
Rails/HelperInstanceVariable:
|
||||||
@@ -894,7 +774,7 @@ Rails/HelperInstanceVariable:
|
|||||||
- 'app/helpers/spree/admin/orders_helper.rb'
|
- 'app/helpers/spree/admin/orders_helper.rb'
|
||||||
- 'app/helpers/spree/orders_helper.rb'
|
- 'app/helpers/spree/orders_helper.rb'
|
||||||
|
|
||||||
# Offense count: 37
|
# Offense count: 36
|
||||||
# Configuration parameters: IgnoreScopes, Include.
|
# Configuration parameters: IgnoreScopes, Include.
|
||||||
# Include: app/models/**/*.rb
|
# Include: app/models/**/*.rb
|
||||||
Rails/InverseOf:
|
Rails/InverseOf:
|
||||||
@@ -973,7 +853,7 @@ Rails/SkipsModelValidations:
|
|||||||
- 'app/models/variant_override.rb'
|
- 'app/models/variant_override.rb'
|
||||||
- 'spec/models/spree/line_item_spec.rb'
|
- 'spec/models/spree/line_item_spec.rb'
|
||||||
|
|
||||||
# Offense count: 4
|
# Offense count: 5
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
# SupportedStyles: strict, flexible
|
# SupportedStyles: strict, flexible
|
||||||
@@ -983,6 +863,7 @@ Rails/TimeZone:
|
|||||||
- 'spec/controllers/spree/credit_cards_controller_spec.rb'
|
- 'spec/controllers/spree/credit_cards_controller_spec.rb'
|
||||||
- 'spec/models/spree/tax_rate_spec.rb'
|
- 'spec/models/spree/tax_rate_spec.rb'
|
||||||
- 'spec/services/customer_order_cancellation_spec.rb'
|
- 'spec/services/customer_order_cancellation_spec.rb'
|
||||||
|
- 'spec/system/admin/order_cycles/list_spec.rb'
|
||||||
|
|
||||||
# Offense count: 5
|
# Offense count: 5
|
||||||
# Configuration parameters: Include.
|
# Configuration parameters: Include.
|
||||||
@@ -996,7 +877,7 @@ Rails/UniqueValidationWithoutIndex:
|
|||||||
- 'app/models/spree/zone.rb'
|
- 'app/models/spree/zone.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: Severity, Environments.
|
# Configuration parameters: Environments.
|
||||||
# Environments: development, test, production
|
# Environments: development, test, production
|
||||||
Rails/UnknownEnv:
|
Rails/UnknownEnv:
|
||||||
Exclude:
|
Exclude:
|
||||||
@@ -1015,7 +896,7 @@ Style/BlockComments:
|
|||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: AllowOnConstant, AllowOnSelfClass.
|
# Configuration parameters: AllowOnConstant.
|
||||||
Style/CaseEquality:
|
Style/CaseEquality:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/models/spree/payment_spec.rb'
|
- 'spec/models/spree/payment_spec.rb'
|
||||||
@@ -1065,9 +946,8 @@ Style/ClassVars:
|
|||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
|
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||||
# SupportedStyles: annotated, template, unannotated
|
# SupportedStyles: annotated, template, unannotated
|
||||||
# AllowedMethods: redirect
|
|
||||||
Style/FormatStringToken:
|
Style/FormatStringToken:
|
||||||
EnforcedStyle: unannotated
|
EnforcedStyle: unannotated
|
||||||
|
|
||||||
@@ -1089,8 +969,7 @@ Style/GlobalStdStream:
|
|||||||
- 'lib/tasks/subscriptions/debug.rake'
|
- 'lib/tasks/subscriptions/debug.rake'
|
||||||
- 'lib/tasks/subscriptions/test.rake'
|
- 'lib/tasks/subscriptions/test.rake'
|
||||||
|
|
||||||
# Offense count: 39
|
# Offense count: 40
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
|
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
|
||||||
Style/GuardClause:
|
Style/GuardClause:
|
||||||
Exclude:
|
Exclude:
|
||||||
@@ -1100,6 +979,7 @@ Style/GuardClause:
|
|||||||
- 'app/controllers/api/v0/shipments_controller.rb'
|
- 'app/controllers/api/v0/shipments_controller.rb'
|
||||||
- 'app/controllers/application_controller.rb'
|
- 'app/controllers/application_controller.rb'
|
||||||
- 'app/controllers/home_controller.rb'
|
- 'app/controllers/home_controller.rb'
|
||||||
|
- 'app/controllers/spree/admin/shipping_methods_controller.rb'
|
||||||
- 'app/controllers/spree/orders_controller.rb'
|
- 'app/controllers/spree/orders_controller.rb'
|
||||||
- 'app/models/enterprise.rb'
|
- 'app/models/enterprise.rb'
|
||||||
- 'app/models/enterprise_group.rb'
|
- 'app/models/enterprise_group.rb'
|
||||||
@@ -1123,21 +1003,12 @@ Style/HashLikeCase:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/enterprise.rb'
|
- 'app/models/enterprise.rb'
|
||||||
|
|
||||||
# Offense count: 11
|
# Offense count: 1
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: InverseMethods, InverseBlocks.
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||||
Style/InverseMethods:
|
Style/MethodCallWithoutArgsParentheses:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/admin/resource_controller.rb'
|
- 'spec/system/flatpickr_spec.rb'
|
||||||
- 'app/models/calculator/weight.rb'
|
|
||||||
- 'app/models/product_import/spreadsheet_entry.rb'
|
|
||||||
- 'app/models/spree/order/checkout.rb'
|
|
||||||
- 'app/models/spree/order_contents.rb'
|
|
||||||
- 'app/models/spree/payment.rb'
|
|
||||||
- 'app/services/order_cart_reset.rb'
|
|
||||||
- 'engines/order_management/app/services/order_management/stock/estimator.rb'
|
|
||||||
- 'lib/spree/localized_number.rb'
|
|
||||||
- 'spec/support/matchers/table_matchers.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
Style/MissingRespondToMissing:
|
Style/MissingRespondToMissing:
|
||||||
@@ -1146,12 +1017,6 @@ Style/MissingRespondToMissing:
|
|||||||
- 'app/models/spree/gateway.rb'
|
- 'app/models/spree/gateway.rb'
|
||||||
- 'app/models/spree/preferences/configuration.rb'
|
- 'app/models/spree/preferences/configuration.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Style/MultilineTernaryOperator:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/system/admin/subscriptions_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 22
|
# Offense count: 22
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
Style/NestedModifier:
|
Style/NestedModifier:
|
||||||
@@ -1167,21 +1032,14 @@ Style/NestedModifier:
|
|||||||
- 'spec/system/admin/payments_stripe_spec.rb'
|
- 'spec/system/admin/payments_stripe_spec.rb'
|
||||||
- 'spec/system/admin/reports_spec.rb'
|
- 'spec/system/admin/reports_spec.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 17
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowedMethods.
|
|
||||||
# AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with
|
|
||||||
Style/NestedParenthesizedCalls:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/system/admin/products_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 16
|
|
||||||
# Configuration parameters: AllowedMethods.
|
# Configuration parameters: AllowedMethods.
|
||||||
# AllowedMethods: respond_to_missing?
|
# AllowedMethods: respond_to_missing?
|
||||||
Style/OptionalBooleanParameter:
|
Style/OptionalBooleanParameter:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/admin/subscriptions_controller.rb'
|
- 'app/controllers/admin/subscriptions_controller.rb'
|
||||||
- 'app/mailers/spree/order_mailer.rb'
|
- 'app/mailers/spree/order_mailer.rb'
|
||||||
|
- 'app/mailers/spree/shipment_mailer.rb'
|
||||||
- 'app/models/concerns/calculated_adjustments.rb'
|
- 'app/models/concerns/calculated_adjustments.rb'
|
||||||
- 'app/models/enterprise_relationship.rb'
|
- 'app/models/enterprise_relationship.rb'
|
||||||
- 'app/models/product_import/entry_processor.rb'
|
- 'app/models/product_import/entry_processor.rb'
|
||||||
@@ -1192,13 +1050,6 @@ Style/OptionalBooleanParameter:
|
|||||||
- 'lib/spree/core/delegate_belongs_to.rb'
|
- 'lib/spree/core/delegate_belongs_to.rb'
|
||||||
- 'spec/support/request/web_helper.rb'
|
- 'spec/support/request/web_helper.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowSafeAssignment, AllowInMultilineConditions.
|
|
||||||
Style/ParenthesesAroundCondition:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/system/support/precompile_assets.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
@@ -1209,11 +1060,12 @@ Style/PreferredHashMethods:
|
|||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
Style/RedundantRegexpEscape:
|
# Configuration parameters: AllowMultipleReturnValues.
|
||||||
|
Style/RedundantReturn:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/spree/order.rb'
|
- 'app/controllers/spree/admin/shipping_methods_controller.rb'
|
||||||
|
|
||||||
# Offense count: 206
|
# Offense count: 209
|
||||||
Style/Send:
|
Style/Send:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/split_checkout_controller.rb'
|
- 'app/controllers/split_checkout_controller.rb'
|
||||||
@@ -1237,6 +1089,7 @@ Style/Send:
|
|||||||
- 'spec/models/enterprise_spec.rb'
|
- 'spec/models/enterprise_spec.rb'
|
||||||
- 'spec/models/exchange_spec.rb'
|
- 'spec/models/exchange_spec.rb'
|
||||||
- 'spec/models/spree/order_inventory_spec.rb'
|
- 'spec/models/spree/order_inventory_spec.rb'
|
||||||
|
- 'spec/models/spree/order_spec.rb'
|
||||||
- 'spec/models/spree/payment_spec.rb'
|
- 'spec/models/spree/payment_spec.rb'
|
||||||
- 'spec/models/spree/return_authorization_spec.rb'
|
- 'spec/models/spree/return_authorization_spec.rb'
|
||||||
- 'spec/models/tag_rule/filter_order_cycles_spec.rb'
|
- 'spec/models/tag_rule/filter_order_cycles_spec.rb'
|
||||||
|
|||||||
20
Dockerfile
20
Dockerfile
@@ -28,9 +28,8 @@ RUN apt-get update && apt-get install -y \
|
|||||||
gnupg
|
gnupg
|
||||||
|
|
||||||
# Setup ENV variables
|
# Setup ENV variables
|
||||||
ENV PATH /usr/local/src/rbenv/shims:/usr/local/src/rbenv/bin:/usr/local/src/nodenv/shims:/usr/local/src/nodenv/bin:$PATH
|
ENV PATH /usr/local/src/rbenv/shims:/usr/local/src/rbenv/bin:$PATH
|
||||||
ENV RBENV_ROOT /usr/local/src/rbenv
|
ENV RBENV_ROOT /usr/local/src/rbenv
|
||||||
ENV NODENV_ROOT /usr/local/src/nodenv
|
|
||||||
ENV CONFIGURE_OPTS --disable-install-doc
|
ENV CONFIGURE_OPTS --disable-install-doc
|
||||||
ENV BUNDLE_PATH /bundles
|
ENV BUNDLE_PATH /bundles
|
||||||
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so
|
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so
|
||||||
@@ -54,19 +53,10 @@ RUN sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-
|
|||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -yqq --no-install-recommends postgresql-client-10 libpq-dev
|
apt-get install -yqq --no-install-recommends postgresql-client-10 libpq-dev
|
||||||
|
|
||||||
|
# Install NodeJs and yarn
|
||||||
# trim spaces and line return from .node-version file
|
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
|
||||||
COPY .node-version .node-version.raw
|
&& apt-get install --no-install-recommends -y nodejs \
|
||||||
RUN cat .node-version.raw | tr -d '\r\t ' > .node-version
|
&& npm install -g yarn
|
||||||
|
|
||||||
# Install Node and Yarn with Nodenv
|
|
||||||
RUN git clone --depth 1 https://github.com/nodenv/nodenv.git ${NODENV_ROOT} && \
|
|
||||||
git clone --depth 1 https://github.com/nodenv/node-build.git ${NODENV_ROOT}/plugins/node-build && \
|
|
||||||
git clone --depth 1 https://github.com/pine/nodenv-yarn-install.git ${NODENV_ROOT}/plugins/nodenv-yarn-install && \
|
|
||||||
git clone --depth 1 https://github.com/nodenv/nodenv-package-rehash.git ${NODENV_ROOT}/plugins/nodenv-package-rehash && \
|
|
||||||
echo 'eval "$(nodenv init -)"' >> /etc/profile.d/nodenv.sh && \
|
|
||||||
nodenv install $(cat .node-version) && \
|
|
||||||
nodenv global $(cat .node-version)
|
|
||||||
|
|
||||||
# Install Chrome
|
# Install Chrome
|
||||||
RUN wget --quiet -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
|
RUN wget --quiet -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
|
||||||
|
|||||||
@@ -48,14 +48,14 @@ Fetch the latest version of `master` from `upstream` (ie. the main repo):
|
|||||||
First, you need to create the database user the app will use by manually typing the following in your terminal:
|
First, you need to create the database user the app will use by manually typing the following in your terminal:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo --login --user=postgres psql -c "CREATE USER ofn WITH SUPERUSER CREATEDB PASSWORD 'f00d'"
|
$ sudo -u postgres psql -c "CREATE USER ofn WITH SUPERUSER CREATEDB PASSWORD 'f00d'"
|
||||||
```
|
```
|
||||||
|
|
||||||
This will create the "ofn" user as superuser and allowing it to create databases. If this command fails, check the [troubleshooting section](#creating-the-database) for an alternative.
|
This will create the "ofn" user as superuser and allowing it to create databases. If this command fails, check the [troubleshooting section](#creating-the-database) for an alternative.
|
||||||
|
|
||||||
Next, it is _strongly recommended_ to run the setup script.
|
Next, it is _strongly recommended_ to run the setup script.
|
||||||
```sh
|
```sh
|
||||||
./script/setup
|
$ script/setup
|
||||||
```
|
```
|
||||||
If the script succeeds you're ready to start developing. If not, take a look at the output as it should be informative enough to help you troubleshoot.
|
If the script succeeds you're ready to start developing. If not, take a look at the output as it should be informative enough to help you troubleshoot.
|
||||||
|
|
||||||
@@ -114,13 +114,13 @@ Below are fixes to potential issues that can happen during the installation proc
|
|||||||
|
|
||||||
#### Creating the database
|
#### Creating the database
|
||||||
|
|
||||||
If the `sudo -u postgres psql -c "CREATE USER ofn WITH SUPERUSER CREATEDB PASSWORD 'f00d'"` command doesn't work, you can run the following commands instead:
|
If the ```$ sudo -u postgres psql -c "CREATE USER ofn WITH SUPERUSER CREATEDB PASSWORD 'f00d'"``` command doesn't work, you can run the following commands instead:
|
||||||
```
|
```
|
||||||
createuser --superuser --pwprompt ofn
|
$ createuser --superuser --pwprompt ofn
|
||||||
# Enter password for new role: f00d
|
Enter password for new role: f00d
|
||||||
# Enter it again: f00d
|
Enter it again: f00d
|
||||||
createdb open_food_network_dev --owner=ofn
|
$ createdb open_food_network_dev --owner=ofn
|
||||||
createdb open_food_network_test --owner=ofn
|
$ createdb open_food_network_test --owner=ofn
|
||||||
```
|
```
|
||||||
If these commands succeed, you should be able to [continue the setup process](#get-it-running).
|
If these commands succeed, you should be able to [continue the setup process](#get-it-running).
|
||||||
|
|
||||||
|
|||||||
11
Gemfile
11
Gemfile
@@ -6,7 +6,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
|
|||||||
|
|
||||||
gem 'dotenv-rails', require: 'dotenv/rails-now' # Load ENV vars before other gems
|
gem 'dotenv-rails', require: 'dotenv/rails-now' # Load ENV vars before other gems
|
||||||
|
|
||||||
gem 'rails'
|
gem 'rails', '>= 6.1.4'
|
||||||
|
|
||||||
# Active Storage
|
# Active Storage
|
||||||
gem "active_storage_validations"
|
gem "active_storage_validations"
|
||||||
@@ -27,7 +27,7 @@ gem 'rails-i18n'
|
|||||||
gem 'rails_safe_tasks', '~> 1.0'
|
gem 'rails_safe_tasks', '~> 1.0'
|
||||||
|
|
||||||
gem "activerecord-import"
|
gem "activerecord-import"
|
||||||
gem "db2fog", github: "openfoodfoundation/db2fog", branch: "rails-7"
|
gem "db2fog", github: "openfoodfoundation/db2fog", branch: "rails-6"
|
||||||
gem "fog-aws", "~> 2.0" # db2fog does not support v3
|
gem "fog-aws", "~> 2.0" # db2fog does not support v3
|
||||||
gem "mime-types" # required by fog
|
gem "mime-types" # required by fog
|
||||||
|
|
||||||
@@ -100,8 +100,8 @@ gem 'redis', '>= 4.0', require: ['redis', 'redis/connection/hiredis']
|
|||||||
gem 'sidekiq'
|
gem 'sidekiq'
|
||||||
gem 'sidekiq-scheduler'
|
gem 'sidekiq-scheduler'
|
||||||
|
|
||||||
gem "cable_ready", "5.0.0.rc2"
|
gem "cable_ready", "5.0.0.pre9"
|
||||||
gem "stimulus_reflex", "3.5.0.rc2"
|
gem "stimulus_reflex", "3.5.0.pre9"
|
||||||
|
|
||||||
gem 'combine_pdf'
|
gem 'combine_pdf'
|
||||||
gem 'wicked_pdf'
|
gem 'wicked_pdf'
|
||||||
@@ -136,9 +136,6 @@ gem 'view_component_reflex', '3.1.14.pre9'
|
|||||||
|
|
||||||
gem 'mini_portile2', '~> 2.8'
|
gem 'mini_portile2', '~> 2.8'
|
||||||
|
|
||||||
gem "faraday"
|
|
||||||
gem "private_address_check"
|
|
||||||
|
|
||||||
group :production, :staging do
|
group :production, :staging do
|
||||||
gem 'ddtrace'
|
gem 'ddtrace'
|
||||||
gem 'rack-timeout'
|
gem 'rack-timeout'
|
||||||
|
|||||||
238
Gemfile.lock
238
Gemfile.lock
@@ -1,12 +1,12 @@
|
|||||||
GIT
|
GIT
|
||||||
remote: https://github.com/openfoodfoundation/db2fog.git
|
remote: https://github.com/openfoodfoundation/db2fog.git
|
||||||
revision: 6e88c0ab9eeb23d7ad9964b27becb1c04a83141f
|
revision: 5b63343847452f52aa42f7fc169d6ab3af57cda3
|
||||||
branch: rails-7
|
branch: rails-6
|
||||||
specs:
|
specs:
|
||||||
db2fog (0.9.2)
|
db2fog (0.9.2)
|
||||||
activerecord (>= 3.2.0)
|
activerecord (>= 3.2.0, < 7.0)
|
||||||
fog-core (~> 1.0)
|
fog-core (~> 1.0)
|
||||||
rails (>= 3.2.0)
|
rails (>= 3.2.0, < 7.0)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/openfoodfoundation/select2-rails.git
|
remote: https://github.com/openfoodfoundation/select2-rails.git
|
||||||
@@ -44,49 +44,42 @@ GEM
|
|||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
Ascii85 (1.1.0)
|
Ascii85 (1.1.0)
|
||||||
actioncable (7.0.4.3)
|
actioncable (6.1.7.2)
|
||||||
actionpack (= 7.0.4.3)
|
actionpack (= 6.1.7.2)
|
||||||
activesupport (= 7.0.4.3)
|
activesupport (= 6.1.7.2)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (>= 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
actionmailbox (7.0.4.3)
|
actionmailbox (6.1.7.2)
|
||||||
actionpack (= 7.0.4.3)
|
actionpack (= 6.1.7.2)
|
||||||
activejob (= 7.0.4.3)
|
activejob (= 6.1.7.2)
|
||||||
activerecord (= 7.0.4.3)
|
activerecord (= 6.1.7.2)
|
||||||
activestorage (= 7.0.4.3)
|
activestorage (= 6.1.7.2)
|
||||||
activesupport (= 7.0.4.3)
|
activesupport (= 6.1.7.2)
|
||||||
mail (>= 2.7.1)
|
mail (>= 2.7.1)
|
||||||
net-imap
|
actionmailer (6.1.7.2)
|
||||||
net-pop
|
actionpack (= 6.1.7.2)
|
||||||
net-smtp
|
actionview (= 6.1.7.2)
|
||||||
actionmailer (7.0.4.3)
|
activejob (= 6.1.7.2)
|
||||||
actionpack (= 7.0.4.3)
|
activesupport (= 6.1.7.2)
|
||||||
actionview (= 7.0.4.3)
|
|
||||||
activejob (= 7.0.4.3)
|
|
||||||
activesupport (= 7.0.4.3)
|
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
net-imap
|
|
||||||
net-pop
|
|
||||||
net-smtp
|
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (7.0.4.3)
|
actionpack (6.1.7.2)
|
||||||
actionview (= 7.0.4.3)
|
actionview (= 6.1.7.2)
|
||||||
activesupport (= 7.0.4.3)
|
activesupport (= 6.1.7.2)
|
||||||
rack (~> 2.0, >= 2.2.0)
|
rack (~> 2.0, >= 2.0.9)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||||
actionpack-action_caching (1.2.2)
|
actionpack-action_caching (1.2.2)
|
||||||
actionpack (>= 4.0.0)
|
actionpack (>= 4.0.0)
|
||||||
actiontext (7.0.4.3)
|
actiontext (6.1.7.2)
|
||||||
actionpack (= 7.0.4.3)
|
actionpack (= 6.1.7.2)
|
||||||
activerecord (= 7.0.4.3)
|
activerecord (= 6.1.7.2)
|
||||||
activestorage (= 7.0.4.3)
|
activestorage (= 6.1.7.2)
|
||||||
activesupport (= 7.0.4.3)
|
activesupport (= 6.1.7.2)
|
||||||
globalid (>= 0.6.0)
|
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
actionview (7.0.4.3)
|
actionview (6.1.7.2)
|
||||||
activesupport (= 7.0.4.3)
|
activesupport (= 6.1.7.2)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.4)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
@@ -98,19 +91,19 @@ GEM
|
|||||||
activemodel (>= 5.2.0)
|
activemodel (>= 5.2.0)
|
||||||
activestorage (>= 5.2.0)
|
activestorage (>= 5.2.0)
|
||||||
activesupport (>= 5.2.0)
|
activesupport (>= 5.2.0)
|
||||||
activejob (7.0.4.3)
|
activejob (6.1.7.2)
|
||||||
activesupport (= 7.0.4.3)
|
activesupport (= 6.1.7.2)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemerchant (1.123.0)
|
activemerchant (1.123.0)
|
||||||
activesupport (>= 4.2)
|
activesupport (>= 4.2)
|
||||||
builder (>= 2.1.2, < 4.0.0)
|
builder (>= 2.1.2, < 4.0.0)
|
||||||
i18n (>= 0.6.9)
|
i18n (>= 0.6.9)
|
||||||
nokogiri (~> 1.4)
|
nokogiri (~> 1.4)
|
||||||
activemodel (7.0.4.3)
|
activemodel (6.1.7.2)
|
||||||
activesupport (= 7.0.4.3)
|
activesupport (= 6.1.7.2)
|
||||||
activerecord (7.0.4.3)
|
activerecord (6.1.7.2)
|
||||||
activemodel (= 7.0.4.3)
|
activemodel (= 6.1.7.2)
|
||||||
activesupport (= 7.0.4.3)
|
activesupport (= 6.1.7.2)
|
||||||
activerecord-import (1.4.1)
|
activerecord-import (1.4.1)
|
||||||
activerecord (>= 4.2)
|
activerecord (>= 4.2)
|
||||||
activerecord-postgresql-adapter (0.0.1)
|
activerecord-postgresql-adapter (0.0.1)
|
||||||
@@ -121,23 +114,24 @@ GEM
|
|||||||
multi_json (~> 1.11, >= 1.11.2)
|
multi_json (~> 1.11, >= 1.11.2)
|
||||||
rack (>= 2.0.8, < 3)
|
rack (>= 2.0.8, < 3)
|
||||||
railties (>= 5.2.4.1)
|
railties (>= 5.2.4.1)
|
||||||
activestorage (7.0.4.3)
|
activestorage (6.1.7.2)
|
||||||
actionpack (= 7.0.4.3)
|
actionpack (= 6.1.7.2)
|
||||||
activejob (= 7.0.4.3)
|
activejob (= 6.1.7.2)
|
||||||
activerecord (= 7.0.4.3)
|
activerecord (= 6.1.7.2)
|
||||||
activesupport (= 7.0.4.3)
|
activesupport (= 6.1.7.2)
|
||||||
marcel (~> 1.0)
|
marcel (~> 1.0)
|
||||||
mini_mime (>= 1.1.0)
|
mini_mime (>= 1.1.0)
|
||||||
activesupport (7.0.4.3)
|
activesupport (6.1.7.2)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 1.6, < 2)
|
i18n (>= 1.6, < 2)
|
||||||
minitest (>= 5.1)
|
minitest (>= 5.1)
|
||||||
tzinfo (~> 2.0)
|
tzinfo (~> 2.0)
|
||||||
|
zeitwerk (~> 2.3)
|
||||||
acts-as-taggable-on (9.0.1)
|
acts-as-taggable-on (9.0.1)
|
||||||
activerecord (>= 6.0, < 7.1)
|
activerecord (>= 6.0, < 7.1)
|
||||||
acts_as_list (1.0.4)
|
acts_as_list (1.0.4)
|
||||||
activerecord (>= 4.2)
|
activerecord (>= 4.2)
|
||||||
addressable (2.8.2)
|
addressable (2.8.1)
|
||||||
public_suffix (>= 2.0.2, < 6.0)
|
public_suffix (>= 2.0.2, < 6.0)
|
||||||
aes_key_wrap (1.1.0)
|
aes_key_wrap (1.1.0)
|
||||||
afm (0.2.2)
|
afm (0.2.2)
|
||||||
@@ -157,16 +151,16 @@ GEM
|
|||||||
awesome_nested_set (3.5.0)
|
awesome_nested_set (3.5.0)
|
||||||
activerecord (>= 4.0.0, < 7.1)
|
activerecord (>= 4.0.0, < 7.1)
|
||||||
aws-eventstream (1.2.0)
|
aws-eventstream (1.2.0)
|
||||||
aws-partitions (1.739.0)
|
aws-partitions (1.711.0)
|
||||||
aws-sdk-core (3.171.0)
|
aws-sdk-core (3.170.0)
|
||||||
aws-eventstream (~> 1, >= 1.0.2)
|
aws-eventstream (~> 1, >= 1.0.2)
|
||||||
aws-partitions (~> 1, >= 1.651.0)
|
aws-partitions (~> 1, >= 1.651.0)
|
||||||
aws-sigv4 (~> 1.5)
|
aws-sigv4 (~> 1.5)
|
||||||
jmespath (~> 1, >= 1.6.1)
|
jmespath (~> 1, >= 1.6.1)
|
||||||
aws-sdk-kms (1.63.0)
|
aws-sdk-kms (1.62.0)
|
||||||
aws-sdk-core (~> 3, >= 3.165.0)
|
aws-sdk-core (~> 3, >= 3.165.0)
|
||||||
aws-sigv4 (~> 1.1)
|
aws-sigv4 (~> 1.1)
|
||||||
aws-sdk-s3 (1.120.0)
|
aws-sdk-s3 (1.119.1)
|
||||||
aws-sdk-core (~> 3, >= 3.165.0)
|
aws-sdk-core (~> 3, >= 3.165.0)
|
||||||
aws-sdk-kms (~> 1)
|
aws-sdk-kms (~> 1)
|
||||||
aws-sigv4 (~> 1.4)
|
aws-sigv4 (~> 1.4)
|
||||||
@@ -184,14 +178,16 @@ GEM
|
|||||||
bullet (7.0.7)
|
bullet (7.0.7)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
uniform_notifier (~> 1.11)
|
uniform_notifier (~> 1.11)
|
||||||
cable_ready (5.0.0.rc2)
|
cable_ready (5.0.0.pre9)
|
||||||
|
actioncable (>= 5.2)
|
||||||
actionpack (>= 5.2)
|
actionpack (>= 5.2)
|
||||||
actionview (>= 5.2)
|
actionview (>= 5.2)
|
||||||
|
activerecord (>= 5.2)
|
||||||
activesupport (>= 5.2)
|
activesupport (>= 5.2)
|
||||||
railties (>= 5.2)
|
railties (>= 5.2)
|
||||||
thread-local (>= 1.1.0)
|
thread-local (>= 1.1.0)
|
||||||
cancancan (1.15.0)
|
cancancan (1.15.0)
|
||||||
capybara (3.39.0)
|
capybara (3.38.0)
|
||||||
addressable
|
addressable
|
||||||
matrix
|
matrix
|
||||||
mini_mime (>= 0.1.3)
|
mini_mime (>= 0.1.3)
|
||||||
@@ -215,7 +211,7 @@ GEM
|
|||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.12.2)
|
coffee-script-source (1.12.2)
|
||||||
combine_pdf (1.0.23)
|
combine_pdf (1.0.22)
|
||||||
matrix
|
matrix
|
||||||
ruby-rc4 (>= 0.1.5)
|
ruby-rc4 (>= 0.1.5)
|
||||||
concurrent-ruby (1.2.2)
|
concurrent-ruby (1.2.2)
|
||||||
@@ -228,9 +224,9 @@ GEM
|
|||||||
cuprite (0.14.3)
|
cuprite (0.14.3)
|
||||||
capybara (~> 3.0)
|
capybara (~> 3.0)
|
||||||
ferrum (~> 0.13.0)
|
ferrum (~> 0.13.0)
|
||||||
database_cleaner (2.0.2)
|
database_cleaner (2.0.1)
|
||||||
database_cleaner-active_record (>= 2, < 3)
|
database_cleaner-active_record (~> 2.0.0)
|
||||||
database_cleaner-active_record (2.1.0)
|
database_cleaner-active_record (2.0.0)
|
||||||
activerecord (>= 5.a)
|
activerecord (>= 5.a)
|
||||||
database_cleaner-core (~> 2.0.0)
|
database_cleaner-core (~> 2.0.0)
|
||||||
database_cleaner-core (2.0.1)
|
database_cleaner-core (2.0.1)
|
||||||
@@ -241,11 +237,11 @@ GEM
|
|||||||
libddwaf (~> 1.6.2.0.0)
|
libddwaf (~> 1.6.2.0.0)
|
||||||
msgpack
|
msgpack
|
||||||
debase-ruby_core_source (3.2.0)
|
debase-ruby_core_source (3.2.0)
|
||||||
debug (1.7.2)
|
debug (1.7.1)
|
||||||
irb (>= 1.5.0)
|
irb (>= 1.5.0)
|
||||||
reline (>= 0.3.1)
|
reline (>= 0.3.1)
|
||||||
debugger-linecache (1.2.0)
|
debugger-linecache (1.2.0)
|
||||||
devise (4.9.2)
|
devise (4.8.1)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (>= 4.1.0)
|
railties (>= 4.1.0)
|
||||||
@@ -253,8 +249,8 @@ GEM
|
|||||||
warden (~> 1.2.3)
|
warden (~> 1.2.3)
|
||||||
devise-encryptable (0.2.0)
|
devise-encryptable (0.2.0)
|
||||||
devise (>= 2.1.0)
|
devise (>= 2.1.0)
|
||||||
devise-i18n (1.11.0)
|
devise-i18n (1.10.3)
|
||||||
devise (>= 4.9.0)
|
devise (>= 4.8.0)
|
||||||
devise-token_authenticatable (1.1.0)
|
devise-token_authenticatable (1.1.0)
|
||||||
devise (>= 4.0.0, < 5.0.0)
|
devise (>= 4.0.0, < 5.0.0)
|
||||||
diff-lcs (1.5.0)
|
diff-lcs (1.5.0)
|
||||||
@@ -287,17 +283,15 @@ GEM
|
|||||||
websocket-driver (>= 0.6, < 0.8)
|
websocket-driver (>= 0.6, < 0.8)
|
||||||
ffaker (2.21.0)
|
ffaker (2.21.0)
|
||||||
ffi (1.15.5)
|
ffi (1.15.5)
|
||||||
flipper (0.26.2)
|
flipper (0.20.4)
|
||||||
concurrent-ruby (< 2)
|
flipper-active_record (0.20.4)
|
||||||
flipper-active_record (0.26.2)
|
activerecord (>= 5.0, < 7)
|
||||||
activerecord (>= 4.2, < 8)
|
flipper (~> 0.20.4)
|
||||||
flipper (~> 0.26.2)
|
flipper-ui (0.20.4)
|
||||||
flipper-ui (0.26.2)
|
|
||||||
erubi (>= 1.0.0, < 2.0.0)
|
erubi (>= 1.0.0, < 2.0.0)
|
||||||
flipper (~> 0.26.2)
|
flipper (~> 0.20.4)
|
||||||
rack (>= 1.4, < 3)
|
rack (>= 1.4, < 3)
|
||||||
rack-protection (>= 1.5.3, <= 4.0.0)
|
rack-protection (>= 1.5.3, < 2.2.0)
|
||||||
sanitize (< 7)
|
|
||||||
fog-aws (2.0.1)
|
fog-aws (2.0.1)
|
||||||
fog-core (~> 1.38)
|
fog-core (~> 1.38)
|
||||||
fog-json (~> 1.0)
|
fog-json (~> 1.0)
|
||||||
@@ -349,7 +343,7 @@ GEM
|
|||||||
activerecord (>= 3.0)
|
activerecord (>= 3.0)
|
||||||
io-console (0.6.0)
|
io-console (0.6.0)
|
||||||
ipaddress (0.8.3)
|
ipaddress (0.8.3)
|
||||||
irb (1.6.3)
|
irb (1.6.2)
|
||||||
reline (>= 0.3.0)
|
reline (>= 0.3.0)
|
||||||
jmespath (1.6.2)
|
jmespath (1.6.2)
|
||||||
jquery-rails (4.4.0)
|
jquery-rails (4.4.0)
|
||||||
@@ -373,7 +367,7 @@ GEM
|
|||||||
jsonapi-serializer (2.2.0)
|
jsonapi-serializer (2.2.0)
|
||||||
activesupport (>= 4.2)
|
activesupport (>= 4.2)
|
||||||
jwt (2.7.0)
|
jwt (2.7.0)
|
||||||
knapsack_pro (3.9.0)
|
knapsack_pro (3.8.0)
|
||||||
rake
|
rake
|
||||||
launchy (2.5.0)
|
launchy (2.5.0)
|
||||||
addressable (~> 2.7)
|
addressable (~> 2.7)
|
||||||
@@ -386,7 +380,7 @@ GEM
|
|||||||
listen (3.8.0)
|
listen (3.8.0)
|
||||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||||
rb-inotify (~> 0.9, >= 0.9.10)
|
rb-inotify (~> 0.9, >= 0.9.10)
|
||||||
loofah (2.20.0)
|
loofah (2.19.1)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
mail (2.8.1)
|
mail (2.8.1)
|
||||||
@@ -408,7 +402,7 @@ GEM
|
|||||||
mini_portile2 (2.8.1)
|
mini_portile2 (2.8.1)
|
||||||
mini_racer (0.6.3)
|
mini_racer (0.6.3)
|
||||||
libv8-node (~> 16.10.0.0)
|
libv8-node (~> 16.10.0.0)
|
||||||
minitest (5.18.0)
|
minitest (5.17.0)
|
||||||
monetize (1.12.0)
|
monetize (1.12.0)
|
||||||
money (~> 6.12)
|
money (~> 6.12)
|
||||||
money (6.16.0)
|
money (6.16.0)
|
||||||
@@ -465,7 +459,7 @@ GEM
|
|||||||
parallel (1.22.1)
|
parallel (1.22.1)
|
||||||
paranoia (2.6.1)
|
paranoia (2.6.1)
|
||||||
activerecord (>= 5.1, < 7.1)
|
activerecord (>= 5.1, < 7.1)
|
||||||
parser (3.2.2.0)
|
parser (3.2.1.1)
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
paypal-sdk-core (0.3.4)
|
paypal-sdk-core (0.3.4)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
@@ -480,16 +474,15 @@ GEM
|
|||||||
ttfunk
|
ttfunk
|
||||||
pg (1.2.3)
|
pg (1.2.3)
|
||||||
power_assert (2.0.2)
|
power_assert (2.0.2)
|
||||||
private_address_check (0.5.0)
|
|
||||||
pry (0.13.1)
|
pry (0.13.1)
|
||||||
coderay (~> 1.1)
|
coderay (~> 1.1)
|
||||||
method_source (~> 1.0)
|
method_source (~> 1.0)
|
||||||
public_suffix (5.0.1)
|
public_suffix (5.0.1)
|
||||||
puma (6.2.1)
|
puma (6.1.1)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
raabro (1.4.0)
|
raabro (1.4.0)
|
||||||
racc (1.6.2)
|
racc (1.6.2)
|
||||||
rack (2.2.6.4)
|
rack (2.2.6.3)
|
||||||
rack-mini-profiler (2.3.4)
|
rack-mini-profiler (2.3.4)
|
||||||
rack (>= 1.2.0)
|
rack (>= 1.2.0)
|
||||||
rack-oauth2 (1.21.3)
|
rack-oauth2 (1.21.3)
|
||||||
@@ -498,28 +491,29 @@ GEM
|
|||||||
httpclient
|
httpclient
|
||||||
json-jwt (>= 1.11.0)
|
json-jwt (>= 1.11.0)
|
||||||
rack (>= 2.1.0)
|
rack (>= 2.1.0)
|
||||||
rack-protection (3.0.5)
|
rack-protection (2.1.0)
|
||||||
rack
|
rack
|
||||||
rack-proxy (0.7.6)
|
rack-proxy (0.7.6)
|
||||||
rack
|
rack
|
||||||
rack-rewrite (1.5.1)
|
rack-rewrite (1.5.1)
|
||||||
rack-test (2.1.0)
|
rack-test (2.0.2)
|
||||||
rack (>= 1.3)
|
rack (>= 1.3)
|
||||||
rack-timeout (0.6.3)
|
rack-timeout (0.6.3)
|
||||||
rails (7.0.4.3)
|
rails (6.1.7.2)
|
||||||
actioncable (= 7.0.4.3)
|
actioncable (= 6.1.7.2)
|
||||||
actionmailbox (= 7.0.4.3)
|
actionmailbox (= 6.1.7.2)
|
||||||
actionmailer (= 7.0.4.3)
|
actionmailer (= 6.1.7.2)
|
||||||
actionpack (= 7.0.4.3)
|
actionpack (= 6.1.7.2)
|
||||||
actiontext (= 7.0.4.3)
|
actiontext (= 6.1.7.2)
|
||||||
actionview (= 7.0.4.3)
|
actionview (= 6.1.7.2)
|
||||||
activejob (= 7.0.4.3)
|
activejob (= 6.1.7.2)
|
||||||
activemodel (= 7.0.4.3)
|
activemodel (= 6.1.7.2)
|
||||||
activerecord (= 7.0.4.3)
|
activerecord (= 6.1.7.2)
|
||||||
activestorage (= 7.0.4.3)
|
activestorage (= 6.1.7.2)
|
||||||
activesupport (= 7.0.4.3)
|
activesupport (= 6.1.7.2)
|
||||||
bundler (>= 1.15.0)
|
bundler (>= 1.15.0)
|
||||||
railties (= 7.0.4.3)
|
railties (= 6.1.7.2)
|
||||||
|
sprockets-rails (>= 2.0.0)
|
||||||
rails-controller-testing (1.0.5)
|
rails-controller-testing (1.0.5)
|
||||||
actionpack (>= 5.0.1.rc1)
|
actionpack (>= 5.0.1.rc1)
|
||||||
actionview (>= 5.0.1.rc1)
|
actionview (>= 5.0.1.rc1)
|
||||||
@@ -538,13 +532,12 @@ GEM
|
|||||||
i18n (>= 0.7, < 2)
|
i18n (>= 0.7, < 2)
|
||||||
railties (>= 6.0.0, < 8)
|
railties (>= 6.0.0, < 8)
|
||||||
rails_safe_tasks (1.0.0)
|
rails_safe_tasks (1.0.0)
|
||||||
railties (7.0.4.3)
|
railties (6.1.7.2)
|
||||||
actionpack (= 7.0.4.3)
|
actionpack (= 6.1.7.2)
|
||||||
activesupport (= 7.0.4.3)
|
activesupport (= 6.1.7.2)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 12.2)
|
rake (>= 12.2)
|
||||||
thor (~> 1.0)
|
thor (~> 1.0)
|
||||||
zeitwerk (~> 2.5)
|
|
||||||
rainbow (3.1.1)
|
rainbow (3.1.1)
|
||||||
rake (13.0.6)
|
rake (13.0.6)
|
||||||
ransack (2.6.0)
|
ransack (2.6.0)
|
||||||
@@ -556,10 +549,10 @@ GEM
|
|||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
redcarpet (3.6.0)
|
redcarpet (3.6.0)
|
||||||
redis (4.8.1)
|
redis (4.8.1)
|
||||||
redis-client (0.14.0)
|
redis-client (0.13.0)
|
||||||
connection_pool
|
connection_pool
|
||||||
regexp_parser (2.7.0)
|
regexp_parser (2.7.0)
|
||||||
reline (0.3.3)
|
reline (0.3.2)
|
||||||
io-console (~> 0.5)
|
io-console (~> 0.5)
|
||||||
request_store (1.5.1)
|
request_store (1.5.1)
|
||||||
rack (>= 1.4)
|
rack (>= 1.4)
|
||||||
@@ -612,17 +605,17 @@ GEM
|
|||||||
rswag-ui (2.8.0)
|
rswag-ui (2.8.0)
|
||||||
actionpack (>= 3.1, < 7.1)
|
actionpack (>= 3.1, < 7.1)
|
||||||
railties (>= 3.1, < 7.1)
|
railties (>= 3.1, < 7.1)
|
||||||
rubocop (1.49.0)
|
rubocop (1.48.1)
|
||||||
json (~> 2.3)
|
json (~> 2.3)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 3.2.0.0)
|
parser (>= 3.2.0.0)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
regexp_parser (>= 1.8, < 3.0)
|
regexp_parser (>= 1.8, < 3.0)
|
||||||
rexml (>= 3.2.5, < 4.0)
|
rexml (>= 3.2.5, < 4.0)
|
||||||
rubocop-ast (>= 1.28.0, < 2.0)
|
rubocop-ast (>= 1.26.0, < 2.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 2.4.0, < 3.0)
|
unicode-display_width (>= 2.4.0, < 3.0)
|
||||||
rubocop-ast (1.28.0)
|
rubocop-ast (1.27.0)
|
||||||
parser (>= 3.2.1.0)
|
parser (>= 3.2.1.0)
|
||||||
rubocop-rails (2.18.0)
|
rubocop-rails (2.18.0)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
@@ -638,9 +631,6 @@ GEM
|
|||||||
rubyzip (2.3.2)
|
rubyzip (2.3.2)
|
||||||
rufus-scheduler (3.8.2)
|
rufus-scheduler (3.8.2)
|
||||||
fugit (~> 1.1, >= 1.1.6)
|
fugit (~> 1.1, >= 1.1.6)
|
||||||
sanitize (6.0.1)
|
|
||||||
crass (~> 1.0.2)
|
|
||||||
nokogiri (>= 1.12.0)
|
|
||||||
sass (3.4.25)
|
sass (3.4.25)
|
||||||
sass-rails (5.0.8)
|
sass-rails (5.0.8)
|
||||||
railties (>= 5.2.0)
|
railties (>= 5.2.0)
|
||||||
@@ -652,7 +642,7 @@ GEM
|
|||||||
semantic_range (3.0.0)
|
semantic_range (3.0.0)
|
||||||
shoulda-matchers (5.3.0)
|
shoulda-matchers (5.3.0)
|
||||||
activesupport (>= 5.2.0)
|
activesupport (>= 5.2.0)
|
||||||
sidekiq (7.0.7)
|
sidekiq (7.0.6)
|
||||||
concurrent-ruby (< 2)
|
concurrent-ruby (< 2)
|
||||||
connection_pool (>= 2.3.0)
|
connection_pool (>= 2.3.0)
|
||||||
rack (>= 2.2.4)
|
rack (>= 2.2.4)
|
||||||
@@ -687,16 +677,16 @@ GEM
|
|||||||
state_machines-activerecord (0.8.0)
|
state_machines-activerecord (0.8.0)
|
||||||
activerecord (>= 5.1)
|
activerecord (>= 5.1)
|
||||||
state_machines-activemodel (>= 0.8.0)
|
state_machines-activemodel (>= 0.8.0)
|
||||||
stimulus_reflex (3.5.0.rc2)
|
stimulus_reflex (3.5.0.pre9)
|
||||||
actioncable (>= 5.2, < 8)
|
actioncable (>= 5.2)
|
||||||
actionpack (>= 5.2, < 8)
|
actionpack (>= 5.2)
|
||||||
actionview (>= 5.2, < 8)
|
actionview (>= 5.2)
|
||||||
activesupport (>= 5.2, < 8)
|
activesupport (>= 5.2)
|
||||||
cable_ready (>= 5.0.0.rc2)
|
cable_ready (>= 5.0.0.pre9)
|
||||||
nokogiri (~> 1.0)
|
nokogiri
|
||||||
rack (>= 2, < 4)
|
rack
|
||||||
railties (>= 5.2, < 8)
|
railties (>= 5.2)
|
||||||
redis (>= 4.0, < 6.0)
|
redis
|
||||||
stringex (2.8.5)
|
stringex (2.8.5)
|
||||||
stripe (8.3.0)
|
stripe (8.3.0)
|
||||||
swd (1.3.0)
|
swd (1.3.0)
|
||||||
@@ -716,7 +706,7 @@ GEM
|
|||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
unicode-display_width (2.4.2)
|
unicode-display_width (2.4.2)
|
||||||
uniform_notifier (1.16.0)
|
uniform_notifier (1.16.0)
|
||||||
valid_email2 (4.0.6)
|
valid_email2 (4.0.5)
|
||||||
activemodel (>= 3.2)
|
activemodel (>= 3.2)
|
||||||
mail (~> 2.5)
|
mail (~> 2.5)
|
||||||
validate_email (0.1.6)
|
validate_email (0.1.6)
|
||||||
@@ -791,7 +781,7 @@ DEPENDENCIES
|
|||||||
bootsnap
|
bootsnap
|
||||||
bugsnag
|
bugsnag
|
||||||
bullet
|
bullet
|
||||||
cable_ready (= 5.0.0.rc2)
|
cable_ready (= 5.0.0.pre9)
|
||||||
cancancan (~> 1.15.0)
|
cancancan (~> 1.15.0)
|
||||||
capybara
|
capybara
|
||||||
catalog!
|
catalog!
|
||||||
@@ -811,7 +801,6 @@ DEPENDENCIES
|
|||||||
digest
|
digest
|
||||||
dotenv-rails
|
dotenv-rails
|
||||||
factory_bot_rails (= 6.2.0)
|
factory_bot_rails (= 6.2.0)
|
||||||
faraday
|
|
||||||
ffaker
|
ffaker
|
||||||
flipper
|
flipper
|
||||||
flipper-active_record
|
flipper-active_record
|
||||||
@@ -854,13 +843,12 @@ DEPENDENCIES
|
|||||||
paypal-sdk-merchant (= 1.117.2)
|
paypal-sdk-merchant (= 1.117.2)
|
||||||
pdf-reader
|
pdf-reader
|
||||||
pg (~> 1.2.3)
|
pg (~> 1.2.3)
|
||||||
private_address_check
|
|
||||||
pry (~> 0.13.0)
|
pry (~> 0.13.0)
|
||||||
puma
|
puma
|
||||||
rack-mini-profiler (< 3.0.0)
|
rack-mini-profiler (< 3.0.0)
|
||||||
rack-rewrite
|
rack-rewrite
|
||||||
rack-timeout
|
rack-timeout
|
||||||
rails
|
rails (>= 6.1.4)
|
||||||
rails-controller-testing
|
rails-controller-testing
|
||||||
rails-erd
|
rails-erd
|
||||||
rails-i18n
|
rails-i18n
|
||||||
@@ -889,7 +877,7 @@ DEPENDENCIES
|
|||||||
spring
|
spring
|
||||||
spring-commands-rspec
|
spring-commands-rspec
|
||||||
state_machines-activerecord
|
state_machines-activerecord
|
||||||
stimulus_reflex (= 3.5.0.rc2)
|
stimulus_reflex (= 3.5.0.pre9)
|
||||||
stringex (~> 2.8.5)
|
stringex (~> 2.8.5)
|
||||||
stripe
|
stripe
|
||||||
test-unit (~> 3.5)
|
test-unit (~> 3.5)
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ angular.module("admin.enterprises")
|
|||||||
$scope.removePromoImage = ->
|
$scope.removePromoImage = ->
|
||||||
$scope.performEnterpriseAction("removePromoImage", "immediate_promo_image_removal_warning", "removed_promo_image_successfully")
|
$scope.performEnterpriseAction("removePromoImage", "immediate_promo_image_removal_warning", "removed_promo_image_successfully")
|
||||||
|
|
||||||
|
$scope.removeTermsAndConditions = ->
|
||||||
|
$scope.performEnterpriseAction("removeTermsAndConditions", "immediate_terms_and_conditions_removal_warning", "removed_terms_and_conditions_successfully")
|
||||||
|
|
||||||
$scope.performEnterpriseAction = (enterpriseActionName, warning_message_key, success_message_key) ->
|
$scope.performEnterpriseAction = (enterpriseActionName, warning_message_key, success_message_key) ->
|
||||||
return unless confirm($scope.translation(warning_message_key))
|
return unless confirm($scope.translation(warning_message_key))
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
angular.module("admin.enterprises").directive 'termsAndConditionsWarning', ($rootScope, $compile, $templateCache, DialogDefaults, $timeout) ->
|
||||||
|
restrict: 'A'
|
||||||
|
scope: true
|
||||||
|
|
||||||
|
link: (scope, element, attr) ->
|
||||||
|
# This file input click handler will hold the browser file input dialog and show a warning modal
|
||||||
|
scope.hold_file_input_and_show_warning_modal = (event) ->
|
||||||
|
event.preventDefault()
|
||||||
|
scope.template = $compile($templateCache.get('admin/modals/terms_and_conditions_warning.html'))(scope)
|
||||||
|
if scope.template.dialog
|
||||||
|
scope.template.dialog(DialogDefaults)
|
||||||
|
scope.template.dialog('open')
|
||||||
|
$rootScope.$evalAsync()
|
||||||
|
|
||||||
|
element.bind 'click', scope.hold_file_input_and_show_warning_modal
|
||||||
|
|
||||||
|
# When the user presses continue in the warning modal, we open the browser file input dialog
|
||||||
|
scope.continue = ->
|
||||||
|
scope.template.dialog('close')
|
||||||
|
$rootScope.$evalAsync()
|
||||||
|
|
||||||
|
# unbind warning modal handler and click file input again to open the browser file input dialog
|
||||||
|
element.unbind('click').trigger('click')
|
||||||
|
# afterwards, bind warning modal handler again so that the warning is shown the next time
|
||||||
|
$timeout ->
|
||||||
|
element.bind 'click', scope.hold_file_input_and_show_warning_modal
|
||||||
|
return
|
||||||
|
|
||||||
|
scope.close = ->
|
||||||
|
scope.template.dialog('close')
|
||||||
|
$rootScope.$evalAsync()
|
||||||
|
return
|
||||||
@@ -17,14 +17,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
|||||||
]
|
]
|
||||||
$scope.page = 1
|
$scope.page = 1
|
||||||
$scope.per_page = $scope.per_page_options[0].id
|
$scope.per_page = $scope.per_page_options[0].id
|
||||||
searchThrough = ["order_distributor_name",
|
|
||||||
"order_bill_address_phone",
|
|
||||||
"order_bill_address_firstname",
|
|
||||||
"order_bill_address_lastname",
|
|
||||||
"variant_product_supplier_name",
|
|
||||||
"order_email",
|
|
||||||
"order_number",
|
|
||||||
"product_name"].join("_or_") + "_cont"
|
|
||||||
|
|
||||||
$scope.confirmRefresh = ->
|
$scope.confirmRefresh = ->
|
||||||
LineItems.allSaved() || confirm(t("unsaved_changes_warning"))
|
LineItems.allSaved() || confirm(t("unsaved_changes_warning"))
|
||||||
@@ -33,7 +26,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
|||||||
$scope.distributorFilter = ''
|
$scope.distributorFilter = ''
|
||||||
$scope.supplierFilter = ''
|
$scope.supplierFilter = ''
|
||||||
$scope.orderCycleFilter = ''
|
$scope.orderCycleFilter = ''
|
||||||
$scope.query = ''
|
$scope.quickSearch = ''
|
||||||
$scope.startDate = undefined
|
$scope.startDate = undefined
|
||||||
$scope.endDate = undefined
|
$scope.endDate = undefined
|
||||||
event = new CustomEvent('flatpickr:clear')
|
event = new CustomEvent('flatpickr:clear')
|
||||||
@@ -67,7 +60,6 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
|||||||
[formattedStartDate, formattedEndDate] = $scope.formatDates($scope.startDate, $scope.endDate)
|
[formattedStartDate, formattedEndDate] = $scope.formatDates($scope.startDate, $scope.endDate)
|
||||||
|
|
||||||
RequestMonitor.load LineItems.index(
|
RequestMonitor.load LineItems.index(
|
||||||
"q[#{searchThrough}]": $scope.query,
|
|
||||||
"q[order_state_not_eq]": "canceled",
|
"q[order_state_not_eq]": "canceled",
|
||||||
"q[order_shipment_state_not_eq]": "shipped",
|
"q[order_shipment_state_not_eq]": "shipped",
|
||||||
"q[order_completed_at_not_null]": "true",
|
"q[order_completed_at_not_null]": "true",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ angular.module('admin.orderCycles')
|
|||||||
|
|
||||||
$scope.submit = ($event, destination) ->
|
$scope.submit = ($event, destination) ->
|
||||||
$event.preventDefault()
|
$event.preventDefault()
|
||||||
|
NavigationCheck.clear()
|
||||||
StatusMessage.display 'progress', t('js.saving')
|
StatusMessage.display 'progress', t('js.saving')
|
||||||
OrderCycle.update(destination, $scope.order_cycle_form)
|
OrderCycle.update(destination, $scope.order_cycle_form)
|
||||||
|
|
||||||
|
|||||||
@@ -33,11 +33,9 @@ angular.module("admin.orderCycles").controller "OrderCyclesCtrl", ($scope, $q, C
|
|||||||
StatusMessage.display 'notice', "You have unsaved changes" if newVal
|
StatusMessage.display 'notice', "You have unsaved changes" if newVal
|
||||||
|
|
||||||
$scope.showMore = (days) ->
|
$scope.showMore = (days) ->
|
||||||
orderCycles = OrderCycles.index(ams_prefix: "index",
|
|
||||||
"q[orders_close_at_gt]": "#{daysFromToday($scope.ordersCloseAtLimit - days)}",
|
|
||||||
"q[orders_close_at_lteq]": "#{daysFromToday($scope.ordersCloseAtLimit)}"
|
|
||||||
)
|
|
||||||
$scope.ordersCloseAtLimit -= days
|
$scope.ordersCloseAtLimit -= days
|
||||||
|
existingIDs = Object.keys(OrderCycles.byID)
|
||||||
|
orderCycles = OrderCycles.index(ams_prefix: "index", "q[orders_close_at_gt]": "#{daysFromToday($scope.ordersCloseAtLimit)}", "q[id_not_in][]": existingIDs)
|
||||||
orderCycles.$promise.then ->
|
orderCycles.$promise.then ->
|
||||||
$scope.orderCycles.push(orderCycle) for orderCycle in orderCycles
|
$scope.orderCycles.push(orderCycle) for orderCycle in orderCycles
|
||||||
compileData()
|
compileData()
|
||||||
|
|||||||
@@ -14,4 +14,7 @@ angular.module("admin.resources").factory 'EnterpriseResource', ($resource) ->
|
|||||||
'removePromoImage':
|
'removePromoImage':
|
||||||
url: '/api/v0/enterprises/:id/promo_image.json'
|
url: '/api/v0/enterprises/:id/promo_image.json'
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
|
'removeTermsAndConditions':
|
||||||
|
url: '/api/v0/enterprises/:id/terms_and_conditions.json'
|
||||||
|
method: 'DELETE'
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -63,3 +63,4 @@ angular.module("admin.resources").factory 'Enterprises', ($q, $filter, Enterpris
|
|||||||
|
|
||||||
removeLogo: performActionOnEnterpriseResource(EnterpriseResource.removeLogo)
|
removeLogo: performActionOnEnterpriseResource(EnterpriseResource.removeLogo)
|
||||||
removePromoImage: performActionOnEnterpriseResource(EnterpriseResource.removePromoImage)
|
removePromoImage: performActionOnEnterpriseResource(EnterpriseResource.removePromoImage)
|
||||||
|
removeTermsAndConditions: performActionOnEnterpriseResource(EnterpriseResource.removeTermsAndConditions)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ handle_move = (e, data) ->
|
|||||||
node = data.rslt.o
|
node = data.rslt.o
|
||||||
new_parent = data.rslt.np
|
new_parent = data.rslt.np
|
||||||
|
|
||||||
url = new URL(Spree.routes.admin_taxonomy_taxons)
|
url = new URL(base_url)
|
||||||
url.pathname = url.pathname + '/' + node.attr("id")
|
url.pathname = url.pathname + '/' + node.attr("id")
|
||||||
data = {
|
data = {
|
||||||
_method: "put",
|
_method: "put",
|
||||||
|
|||||||
@@ -55,10 +55,6 @@ angular.module('Darkswarm').factory "EnterpriseRegistrationService", ($http, Reg
|
|||||||
).catch((response) ->
|
).catch((response) ->
|
||||||
Loading.clear()
|
Loading.clear()
|
||||||
alert(t('failed_to_update_enterprise_unknown'))
|
alert(t('failed_to_update_enterprise_unknown'))
|
||||||
if response.data.errors.instagram
|
|
||||||
igErr = document.querySelector("#instagram-error")
|
|
||||||
igErr.style.display = 'block'
|
|
||||||
igErr.textContent = response.data.errors.instagram[0]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
prepare: =>
|
prepare: =>
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
%div
|
||||||
|
.margin-bottom-30.text-center
|
||||||
|
.text-big
|
||||||
|
{{ 'js.admin.modals.terms_and_conditions_warning.title' | t }}
|
||||||
|
.margin-bottom-30
|
||||||
|
%p
|
||||||
|
{{ 'js.admin.modals.terms_and_conditions_warning.message_1' | t }}
|
||||||
|
.margin-bottom-30
|
||||||
|
%p
|
||||||
|
{{ 'js.admin.modals.terms_and_conditions_warning.message_2' | t }}
|
||||||
|
|
||||||
|
.text-center
|
||||||
|
%input.button.red{ type: 'button', value: t('js.admin.modals.close'), ng: { click: 'close()' } }
|
||||||
|
%input.button.red{ type: 'button', value: t('js.admin.modals.continue'), ng: { click: 'continue()' } }
|
||||||
@@ -67,7 +67,7 @@ module Admin
|
|||||||
|
|
||||||
def collection
|
def collection
|
||||||
if json_request? && params[:enterprise_id].present?
|
if json_request? && params[:enterprise_id].present?
|
||||||
CustomersWithBalance.new(Customer.of(managed_enterprise_id)).query.
|
CustomersWithBalance.new(managed_enterprise_id).query.
|
||||||
includes(
|
includes(
|
||||||
:enterprise,
|
:enterprise,
|
||||||
{ bill_address: [:state, :country] },
|
{ bill_address: [:state, :country] },
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ module Admin
|
|||||||
if params[:stimulus]
|
if params[:stimulus]
|
||||||
@enterprise.is_primary_producer = params[:is_primary_producer]
|
@enterprise.is_primary_producer = params[:is_primary_producer]
|
||||||
@enterprise.sells = params[:enterprise_sells]
|
@enterprise.sells = params[:enterprise_sells]
|
||||||
render cable_ready: cable_car.morph("#side_menu", partial("admin/shared/side_menu"))
|
render operations: cable_car.morph("#side_menu", partial("admin/shared/side_menu"))
|
||||||
.morph("#permalink", partial("admin/enterprises/form/permalink"))
|
.morph("#permalink", partial("admin/enterprises/form/permalink"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -55,10 +55,11 @@ module Admin
|
|||||||
|
|
||||||
def render_report_as(format)
|
def render_report_as(format)
|
||||||
if OpenFoodNetwork::FeatureToggle.enabled?(:background_reports, spree_current_user)
|
if OpenFoodNetwork::FeatureToggle.enabled?(:background_reports, spree_current_user)
|
||||||
job = ReportJob.perform_later(
|
job = ReportJob.new
|
||||||
|
JobProcessor.perform_forked(
|
||||||
|
job,
|
||||||
report_class, spree_current_user, params, format
|
report_class, spree_current_user, params, format
|
||||||
)
|
)
|
||||||
sleep 1 until job.done?
|
|
||||||
|
|
||||||
# This result has been rendered by Rails in safe mode already.
|
# This result has been rendered by Rails in safe mode already.
|
||||||
job.result.html_safe # rubocop:disable Rails/OutputSafety
|
job.result.html_safe # rubocop:disable Rails/OutputSafety
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ module Admin
|
|||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
if view_context.subscriptions_setup_complete?(@shops)
|
if view_context.subscriptions_setup_complete?(@shops)
|
||||||
@order_cycles = OrderCycle.joins(:schedules).managed_by(spree_current_user)
|
@order_cycles = OrderCycle.joins(:schedules).managed_by(spree_current_user).includes([:distributors, :cached_incoming_exchanges])
|
||||||
.includes([:distributors, :cached_incoming_exchanges])
|
|
||||||
@payment_methods = Spree::PaymentMethod.managed_by(spree_current_user).includes(:taggings)
|
@payment_methods = Spree::PaymentMethod.managed_by(spree_current_user).includes(:taggings)
|
||||||
@payment_method_tags = payment_method_tags_by_id
|
@payment_method_tags = payment_method_tags_by_id
|
||||||
@shipping_methods = Spree::ShippingMethod.managed_by(spree_current_user)
|
@shipping_methods = Spree::ShippingMethod.managed_by(spree_current_user)
|
||||||
@@ -26,10 +25,7 @@ module Admin
|
|||||||
render :setup_explanation
|
render :setup_explanation
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
format.json {
|
format.json { render_as_json @collection, ams_prefix: params[:ams_prefix], payment_method_tags: payment_method_tags_by_id }
|
||||||
render_as_json @collection, ams_prefix: params[:ams_prefix],
|
|
||||||
payment_method_tags: payment_method_tags_by_id
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Admin
|
|
||||||
class VouchersController < ResourceController
|
|
||||||
before_action :load_enterprise
|
|
||||||
|
|
||||||
def new
|
|
||||||
@voucher = Voucher.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
voucher_params = permitted_resource_params.merge(enterprise: @enterprise)
|
|
||||||
@voucher = Voucher.create(voucher_params)
|
|
||||||
|
|
||||||
if @voucher.save
|
|
||||||
redirect_to(
|
|
||||||
"#{edit_admin_enterprise_path(@enterprise)}#vouchers_panel",
|
|
||||||
flash: { success: flash_message_for(@voucher, :successfully_created) }
|
|
||||||
)
|
|
||||||
else
|
|
||||||
flash[:error] = @voucher.errors.full_messages.to_sentence
|
|
||||||
render :new
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def load_enterprise
|
|
||||||
@enterprise = Enterprise.find_by permalink: params[:enterprise_id]
|
|
||||||
end
|
|
||||||
|
|
||||||
def permitted_resource_params
|
|
||||||
params.require(:voucher).permit(:code)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -106,9 +106,7 @@ module Api
|
|||||||
end
|
end
|
||||||
|
|
||||||
def json_api_error(message, **options)
|
def json_api_error(message, **options)
|
||||||
error_options = options.delete(:error_options) || {}
|
{ errors: [{ detail: message }] }.merge(options)
|
||||||
|
|
||||||
{ errors: [{ detail: message }.merge(error_options)] }.merge(options)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def json_api_invalid(message, errors)
|
def json_api_invalid(message, errors)
|
||||||
|
|||||||
@@ -6,17 +6,11 @@ module Api
|
|||||||
module V1
|
module V1
|
||||||
class CustomersController < Api::V1::BaseController
|
class CustomersController < Api::V1::BaseController
|
||||||
include AddressTransformation
|
include AddressTransformation
|
||||||
include ExtraFields
|
|
||||||
|
|
||||||
skip_authorization_check only: :index
|
skip_authorization_check only: :index
|
||||||
|
|
||||||
before_action :authorize_action, only: [:show, :update, :destroy]
|
before_action :authorize_action, only: [:show, :update, :destroy]
|
||||||
|
|
||||||
# Query parameters
|
|
||||||
before_action only: [:index] do
|
|
||||||
@extra_customer_fields = extra_fields :customer, [:balance]
|
|
||||||
end
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@pagy, customers = pagy(search_customers, pagy_options)
|
@pagy, customers = pagy(search_customers, pagy_options)
|
||||||
|
|
||||||
@@ -57,11 +51,7 @@ module Api
|
|||||||
private
|
private
|
||||||
|
|
||||||
def customer
|
def customer
|
||||||
@customer ||= if action_name == "show"
|
@customer ||= Customer.find(params[:id])
|
||||||
CustomersWithBalance.new(Customer.where(id: params[:id])).query.first!
|
|
||||||
else
|
|
||||||
Customer.find(params[:id])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def authorize_action
|
def authorize_action
|
||||||
@@ -71,11 +61,6 @@ module Api
|
|||||||
def search_customers
|
def search_customers
|
||||||
customers = visible_customers.includes(:bill_address, :ship_address)
|
customers = visible_customers.includes(:bill_address, :ship_address)
|
||||||
customers = customers.where(enterprise_id: params[:enterprise_id]) if params[:enterprise_id]
|
customers = customers.where(enterprise_id: params[:enterprise_id]) if params[:enterprise_id]
|
||||||
|
|
||||||
if @extra_customer_fields.include?(:balance)
|
|
||||||
customers = CustomersWithBalance.new(customers).query
|
|
||||||
end
|
|
||||||
|
|
||||||
customers.ransack(params[:q]).result.order(:id)
|
customers.ransack(params[:q]).result.order(:id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ require 'open_food_network/address_finder'
|
|||||||
class CheckoutController < ::BaseController
|
class CheckoutController < ::BaseController
|
||||||
include OrderStockCheck
|
include OrderStockCheck
|
||||||
include OrderCompletion
|
include OrderCompletion
|
||||||
include WhiteLabel
|
|
||||||
|
|
||||||
layout 'darkswarm'
|
layout 'darkswarm'
|
||||||
|
|
||||||
@@ -28,8 +27,6 @@ class CheckoutController < ::BaseController
|
|||||||
before_action :associate_user
|
before_action :associate_user
|
||||||
before_action :check_authorization
|
before_action :check_authorization
|
||||||
|
|
||||||
before_action :hide_ofn_navigation, only: :edit
|
|
||||||
|
|
||||||
helper 'spree/orders'
|
helper 'spree/orders'
|
||||||
|
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ module CheckoutCallbacks
|
|||||||
prepend_before_action :require_distributor_chosen
|
prepend_before_action :require_distributor_chosen
|
||||||
|
|
||||||
before_action :load_order, :associate_user, :load_saved_addresses, :load_saved_credit_cards
|
before_action :load_order, :associate_user, :load_saved_addresses, :load_saved_credit_cards
|
||||||
before_action :load_shipping_methods, if: -> { params[:step] == "details" }
|
before_action :allowed_shipping_methods, if: -> {
|
||||||
|
params[:step] == "details"
|
||||||
|
}
|
||||||
|
|
||||||
before_action :ensure_order_not_completed
|
before_action :ensure_order_not_completed
|
||||||
before_action :ensure_checkout_allowed
|
before_action :ensure_checkout_allowed
|
||||||
@@ -46,8 +48,22 @@ module CheckoutCallbacks
|
|||||||
@selected_card = nil
|
@selected_card = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_shipping_methods
|
def allowed_shipping_methods
|
||||||
@shipping_methods = available_shipping_methods.sort { |a, b| a.name.casecmp(b.name) }
|
@allowed_shipping_methods ||= sorted_available_shipping_methods.filter(
|
||||||
|
&method(:supports_all_products_shipping_categories?)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def sorted_available_shipping_methods
|
||||||
|
available_shipping_methods.sort { |a, b| a.name.casecmp(b.name) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def supports_all_products_shipping_categories?(shipping_method)
|
||||||
|
(products_shipping_categories - shipping_method.shipping_categories.pluck(:id)).empty?
|
||||||
|
end
|
||||||
|
|
||||||
|
def products_shipping_categories
|
||||||
|
@products_shipping_categories ||= @order.products.pluck(:shipping_category_id).uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
def redirect_to_shop?
|
def redirect_to_shop?
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# To be included in api controllers for handeling query params
|
|
||||||
module ExtraFields
|
|
||||||
extend ActiveSupport::Concern
|
|
||||||
|
|
||||||
def invalid_query_param(name, status, msg)
|
|
||||||
render status: status, json: json_api_error(msg, error_options:
|
|
||||||
{
|
|
||||||
title: I18n.t("api.query_param.error.title"),
|
|
||||||
source: { parameter: name },
|
|
||||||
status: status,
|
|
||||||
code: Rack::Utils::SYMBOL_TO_STATUS_CODE[status]
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
def extra_fields(type, available_fields)
|
|
||||||
fields = params.dig(:extra_fields, type)&.split(',')&.compact&.map(&:to_sym)
|
|
||||||
return [] if fields.blank?
|
|
||||||
|
|
||||||
unknown_fields = fields - available_fields
|
|
||||||
|
|
||||||
if unknown_fields.present?
|
|
||||||
invalid_query_param(
|
|
||||||
"extra_fields[#{type}]", :unprocessable_entity,
|
|
||||||
I18n.t("api.query_param.error.extra_fields", fields: unknown_fields.join(', '))
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
fields
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -9,10 +9,12 @@ module ManagerInvitations
|
|||||||
new_user.reset_password_token = Devise.friendly_token
|
new_user.reset_password_token = Devise.friendly_token
|
||||||
# Same time as used in Devise's lib/devise/models/recoverable.rb.
|
# Same time as used in Devise's lib/devise/models/recoverable.rb.
|
||||||
new_user.reset_password_sent_at = Time.now.utc
|
new_user.reset_password_sent_at = Time.now.utc
|
||||||
if new_user.save
|
new_user.save
|
||||||
enterprise.users << new_user
|
|
||||||
EnterpriseMailer.manager_invitation(enterprise, new_user).deliver_later
|
return new_user unless new_user.valid? # Return early if user is invalid.
|
||||||
end
|
|
||||||
|
enterprise.users << new_user
|
||||||
|
EnterpriseMailer.manager_invitation(@enterprise, new_user).deliver_later
|
||||||
|
|
||||||
new_user
|
new_user
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ module OrderStockCheck
|
|||||||
flash[:info] = I18n.t('order_cycle_closed')
|
flash[:info] = I18n.t('order_cycle_closed')
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.cable_ready {
|
format.cable_ready {
|
||||||
render status: :see_other, cable_ready: cable_car.redirect_to(url: main_app.shop_path)
|
render status: :see_other, operations: cable_car.redirect_to(url: main_app.shop_path)
|
||||||
}
|
}
|
||||||
format.json { render json: { path: main_app.shop_path }, status: :see_other }
|
format.json { render json: { path: main_app.shop_path }, status: :see_other }
|
||||||
format.html { redirect_to main_app.shop_path, status: :see_other }
|
format.html { redirect_to main_app.shop_path, status: :see_other }
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module WhiteLabel
|
|
||||||
extend ActiveSupport::Concern
|
|
||||||
include EnterprisesHelper
|
|
||||||
|
|
||||||
def hide_ofn_navigation(distributor = current_distributor)
|
|
||||||
return false unless OpenFoodNetwork::FeatureToggle.enabled?(:white_label)
|
|
||||||
|
|
||||||
# if the distributor has the hide_ofn_navigation preference set to true
|
|
||||||
# then we should hide the OFN navigation
|
|
||||||
@hide_ofn_navigation = distributor.hide_ofn_navigation
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -7,7 +7,6 @@ class EnterprisesController < BaseController
|
|||||||
helper Spree::ProductsHelper
|
helper Spree::ProductsHelper
|
||||||
include OrderCyclesHelper
|
include OrderCyclesHelper
|
||||||
include SerializerHelper
|
include SerializerHelper
|
||||||
include WhiteLabel
|
|
||||||
|
|
||||||
protect_from_forgery except: :check_permalink
|
protect_from_forgery except: :check_permalink
|
||||||
|
|
||||||
@@ -15,7 +14,6 @@ class EnterprisesController < BaseController
|
|||||||
prepend_before_action :set_order_cycles, :require_distributor_chosen, :reset_order, only: :shop
|
prepend_before_action :set_order_cycles, :require_distributor_chosen, :reset_order, only: :shop
|
||||||
|
|
||||||
before_action :clean_permalink, only: :check_permalink
|
before_action :clean_permalink, only: :check_permalink
|
||||||
before_action :hide_ofn_navigation, only: :shop
|
|
||||||
|
|
||||||
respond_to :js, only: :permalink_checker
|
respond_to :js, only: :permalink_checker
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ class SplitCheckoutController < ::BaseController
|
|||||||
include CheckoutCallbacks
|
include CheckoutCallbacks
|
||||||
include OrderCompletion
|
include OrderCompletion
|
||||||
include CablecarResponses
|
include CablecarResponses
|
||||||
include WhiteLabel
|
|
||||||
|
|
||||||
helper 'terms_and_conditions'
|
helper 'terms_and_conditions'
|
||||||
helper 'checkout'
|
helper 'checkout'
|
||||||
@@ -19,14 +18,13 @@ class SplitCheckoutController < ::BaseController
|
|||||||
helper OrderHelper
|
helper OrderHelper
|
||||||
|
|
||||||
before_action :set_checkout_redirect
|
before_action :set_checkout_redirect
|
||||||
before_action :hide_ofn_navigation, only: [:edit, :update]
|
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
redirect_to_step_based_on_order unless params[:step]
|
redirect_to_step_based_on_order unless params[:step]
|
||||||
check_step if params[:step]
|
check_step if params[:step]
|
||||||
recalculate_tax if params[:step] == "summary"
|
recalculate_tax if params[:step] == "summary"
|
||||||
|
|
||||||
flash_error_when_no_shipping_method_available if available_shipping_methods.none?
|
flash_error_when_no_shipping_method_available if allowed_shipping_methods.none?
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@@ -43,7 +41,7 @@ class SplitCheckoutController < ::BaseController
|
|||||||
rescue Spree::Core::GatewayError => e
|
rescue Spree::Core::GatewayError => e
|
||||||
flash[:error] = I18n.t(:spree_gateway_error_flash_for_checkout, error: e.message)
|
flash[:error] = I18n.t(:spree_gateway_error_flash_for_checkout, error: e.message)
|
||||||
@order.update_column(:state, "payment")
|
@order.update_column(:state, "payment")
|
||||||
render cable_ready: cable_car.redirect_to(url: checkout_step_path(:payment))
|
render operations: cable_car.redirect_to(url: checkout_step_path(:payment))
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -54,7 +52,7 @@ class SplitCheckoutController < ::BaseController
|
|||||||
messages: order_error_messages
|
messages: order_error_messages
|
||||||
)
|
)
|
||||||
|
|
||||||
render status: :unprocessable_entity, cable_ready: cable_car.
|
render status: :unprocessable_entity, operations: cable_car.
|
||||||
replace("#checkout", partial("split_checkout/checkout")).
|
replace("#checkout", partial("split_checkout/checkout")).
|
||||||
replace("#flashes", partial("shared/flashes", locals: { flashes: flash }))
|
replace("#flashes", partial("shared/flashes", locals: { flashes: flash }))
|
||||||
end
|
end
|
||||||
@@ -132,7 +130,7 @@ class SplitCheckoutController < ::BaseController
|
|||||||
return unless selected_payment_method&.external_gateway?
|
return unless selected_payment_method&.external_gateway?
|
||||||
return unless (redirect_url = selected_payment_method.external_payment_url(order: @order))
|
return unless (redirect_url = selected_payment_method.external_payment_url(order: @order))
|
||||||
|
|
||||||
render cable_ready: cable_car.redirect_to(url: redirect_url)
|
render operations: cable_car.redirect_to(url: redirect_url)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -170,7 +168,7 @@ class SplitCheckoutController < ::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def shipping_method_ship_address_not_required?
|
def shipping_method_ship_address_not_required?
|
||||||
selected_shipping_method = available_shipping_methods&.select do |sm|
|
selected_shipping_method = allowed_shipping_methods&.select do |sm|
|
||||||
sm.id.to_s == params[:shipping_method_id]
|
sm.id.to_s == params[:shipping_method_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ module Spree
|
|||||||
|
|
||||||
def collection
|
def collection
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
params[:q][:s] ||= "name asc"
|
params[:q][:s] ||= "ascend_by_name"
|
||||||
@search = super.ransack(params[:q])
|
@search = super.ransack(params[:q])
|
||||||
@pagy, @zones = pagy(@search.result, items: Spree::Config[:orders_per_page])
|
@pagy, @zones = pagy(@search.result, items: Spree::Config[:orders_per_page])
|
||||||
@zones
|
@zones
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ module Spree
|
|||||||
include OrderCyclesHelper
|
include OrderCyclesHelper
|
||||||
include Rails.application.routes.url_helpers
|
include Rails.application.routes.url_helpers
|
||||||
include CablecarResponses
|
include CablecarResponses
|
||||||
include WhiteLabel
|
|
||||||
|
|
||||||
layout 'darkswarm'
|
layout 'darkswarm'
|
||||||
|
|
||||||
@@ -15,8 +14,7 @@ module Spree
|
|||||||
respond_to :html, :json
|
respond_to :html, :json
|
||||||
|
|
||||||
before_action :check_authorization
|
before_action :check_authorization
|
||||||
before_action :set_order_from_params, only: :show
|
before_action :set_current_order, only: :update
|
||||||
before_action :set_current_order, only: [:edit, :update]
|
|
||||||
before_action :filter_order_params, only: :update
|
before_action :filter_order_params, only: :update
|
||||||
|
|
||||||
prepend_before_action :require_order_authentication, only: :show
|
prepend_before_action :require_order_authentication, only: :show
|
||||||
@@ -25,12 +23,10 @@ module Spree
|
|||||||
before_action :check_hub_ready_for_checkout, only: :edit
|
before_action :check_hub_ready_for_checkout, only: :edit
|
||||||
before_action :check_at_least_one_line_item, only: :update
|
before_action :check_at_least_one_line_item, only: :update
|
||||||
|
|
||||||
before_action only: [:show, :edit] do
|
def show
|
||||||
hide_ofn_navigation(@order.distributor)
|
@order = Spree::Order.find_by!(number: params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def show; end
|
|
||||||
|
|
||||||
def empty
|
def empty
|
||||||
if @order = current_order
|
if @order = current_order
|
||||||
@order.empty!
|
@order.empty!
|
||||||
@@ -41,6 +37,7 @@ module Spree
|
|||||||
|
|
||||||
# Patching to redirect to shop if order is empty
|
# Patching to redirect to shop if order is empty
|
||||||
def edit
|
def edit
|
||||||
|
@order = current_order(true)
|
||||||
@insufficient_stock_lines = @order.insufficient_stock_lines
|
@insufficient_stock_lines = @order.insufficient_stock_lines
|
||||||
@unavailable_order_variants = OrderCycleDistributedVariants.
|
@unavailable_order_variants = OrderCycleDistributedVariants.
|
||||||
new(current_order_cycle, current_distributor).unavailable_order_variants(@order)
|
new(current_order_cycle, current_distributor).unavailable_order_variants(@order)
|
||||||
@@ -104,15 +101,11 @@ module Spree
|
|||||||
flash[:error] = I18n.t(:orders_could_not_cancel)
|
flash[:error] = I18n.t(:orders_could_not_cancel)
|
||||||
end
|
end
|
||||||
render status: :found,
|
render status: :found,
|
||||||
cable_ready: cable_car.redirect_to(url: request.referer || main_app.order_path(@order))
|
operations: cable_car.redirect_to(url: request.referer || main_app.order_path(@order))
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_order_from_params
|
|
||||||
@order = Spree::Order.find_by!(number: params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_current_order
|
def set_current_order
|
||||||
@order = current_order(true)
|
@order = current_order(true)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ module Spree
|
|||||||
if spree_user_signed_in?
|
if spree_user_signed_in?
|
||||||
flash[:success] = t('devise.success.logged_in_succesfully')
|
flash[:success] = t('devise.success.logged_in_succesfully')
|
||||||
|
|
||||||
render cable_ready: cable_car.redirect_to(
|
render operations: cable_car.redirect_to(
|
||||||
url: return_url_or_default(after_sign_in_path_for(spree_current_user))
|
url: return_url_or_default(after_sign_in_path_for(spree_current_user))
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
render status: :unauthorized, cable_ready: cable_car.inner_html(
|
render status: :unauthorized, operations: cable_car.inner_html(
|
||||||
"#login-feedback",
|
"#login-feedback",
|
||||||
partial("layouts/alert", locals: { type: "alert", message: t('devise.failure.invalid') })
|
partial("layouts/alert", locals: { type: "alert", message: t('devise.failure.invalid') })
|
||||||
)
|
)
|
||||||
@@ -60,7 +60,7 @@ module Spree
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render_unconfirmed_response
|
def render_unconfirmed_response
|
||||||
render status: :unprocessable_entity, cable_ready: cable_car.inner_html(
|
render status: :unprocessable_entity, operations: cable_car.inner_html(
|
||||||
"#login-feedback",
|
"#login-feedback",
|
||||||
partial("layouts/alert", locals: { type: "alert", message: t(:email_unconfirmed),
|
partial("layouts/alert", locals: { type: "alert", message: t(:email_unconfirmed),
|
||||||
unconfirmed: true, tab: "login" })
|
unconfirmed: true, tab: "login" })
|
||||||
|
|||||||
@@ -30,11 +30,10 @@ module Spree
|
|||||||
registered = Spree::User.find_by(email: params[:email]).present?
|
registered = Spree::User.find_by(email: params[:email]).present?
|
||||||
|
|
||||||
if registered
|
if registered
|
||||||
render status: :ok, cable_ready: cable_car.
|
render status: :ok, operations: cable_car.
|
||||||
inner_html(
|
inner_html(
|
||||||
"#login-feedback",
|
"#login-feedback",
|
||||||
partial("layouts/alert",
|
partial("layouts/alert", locals: { type: "alert", message: t('devise.failure.already_registered') })
|
||||||
locals: { type: "alert", message: t('devise.failure.already_registered') })
|
|
||||||
).
|
).
|
||||||
dispatch_event(name: "login:modal:open")
|
dispatch_event(name: "login:modal:open")
|
||||||
else
|
else
|
||||||
@@ -46,14 +45,12 @@ module Spree
|
|||||||
@user = Spree::User.new(user_params)
|
@user = Spree::User.new(user_params)
|
||||||
|
|
||||||
if @user.save
|
if @user.save
|
||||||
render cable_ready: cable_car.inner_html(
|
render operations: cable_car.inner_html(
|
||||||
"#signup-feedback",
|
"#signup-feedback",
|
||||||
partial("layouts/alert",
|
partial("layouts/alert", locals: { type: "success", message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') })
|
||||||
locals: { type: "success",
|
|
||||||
message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') })
|
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
render status: :unprocessable_entity, cable_ready: cable_car.morph(
|
render status: :unprocessable_entity, operations: cable_car.morph(
|
||||||
"#signup-tab",
|
"#signup-tab",
|
||||||
partial("layouts/signup_tab", locals: { signup_form_user: @user })
|
partial("layouts/signup_tab", locals: { signup_form_user: @user })
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -22,10 +22,9 @@ class UserConfirmationsController < DeviseController
|
|||||||
set_flash_message(:error, :confirmation_not_sent)
|
set_flash_message(:error, :confirmation_not_sent)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
render cable_ready: cable_car.inner_html(
|
render operations: cable_car.inner_html(
|
||||||
"##{params[:tab] || 'forgot'}-feedback",
|
"##{params[:tab] || 'forgot'}-feedback",
|
||||||
partial("layouts/alert",
|
partial("layouts/alert", locals: { type: "success", message: t("devise.confirmations.send_instructions") })
|
||||||
locals: { type: "success", message: t("devise.confirmations.send_instructions") })
|
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ class UserPasswordsController < Spree::UserPasswordsController
|
|||||||
self.resource = resource_class.send_reset_password_instructions(raw_params[resource_name])
|
self.resource = resource_class.send_reset_password_instructions(raw_params[resource_name])
|
||||||
|
|
||||||
if resource.errors.empty?
|
if resource.errors.empty?
|
||||||
render cable_ready: cable_car.inner_html(
|
render operations: cable_car.inner_html(
|
||||||
"#forgot-feedback",
|
"#forgot-feedback",
|
||||||
partial("layouts/alert", locals: { type: "success", message: t(:password_reset_sent) })
|
partial("layouts/alert", locals: { type: "success", message: t(:password_reset_sent) })
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
render status: :not_found, cable_ready: cable_car.inner_html(
|
render status: :not_found, operations: cable_car.inner_html(
|
||||||
"#forgot-feedback",
|
"#forgot-feedback",
|
||||||
partial("layouts/alert", locals: { type: "alert", message: t(:email_not_found) })
|
partial("layouts/alert", locals: { type: "alert", message: t(:email_not_found) })
|
||||||
)
|
)
|
||||||
@@ -26,7 +26,7 @@ class UserPasswordsController < Spree::UserPasswordsController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def render_unconfirmed_response
|
def render_unconfirmed_response
|
||||||
render status: :unprocessable_entity, cable_ready: cable_car.inner_html(
|
render status: :unprocessable_entity, operations: cable_car.inner_html(
|
||||||
"#forgot-feedback",
|
"#forgot-feedback",
|
||||||
partial("layouts/alert",
|
partial("layouts/alert",
|
||||||
locals: { type: "alert", message: t(:email_unconfirmed),
|
locals: { type: "alert", message: t(:email_unconfirmed),
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class WebhookEndpointsController < ::BaseController
|
|
||||||
before_action :load_resource, only: :destroy
|
|
||||||
|
|
||||||
def create
|
|
||||||
webhook_endpoint = spree_current_user.webhook_endpoints.new(webhook_endpoint_params)
|
|
||||||
|
|
||||||
if webhook_endpoint.save
|
|
||||||
flash[:success] = t('.success')
|
|
||||||
else
|
|
||||||
flash[:error] = t('.error')
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to redirect_path
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
if @webhook_endpoint.destroy
|
|
||||||
flash[:success] = t('.success')
|
|
||||||
else
|
|
||||||
flash[:error] = t('.error')
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to redirect_path
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_resource
|
|
||||||
@webhook_endpoint = spree_current_user.webhook_endpoints.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def webhook_endpoint_params
|
|
||||||
params.require(:webhook_endpoint).permit(:url)
|
|
||||||
end
|
|
||||||
|
|
||||||
def redirect_path
|
|
||||||
if request.referer.blank? || request.referer.include?(spree.account_path)
|
|
||||||
developer_settings_path
|
|
||||||
else
|
|
||||||
request.referer
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def developer_settings_path
|
|
||||||
"#{spree.account_path}#/developer_settings"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -14,7 +14,6 @@ module Admin
|
|||||||
producers.size == 1 ? producers.first.id : nil
|
producers.size == 1 ? producers.first.id : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics/MethodLength
|
|
||||||
def enterprise_side_menu_items(enterprise)
|
def enterprise_side_menu_items(enterprise)
|
||||||
is_shop = enterprise.sells != "none"
|
is_shop = enterprise.sells != "none"
|
||||||
show_properties = !!enterprise.is_primary_producer
|
show_properties = !!enterprise.is_primary_producer
|
||||||
@@ -23,14 +22,6 @@ module Admin
|
|||||||
show_enterprise_fees = can?(:manage_enterprise_fees,
|
show_enterprise_fees = can?(:manage_enterprise_fees,
|
||||||
enterprise) && (is_shop || enterprise.is_primary_producer)
|
enterprise) && (is_shop || enterprise.is_primary_producer)
|
||||||
|
|
||||||
build_enterprise_side_menu_items(is_shop, show_properties, show_shipping_methods,
|
|
||||||
show_payment_methods, show_enterprise_fees)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def build_enterprise_side_menu_items(is_shop, show_properties, show_shipping_methods,
|
|
||||||
show_payment_methods, show_enterprise_fees)
|
|
||||||
[
|
[
|
||||||
{ name: 'primary_details', icon_class: "icon-home", show: true, selected: 'selected' },
|
{ name: 'primary_details', icon_class: "icon-home", show: true, selected: 'selected' },
|
||||||
{ name: 'address', icon_class: "icon-map-marker", show: true },
|
{ name: 'address', icon_class: "icon-map-marker", show: true },
|
||||||
@@ -43,21 +34,13 @@ module Admin
|
|||||||
{ name: 'shipping_methods', icon_class: "icon-truck", show: show_shipping_methods },
|
{ name: 'shipping_methods', icon_class: "icon-truck", show: show_shipping_methods },
|
||||||
{ name: 'payment_methods', icon_class: "icon-money", show: show_payment_methods },
|
{ name: 'payment_methods', icon_class: "icon-money", show: show_payment_methods },
|
||||||
{ name: 'enterprise_fees', icon_class: "icon-tasks", show: show_enterprise_fees },
|
{ name: 'enterprise_fees', icon_class: "icon-tasks", show: show_enterprise_fees },
|
||||||
{ name: 'vouchers', icon_class: "icon-ticket", show: true },
|
|
||||||
{ name: 'enterprise_permissions', icon_class: "icon-plug", show: true,
|
{ name: 'enterprise_permissions', icon_class: "icon-plug", show: true,
|
||||||
href: admin_enterprise_relationships_path },
|
href: admin_enterprise_relationships_path },
|
||||||
{ name: 'inventory_settings', icon_class: "icon-list-ol", show: is_shop },
|
{ name: 'inventory_settings', icon_class: "icon-list-ol", show: is_shop },
|
||||||
{ name: 'tag_rules', icon_class: "icon-random", show: is_shop },
|
{ name: 'tag_rules', icon_class: "icon-random", show: is_shop },
|
||||||
{ name: 'shop_preferences', icon_class: "icon-shopping-cart", show: is_shop },
|
{ name: 'shop_preferences', icon_class: "icon-shopping-cart", show: is_shop },
|
||||||
{ name: 'users', icon_class: "icon-user", show: true },
|
{ name: 'users', icon_class: "icon-user", show: true }
|
||||||
] + [add_white_label_if_feature_activated].compact
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_white_label_if_feature_activated
|
|
||||||
return nil unless OpenFoodNetwork::FeatureToggle.enabled?(:white_label)
|
|
||||||
|
|
||||||
{ name: 'white_label', icon_class: "icon-leaf", show: true }
|
|
||||||
end
|
|
||||||
# rubocop:enable Metrics/MethodLength
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ class AngularFormBuilder < ActionView::Helpers::FormBuilder
|
|||||||
@template.ng_options_for_select(choices, angular_field), options
|
@template.ng_options_for_select(choices, angular_field), options
|
||||||
end
|
end
|
||||||
|
|
||||||
def ng_collection_select(method, collection, value_method,
|
def ng_collection_select(method, collection, value_method, text_method, angular_field, options = {})
|
||||||
text_method, angular_field, options = {})
|
|
||||||
options.reverse_merge!('id' => angular_id(method), 'ng-model' => angular_model(method).to_s)
|
options.reverse_merge!('id' => angular_id(method), 'ng-model' => angular_model(method).to_s)
|
||||||
|
|
||||||
@template.select_tag angular_name(method),
|
@template.select_tag angular_name(method),
|
||||||
|
|||||||
@@ -139,8 +139,8 @@ module CheckoutHelper
|
|||||||
def stripe_card_options(cards)
|
def stripe_card_options(cards)
|
||||||
cards.map do |cc|
|
cards.map do |cc|
|
||||||
[
|
[
|
||||||
"#{cc.brand} #{cc.last_digits} #{I18n.t(:card_expiry_abbreviation)}:"\
|
"#{cc.brand} #{cc.last_digits} #{I18n.t(:card_expiry_abbreviation)}:#{cc.month.to_s.rjust(2, '0')}/#{cc.year}",
|
||||||
"#{cc.month.to_s.rjust(2, '0')}/#{cc.year}", cc.id
|
cc.id
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# Trigger jobs for any order cycles that recently opened
|
|
||||||
class OrderCycleOpenedJob < ApplicationJob
|
|
||||||
def perform
|
|
||||||
ActiveRecord::Base.transaction do
|
|
||||||
recently_opened_order_cycles.find_each do |order_cycle|
|
|
||||||
OrderCycleWebhookService.create_webhook_job(order_cycle, 'order_cycle.opened')
|
|
||||||
end
|
|
||||||
mark_as_opened(recently_opened_order_cycles)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def recently_opened_order_cycles
|
|
||||||
@recently_opened_order_cycles ||= OrderCycle
|
|
||||||
.where(opened_at: nil)
|
|
||||||
.where(orders_open_at: 1.hour.ago..Time.zone.now)
|
|
||||||
.lock.order(:id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def mark_as_opened(order_cycles)
|
|
||||||
now = Time.zone.now
|
|
||||||
order_cycles.update_all(opened_at: now, updated_at: now)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require "faraday"
|
|
||||||
require "private_address_check"
|
|
||||||
require "private_address_check/tcpsocket_ext"
|
|
||||||
|
|
||||||
# Deliver a webhook payload
|
|
||||||
# As a delayed job, it can run asynchronously and handle retries.
|
|
||||||
class WebhookDeliveryJob < ApplicationJob
|
|
||||||
# General failed request error that we're going to use to signal
|
|
||||||
# the job runner to retry our webhook worker.
|
|
||||||
class FailedWebhookRequestError < StandardError; end
|
|
||||||
|
|
||||||
queue_as :default
|
|
||||||
|
|
||||||
def perform(url, event, payload)
|
|
||||||
body = {
|
|
||||||
id: job_id,
|
|
||||||
at: Time.zone.now.to_s,
|
|
||||||
event: event,
|
|
||||||
data: payload,
|
|
||||||
}
|
|
||||||
|
|
||||||
# Request user-submitted url, preventing any private connections being made
|
|
||||||
# (SSRF).
|
|
||||||
# This method may allow the socket to open, but is necessary in order to
|
|
||||||
# protect from TOC/TOU.
|
|
||||||
# Note that private_address_check provides some methods for pre-validating,
|
|
||||||
# but they're not as comprehensive and so unnecessary here. Simply
|
|
||||||
# momentarily opening sockets probably can't cause DoS or other damage.
|
|
||||||
PrivateAddressCheck.only_public_connections do
|
|
||||||
notify_endpoint(url, body)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def notify_endpoint(url, body)
|
|
||||||
connection = Faraday.new(
|
|
||||||
request: { timeout: 30 },
|
|
||||||
headers: {
|
|
||||||
'User-Agent' => 'openfoodnetwork_webhook/1.0',
|
|
||||||
'Content-Type' => 'application/json',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
response = connection.post(url, body.to_json)
|
|
||||||
|
|
||||||
# Raise a failed request error and let job runner handle retrying.
|
|
||||||
# In theory, only 5xx errors should be retried, but who knows.
|
|
||||||
raise FailedWebhookRequestError, response.status.to_s unless response.success?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -61,9 +61,4 @@ class CustomerSchema < JsonApiSchema
|
|||||||
def self.relationships
|
def self.relationships
|
||||||
[:enterprise]
|
[:enterprise]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Optional attributes included with eg: CustomerSchema.schema(extra_fields: :balance)
|
|
||||||
def self.balance
|
|
||||||
{ balance: { type: :number, format: :double } }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,77 +19,84 @@ class JsonApiSchema
|
|||||||
end
|
end
|
||||||
|
|
||||||
def schema(options = {})
|
def schema(options = {})
|
||||||
Structure.schema(data_properties(**options))
|
{
|
||||||
|
type: :object,
|
||||||
|
properties: {
|
||||||
|
data: {
|
||||||
|
type: :object,
|
||||||
|
properties: data_properties(**options)
|
||||||
|
},
|
||||||
|
meta: { type: :object },
|
||||||
|
links: { type: :object }
|
||||||
|
},
|
||||||
|
required: [:data]
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def collection(options)
|
def collection(options)
|
||||||
Structure.collection(data_properties(**options))
|
{
|
||||||
|
type: :object,
|
||||||
|
properties: {
|
||||||
|
data: {
|
||||||
|
type: :array,
|
||||||
|
items: {
|
||||||
|
type: :object,
|
||||||
|
properties: data_properties(**options)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
meta: {
|
||||||
|
type: :object,
|
||||||
|
properties: {
|
||||||
|
pagination: {
|
||||||
|
type: :object,
|
||||||
|
properties: {
|
||||||
|
results: { type: :integer, example: 250 },
|
||||||
|
pages: { type: :integer, example: 5 },
|
||||||
|
page: { type: :integer, example: 2 },
|
||||||
|
per_page: { type: :integer, example: 50 },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
required: [:pagination]
|
||||||
|
},
|
||||||
|
links: {
|
||||||
|
type: :object,
|
||||||
|
properties: {
|
||||||
|
self: { type: :string },
|
||||||
|
first: { type: :string },
|
||||||
|
prev: { type: :string, nullable: true },
|
||||||
|
next: { type: :string, nullable: true },
|
||||||
|
last: { type: :string }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
required: [:data, :meta, :links]
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def data_properties(require_all: false, extra_fields: nil)
|
def data_properties(require_all: false)
|
||||||
extra_fields_result = get_extra_fields(extra_fields)
|
|
||||||
attributes = get_attributes(extra_fields_result)
|
|
||||||
required = get_required(require_all, extra_fields, extra_fields_result)
|
|
||||||
|
|
||||||
Structure.data_properties(object_name, attributes, required, relationship_properties)
|
|
||||||
end
|
|
||||||
|
|
||||||
def relationship_properties
|
|
||||||
relationships.to_h { |name| [name, relationship_schema(name)] }
|
|
||||||
end
|
|
||||||
|
|
||||||
# Example
|
|
||||||
# MySchema.schema(extra_fields: :my_method)
|
|
||||||
# => extra_fields_result = MySchema.my_method
|
|
||||||
# => attributes = attributes.merge(extra_fields_result)
|
|
||||||
#
|
|
||||||
# MySchema.schema(extra_fields: {name: :my_method, required: true, opts: {method_opt: true}})
|
|
||||||
# => extra_fields_result = MySchema.my_method(method_opt: true)
|
|
||||||
# => attributes = attributes.merge(extra_fields_result)
|
|
||||||
# => required += extra_fields_result.keys
|
|
||||||
#
|
|
||||||
# MySchema.schema(extra_fields: [:my_method, :another_method])
|
|
||||||
# => extra_fields_result = MySchema.my_method.merge(another_method)
|
|
||||||
# => attributes = attribtues.merge(extra_fields_result)
|
|
||||||
#
|
|
||||||
# To test use eg:
|
|
||||||
# MySchema.schema(extra_fields: :my_method)
|
|
||||||
# .dig(:properties, :data, :properties, :attributes)
|
|
||||||
def get_extra_fields(extra_fields)
|
|
||||||
case extra_fields
|
|
||||||
when Symbol
|
|
||||||
public_send(extra_fields)
|
|
||||||
when Hash
|
|
||||||
public_send(extra_fields[:name], **extra_fields[:opts].to_h)
|
|
||||||
when Array
|
|
||||||
obj = {}
|
|
||||||
|
|
||||||
extra_fields.each do |w|
|
|
||||||
obj.merge!(get_extra_fields(w))
|
|
||||||
end
|
|
||||||
|
|
||||||
obj
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_required(require_all, extra_fields, extra_fields_result)
|
|
||||||
required = require_all ? all_attributes : required_attributes
|
required = require_all ? all_attributes : required_attributes
|
||||||
|
|
||||||
if extra_fields.is_a?(Hash) && extra_fields[:required] == true && extra_fields_result.present?
|
{
|
||||||
required += extra_fields_result.keys
|
id: { type: :string, example: "1" },
|
||||||
end
|
type: { type: :string, example: object_name },
|
||||||
|
attributes: {
|
||||||
required
|
type: :object,
|
||||||
end
|
properties: attributes,
|
||||||
|
required: required
|
||||||
def get_attributes(extra_fields_result)
|
},
|
||||||
if [extra_fields_result, attributes].all?{ |obj| obj.respond_to?(:merge) }
|
relationships: {
|
||||||
attributes.merge(extra_fields_result)
|
type: :object,
|
||||||
else
|
properties: relationships.to_h do |name|
|
||||||
attributes
|
[
|
||||||
end
|
name,
|
||||||
|
relationship_schema(name)
|
||||||
|
]
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def relationship_schema(name)
|
def relationship_schema(name)
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# rubocop:disable Metrics/MethodLength
|
|
||||||
|
|
||||||
class JsonApiSchema
|
|
||||||
module Structure
|
|
||||||
extend self
|
|
||||||
|
|
||||||
def schema(data_properties)
|
|
||||||
{
|
|
||||||
type: :object,
|
|
||||||
properties: {
|
|
||||||
data: {
|
|
||||||
type: :object,
|
|
||||||
properties: data_properties
|
|
||||||
},
|
|
||||||
meta: { type: :object },
|
|
||||||
links: { type: :object }
|
|
||||||
},
|
|
||||||
required: [:data]
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def collection(data_properties)
|
|
||||||
{
|
|
||||||
type: :object,
|
|
||||||
properties: {
|
|
||||||
data: {
|
|
||||||
type: :array,
|
|
||||||
items: {
|
|
||||||
type: :object,
|
|
||||||
properties: data_properties
|
|
||||||
}
|
|
||||||
},
|
|
||||||
meta: {
|
|
||||||
type: :object,
|
|
||||||
properties: {
|
|
||||||
pagination: {
|
|
||||||
type: :object,
|
|
||||||
properties: {
|
|
||||||
results: { type: :integer, example: 250 },
|
|
||||||
pages: { type: :integer, example: 5 },
|
|
||||||
page: { type: :integer, example: 2 },
|
|
||||||
per_page: { type: :integer, example: 50 },
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
required: [:pagination]
|
|
||||||
},
|
|
||||||
links: {
|
|
||||||
type: :object,
|
|
||||||
properties: {
|
|
||||||
self: { type: :string },
|
|
||||||
first: { type: :string },
|
|
||||||
prev: { type: :string, nullable: true },
|
|
||||||
next: { type: :string, nullable: true },
|
|
||||||
last: { type: :string }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
required: [:data, :meta, :links]
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def data_properties(object_name, attributes, required, relationship_properties)
|
|
||||||
{
|
|
||||||
id: { type: :string, example: "1" },
|
|
||||||
type: { type: :string, example: object_name },
|
|
||||||
attributes: {
|
|
||||||
type: :object,
|
|
||||||
properties: attributes,
|
|
||||||
required: required
|
|
||||||
},
|
|
||||||
relationships: {
|
|
||||||
type: :object,
|
|
||||||
properties: relationship_properties
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# rubocop:enable Metrics/MethodLength
|
|
||||||
@@ -17,7 +17,7 @@ class Enterprise < ApplicationRecord
|
|||||||
}.freeze
|
}.freeze
|
||||||
VALID_INSTAGRAM_REGEX = %r{\A[a-zA-Z0-9._]{1,30}([^/-]*)\z}
|
VALID_INSTAGRAM_REGEX = %r{\A[a-zA-Z0-9._]{1,30}([^/-]*)\z}
|
||||||
|
|
||||||
searchable_attributes :sells, :is_primary_producer, :name
|
searchable_attributes :sells, :is_primary_producer
|
||||||
searchable_associations :properties
|
searchable_associations :properties
|
||||||
searchable_scopes :is_primary_producer, :is_distributor, :is_hub, :activated, :visible,
|
searchable_scopes :is_primary_producer, :is_distributor, :is_hub, :activated, :visible,
|
||||||
:ready_for_checkout, :not_ready_for_checkout
|
:ready_for_checkout, :not_ready_for_checkout
|
||||||
@@ -65,7 +65,6 @@ class Enterprise < ApplicationRecord
|
|||||||
has_many :inventory_items
|
has_many :inventory_items
|
||||||
has_many :tag_rules
|
has_many :tag_rules
|
||||||
has_one :stripe_account, dependent: :destroy
|
has_one :stripe_account, dependent: :destroy
|
||||||
has_many :vouchers
|
|
||||||
|
|
||||||
delegate :latitude, :longitude, :city, :state_name, to: :address
|
delegate :latitude, :longitude, :city, :state_name, to: :address
|
||||||
|
|
||||||
@@ -101,11 +100,7 @@ class Enterprise < ApplicationRecord
|
|||||||
validate :shopfront_taxons
|
validate :shopfront_taxons
|
||||||
validate :shopfront_producers
|
validate :shopfront_producers
|
||||||
validate :enforce_ownership_limit, if: lambda { owner_id_changed? && !owner_id.nil? }
|
validate :enforce_ownership_limit, if: lambda { owner_id_changed? && !owner_id.nil? }
|
||||||
validates :instagram,
|
validates :instagram, format: { with: VALID_INSTAGRAM_REGEX, message: Spree.t('errors.messages.invalid_instagram_url') }, allow_blank: true
|
||||||
format: {
|
|
||||||
with: VALID_INSTAGRAM_REGEX,
|
|
||||||
message: Spree.t('errors.messages.invalid_instagram_url')
|
|
||||||
}, allow_blank: true
|
|
||||||
|
|
||||||
before_validation :initialize_permalink, if: lambda { permalink.nil? }
|
before_validation :initialize_permalink, if: lambda { permalink.nil? }
|
||||||
before_validation :set_unused_address_fields
|
before_validation :set_unused_address_fields
|
||||||
@@ -267,8 +262,7 @@ class Enterprise < ApplicationRecord
|
|||||||
|
|
||||||
def plus_parents_and_order_cycle_producers(order_cycles)
|
def plus_parents_and_order_cycle_producers(order_cycles)
|
||||||
oc_producer_ids = Exchange.in_order_cycle(order_cycles).incoming.pluck :sender_id
|
oc_producer_ids = Exchange.in_order_cycle(order_cycles).incoming.pluck :sender_id
|
||||||
Enterprise.not_hidden.is_primary_producer
|
Enterprise.not_hidden.is_primary_producer.parents_of_one_union_others(id, oc_producer_ids | [id])
|
||||||
.parents_of_one_union_others(id, oc_producer_ids | [id])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def relatives_including_self
|
def relatives_including_self
|
||||||
@@ -456,8 +450,7 @@ class Enterprise < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def strip_url(url)
|
def strip_url(url)
|
||||||
# Strip protocol and trailing slash
|
url&.sub(%r{(https?://)?}, '')
|
||||||
url&.sub(%r{(https?://)?}, '')&.sub(%r{/\z}, '')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def correct_whatsapp_url(phone_number)
|
def correct_whatsapp_url(phone_number)
|
||||||
@@ -465,11 +458,11 @@ class Enterprise < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def correct_instagram_url(url)
|
def correct_instagram_url(url)
|
||||||
url && strip_url(url.downcase).sub(%r{(www\.)?instagram.com/}, '').delete("@")
|
url && strip_url(url.downcase).sub(%r{www.instagram.com/}, '').sub(%r{instagram.com/}, '').delete("@")
|
||||||
end
|
end
|
||||||
|
|
||||||
def correct_twitter_url(url)
|
def correct_twitter_url(url)
|
||||||
url && strip_url(url).sub(%r{(www\.)?twitter.com/}, '').delete("@")
|
url && strip_url(url).sub(%r{www.twitter.com/}, '').delete("@")
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_unused_address_fields
|
def set_unused_address_fields
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ class OrderCycle < ApplicationRecord
|
|||||||
|
|
||||||
attr_accessor :incoming_exchanges, :outgoing_exchanges
|
attr_accessor :incoming_exchanges, :outgoing_exchanges
|
||||||
|
|
||||||
before_update :reset_opened_at, if: :will_save_change_to_orders_open_at?
|
|
||||||
before_update :reset_processed_at, if: :will_save_change_to_orders_close_at?
|
before_update :reset_processed_at, if: :will_save_change_to_orders_close_at?
|
||||||
after_save :sync_subscriptions, if: :opening?
|
after_save :sync_subscriptions, if: :opening?
|
||||||
|
|
||||||
@@ -334,14 +333,6 @@ class OrderCycle < ApplicationRecord
|
|||||||
errors.add(:orders_close_at, :after_orders_open_at)
|
errors.add(:orders_close_at, :after_orders_open_at)
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset_opened_at
|
|
||||||
# Reset only if order cycle is opening again at a later date
|
|
||||||
return unless orders_open_at.present? && orders_open_at_was.present?
|
|
||||||
return unless orders_open_at > orders_open_at_was
|
|
||||||
|
|
||||||
self.opened_at = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def reset_processed_at
|
def reset_processed_at
|
||||||
return unless orders_close_at.present? && orders_close_at_was.present?
|
return unless orders_close_at.present? && orders_close_at_was.present?
|
||||||
return unless orders_close_at > orders_close_at_was
|
return unless orders_close_at > orders_close_at_was
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ module ProductImport
|
|||||||
:variants_created, :variants_updated, :enterprise_products,
|
:variants_created, :variants_updated, :enterprise_products,
|
||||||
:total_enterprise_products, :products_reset_count
|
:total_enterprise_products, :products_reset_count
|
||||||
|
|
||||||
def initialize(importer, validator, import_settings, spreadsheet_data,
|
def initialize(importer, validator, import_settings, spreadsheet_data, editable_enterprises, import_time, updated_ids)
|
||||||
editable_enterprises, import_time, updated_ids)
|
|
||||||
@importer = importer
|
@importer = importer
|
||||||
@validator = validator
|
@validator = validator
|
||||||
@settings = Settings.new(import_settings)
|
@settings = Settings.new(import_settings)
|
||||||
|
|||||||
@@ -179,8 +179,6 @@ module Spree
|
|||||||
can [:admin, :create], :manager_invitation
|
can [:admin, :create], :manager_invitation
|
||||||
|
|
||||||
can [:admin, :index], :oidc_setting
|
can [:admin, :index], :oidc_setting
|
||||||
|
|
||||||
can [:admin, :create], Voucher
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_product_management_abilities(user)
|
def add_product_management_abilities(user)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module Spree
|
|||||||
class Address < ApplicationRecord
|
class Address < ApplicationRecord
|
||||||
include AddressDisplay
|
include AddressDisplay
|
||||||
|
|
||||||
searchable_attributes :firstname, :lastname, :phone
|
searchable_attributes :firstname, :lastname
|
||||||
searchable_associations :country, :state
|
searchable_associations :country, :state
|
||||||
|
|
||||||
belongs_to :country, class_name: "Spree::Country"
|
belongs_to :country, class_name: "Spree::Country"
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ module Spree
|
|||||||
|
|
||||||
has_one_attached :attachment
|
has_one_attached :attachment
|
||||||
|
|
||||||
validates :attachment, attached: true,
|
validates :attachment, attached: true, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
||||||
content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
|
||||||
validate :no_attachment_errors
|
validate :no_attachment_errors
|
||||||
|
|
||||||
def variant(name)
|
def variant(name)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module Spree
|
|||||||
|
|
||||||
searchable_attributes :number, :state, :shipment_state, :payment_state, :distributor_id,
|
searchable_attributes :number, :state, :shipment_state, :payment_state, :distributor_id,
|
||||||
:order_cycle_id, :email, :total, :customer_id
|
:order_cycle_id, :email, :total, :customer_id
|
||||||
searchable_associations :shipping_method, :bill_address, :distributor
|
searchable_associations :shipping_method, :bill_address
|
||||||
searchable_scopes :complete, :incomplete
|
searchable_scopes :complete, :incomplete
|
||||||
|
|
||||||
checkout_flow do
|
checkout_flow do
|
||||||
@@ -311,8 +311,7 @@ module Spree
|
|||||||
# Creates new tax charges if there are any applicable rates. If prices already
|
# Creates new tax charges if there are any applicable rates. If prices already
|
||||||
# include taxes then price adjustments are created instead.
|
# include taxes then price adjustments are created instead.
|
||||||
def create_tax_charge!
|
def create_tax_charge!
|
||||||
return if state.in?(["cart", "address", "delivery"]) &&
|
return if state.in?(["cart", "address", "delivery"]) && OpenFoodNetwork::FeatureToggle.enabled?(:split_checkout)
|
||||||
OpenFoodNetwork::FeatureToggle.enabled?(:split_checkout)
|
|
||||||
|
|
||||||
clear_legacy_taxes!
|
clear_legacy_taxes!
|
||||||
|
|
||||||
|
|||||||
@@ -38,10 +38,7 @@ module Spree
|
|||||||
has_many :customers
|
has_many :customers
|
||||||
has_many :credit_cards
|
has_many :credit_cards
|
||||||
has_many :report_rendering_options, class_name: "::ReportRenderingOptions", dependent: :destroy
|
has_many :report_rendering_options, class_name: "::ReportRenderingOptions", dependent: :destroy
|
||||||
has_many :webhook_endpoints, dependent: :destroy
|
|
||||||
|
|
||||||
accepts_nested_attributes_for :enterprise_roles, allow_destroy: true
|
accepts_nested_attributes_for :enterprise_roles, allow_destroy: true
|
||||||
accepts_nested_attributes_for :webhook_endpoints
|
|
||||||
|
|
||||||
accepts_nested_attributes_for :bill_address
|
accepts_nested_attributes_for :bill_address
|
||||||
accepts_nested_attributes_for :ship_address
|
accepts_nested_attributes_for :ship_address
|
||||||
@@ -151,6 +148,10 @@ module Spree
|
|||||||
spree_orders.incomplete.where(created_by_id: id).order('created_at DESC').first
|
spree_orders.incomplete.where(created_by_id: id).order('created_at DESC').first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def flipper_id
|
||||||
|
"#{self.class.name};#{id}"
|
||||||
|
end
|
||||||
|
|
||||||
def disabled
|
def disabled
|
||||||
disabled_at.present?
|
disabled_at.present?
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ module Spree
|
|||||||
belongs_to :product, -> { with_deleted }, touch: true, class_name: 'Spree::Product'
|
belongs_to :product, -> { with_deleted }, touch: true, class_name: 'Spree::Product'
|
||||||
|
|
||||||
delegate_belongs_to :product, :name, :description, :permalink, :available_on,
|
delegate_belongs_to :product, :name, :description, :permalink, :available_on,
|
||||||
:tax_category_id, :shipping_category_id,
|
:tax_category_id, :shipping_category_id, :meta_description,
|
||||||
:meta_keywords, :tax_category, :shipping_category
|
:meta_keywords, :tax_category, :shipping_category
|
||||||
|
|
||||||
has_many :inventory_units, inverse_of: :variant
|
has_many :inventory_units, inverse_of: :variant
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
# frozen_string_literal: false
|
|
||||||
|
|
||||||
class Voucher < ApplicationRecord
|
|
||||||
belongs_to :enterprise
|
|
||||||
|
|
||||||
validates :code, presence: true, uniqueness: { scope: :enterprise_id }
|
|
||||||
|
|
||||||
def value
|
|
||||||
10
|
|
||||||
end
|
|
||||||
|
|
||||||
def display_value
|
|
||||||
Spree::Money.new(value)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# Records a webhook url to send notifications to
|
|
||||||
class WebhookEndpoint < ApplicationRecord
|
|
||||||
validates :url, presence: true
|
|
||||||
end
|
|
||||||
@@ -1,22 +1,28 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Adds an aggregated 'balance_value' to each customer based on their order history
|
# Fetches the customers of the specified enterprise including the aggregated balance across the
|
||||||
#
|
# customer's orders. That is, we get the total balance for each customer with this enterprise.
|
||||||
class CustomersWithBalance
|
class CustomersWithBalance
|
||||||
def initialize(customers)
|
def initialize(enterprise)
|
||||||
@customers = customers
|
@enterprise = enterprise
|
||||||
end
|
end
|
||||||
|
|
||||||
def query
|
def query
|
||||||
@customers.
|
Customer.of(enterprise).
|
||||||
joins(left_join_complete_orders).
|
joins(left_join_complete_orders).
|
||||||
group("customers.id").
|
group("customers.id").
|
||||||
select("customers.*").
|
select("customers.*").
|
||||||
select("#{outstanding_balance_sum} AS balance_value")
|
select(outstanding_balance_sum)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
attr_reader :enterprise
|
||||||
|
|
||||||
|
def outstanding_balance_sum
|
||||||
|
"SUM(#{OutstandingBalance.new.statement}) AS balance_value"
|
||||||
|
end
|
||||||
|
|
||||||
# The resulting orders are in states that belong after the checkout. Only these can be considered
|
# The resulting orders are in states that belong after the checkout. Only these can be considered
|
||||||
# for a customer's balance.
|
# for a customer's balance.
|
||||||
def left_join_complete_orders
|
def left_join_complete_orders
|
||||||
@@ -30,8 +36,4 @@ class CustomersWithBalance
|
|||||||
states = Spree::Order::FINALIZED_STATES.map { |state| Arel::Nodes.build_quoted(state) }
|
states = Spree::Order::FINALIZED_STATES.map { |state| Arel::Nodes.build_quoted(state) }
|
||||||
Arel::Nodes::In.new(Spree::Order.arel_table[:state], states)
|
Arel::Nodes::In.new(Spree::Order.arel_table[:state], states)
|
||||||
end
|
end
|
||||||
|
|
||||||
def outstanding_balance_sum
|
|
||||||
"SUM(#{OutstandingBalance.new.statement})::float"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class BulkActionsInOrdersListReflex < ApplicationReflex
|
|
||||||
def resend_confirmation_email(order_ids)
|
|
||||||
orders(order_ids).find_each do |o|
|
|
||||||
Spree::OrderMailer.confirm_email_for_customer(o.id, true).deliver_later if can? :resend, o
|
|
||||||
end
|
|
||||||
|
|
||||||
success("admin.resend_confirmation_emails_feedback", order_ids.count)
|
|
||||||
end
|
|
||||||
|
|
||||||
def send_invoice(order_ids)
|
|
||||||
count = 0
|
|
||||||
orders(order_ids).find_each do |o|
|
|
||||||
next unless o.distributor.can_invoice? && (o.resumed? || o.complete?)
|
|
||||||
|
|
||||||
Spree::OrderMailer.invoice_email(o.id).deliver_later
|
|
||||||
count += 1
|
|
||||||
end
|
|
||||||
|
|
||||||
success("admin.send_invoice_feedback", count)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def success(i18n_key, count)
|
|
||||||
flash[:success] = I18n.t(i18n_key, count: count)
|
|
||||||
cable_ready.dispatch_event(name: "modal:close")
|
|
||||||
morph "#flashes", render(partial: "shared/flashes", locals: { flashes: flash })
|
|
||||||
end
|
|
||||||
|
|
||||||
def orders(order_ids)
|
|
||||||
Spree::Order.where(id: order_ids)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# frozen_string_literal: false
|
|
||||||
|
|
||||||
class EnterpriseEditReflex < ApplicationReflex
|
|
||||||
def remove_terms_and_conditions
|
|
||||||
@enterprise = Enterprise.find(element.dataset['enterprise-id'])
|
|
||||||
throw :forbidden unless can?(:remove_terms_and_conditions, @enterprise)
|
|
||||||
|
|
||||||
@enterprise.terms_and_conditions.purge_later
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -22,10 +22,11 @@ class InviteManagerReflex < ApplicationReflex
|
|||||||
|
|
||||||
new_user = create_new_manager(email, enterprise)
|
new_user = create_new_manager(email, enterprise)
|
||||||
|
|
||||||
if new_user.errors.empty?
|
if new_user.valid?
|
||||||
locals[:success] = true
|
locals[:success] = true
|
||||||
else
|
else
|
||||||
locals[:error] = new_user.errors.full_messages.to_sentence
|
locals[:error] = new_user.errors.full_messages.to_sentence ||
|
||||||
|
I18n.t('admin.enterprises.invite_manager.error')
|
||||||
end
|
end
|
||||||
|
|
||||||
return_morph(locals)
|
return_morph(locals)
|
||||||
|
|||||||
13
app/reflexes/resend_confirmation_email_reflex.rb
Normal file
13
app/reflexes/resend_confirmation_email_reflex.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class ResendConfirmationEmailReflex < ApplicationReflex
|
||||||
|
def confirm(order_ids)
|
||||||
|
Spree::Order.where(id: order_ids).find_each do |o|
|
||||||
|
Spree::OrderMailer.confirm_email_for_customer(o.id, true).deliver_later if can? :resend, o
|
||||||
|
end
|
||||||
|
|
||||||
|
flash[:success] = I18n.t("admin.resend_confirmation_emails_feedback", count: order_ids.count)
|
||||||
|
cable_ready.dispatch_event(name: "modal:close")
|
||||||
|
morph "#flashes", render(partial: "shared/flashes", locals: { flashes: flash })
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -14,7 +14,7 @@ module Api
|
|||||||
:logo, :promo_image, :terms_and_conditions,
|
:logo, :promo_image, :terms_and_conditions,
|
||||||
:terms_and_conditions_file_name, :terms_and_conditions_updated_at,
|
:terms_and_conditions_file_name, :terms_and_conditions_updated_at,
|
||||||
:preferred_invoice_order_by_supplier, :preferred_product_low_stock_display,
|
:preferred_invoice_order_by_supplier, :preferred_product_low_stock_display,
|
||||||
:visible, :hide_ofn_navigation
|
:visible
|
||||||
|
|
||||||
has_one :owner, serializer: Api::Admin::UserSerializer
|
has_one :owner, serializer: Api::Admin::UserSerializer
|
||||||
has_many :users, serializer: Api::Admin::UserSerializer
|
has_many :users, serializer: Api::Admin::UserSerializer
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ module Api
|
|||||||
:instagram, :linkedin, :twitter, :facebook, :is_primary_producer, :is_distributor,
|
:instagram, :linkedin, :twitter, :facebook, :is_primary_producer, :is_distributor,
|
||||||
:phone, :whatsapp_phone, :whatsapp_url, :visible, :email_address, :hash, :logo,
|
:phone, :whatsapp_phone, :whatsapp_url, :visible, :email_address, :hash, :logo,
|
||||||
:promo_image, :path, :category, :active, :producers, :orders_close_at, :hubs,
|
:promo_image, :path, :category, :active, :producers, :orders_close_at, :hubs,
|
||||||
:taxons, :supplied_taxons, :pickup, :delivery, :preferred_product_low_stock_display,
|
:taxons, :supplied_taxons, :pickup, :delivery, :preferred_product_low_stock_display
|
||||||
:hide_ofn_navigation
|
|
||||||
|
|
||||||
has_one :address, serializer: Api::AddressSerializer
|
has_one :address, serializer: Api::AddressSerializer
|
||||||
has_many :supplied_properties, serializer: Api::PropertySerializer
|
has_many :supplied_properties, serializer: Api::PropertySerializer
|
||||||
|
|||||||
@@ -16,10 +16,6 @@ module Api
|
|||||||
address(object.shipping_address)
|
address(object.shipping_address)
|
||||||
end
|
end
|
||||||
|
|
||||||
attribute :balance, if: proc { |record|
|
|
||||||
record.respond_to?(:balance_value)
|
|
||||||
}, &:balance_value
|
|
||||||
|
|
||||||
belongs_to :enterprise, links: {
|
belongs_to :enterprise, links: {
|
||||||
related: ->(object) {
|
related: ->(object) {
|
||||||
url_helpers.api_v1_enterprise_url(id: object.enterprise_id)
|
url_helpers.api_v1_enterprise_url(id: object.enterprise_id)
|
||||||
|
|||||||
@@ -10,14 +10,6 @@ class ContentScrubber < Rails::Html::PermitScrubber
|
|||||||
self.attributes = ALLOWED_ATTRIBUTES
|
self.attributes = ALLOWED_ATTRIBUTES
|
||||||
end
|
end
|
||||||
|
|
||||||
def scrub(node)
|
|
||||||
if node.name == 'p' && (node.children.empty? || node.text.blank?)
|
|
||||||
node.remove
|
|
||||||
else
|
|
||||||
super
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def skip_node?(node)
|
def skip_node?(node)
|
||||||
node.text?
|
node.text?
|
||||||
end
|
end
|
||||||
|
|||||||
29
app/services/job_processor.rb
Normal file
29
app/services/job_processor.rb
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Forks into a separate process to contain memory usage and timeout errors.
|
||||||
|
class JobProcessor
|
||||||
|
def self.perform_forked(job, *args)
|
||||||
|
# Reports should abort when puma threads are killed to avoid wasting
|
||||||
|
# resources. Nobody would be collecting the result. We still need to
|
||||||
|
# implement a way to email or download reports later.
|
||||||
|
timeout = ENV.fetch("RACK_TIMEOUT_WAIT_TIMEOUT", "30").to_i
|
||||||
|
|
||||||
|
child = fork do
|
||||||
|
Process.setproctitle("Job worker #{job.job_id}")
|
||||||
|
Timeout.timeout(timeout) do
|
||||||
|
job.perform(*args)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Exit is not a good idea within a Rails process but Rubocop doesn't know
|
||||||
|
# that we are in a forked process.
|
||||||
|
exit # rubocop:disable Rails/Exit
|
||||||
|
end
|
||||||
|
|
||||||
|
# Wait for the forked child process to exit.
|
||||||
|
Process.waitpid(child)
|
||||||
|
ensure
|
||||||
|
# If this Puma thread is interrupted then we need to detach the child
|
||||||
|
# process to avoid it becoming a zombie.
|
||||||
|
Process.detach(child)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -18,7 +18,9 @@ class OrderAvailablePaymentMethods
|
|||||||
|
|
||||||
applicator = OpenFoodNetwork::TagRuleApplicator.new(distributor,
|
applicator = OpenFoodNetwork::TagRuleApplicator.new(distributor,
|
||||||
"FilterPaymentMethods", customer&.tag_list)
|
"FilterPaymentMethods", customer&.tag_list)
|
||||||
applicator.filter(payment_methods)
|
applicator.filter!(payment_methods)
|
||||||
|
|
||||||
|
payment_methods.uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -30,7 +32,7 @@ class OrderAvailablePaymentMethods
|
|||||||
distributor.payment_methods.where(
|
distributor.payment_methods.where(
|
||||||
id: available_distributor_payment_methods_ids
|
id: available_distributor_payment_methods_ids
|
||||||
)
|
)
|
||||||
end.available.select(&:configured?).uniq
|
end.available.select(&:configured?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def available_distributor_payment_methods_ids
|
def available_distributor_payment_methods_ids
|
||||||
|
|||||||
@@ -14,32 +14,25 @@ class OrderAvailableShippingMethods
|
|||||||
def to_a
|
def to_a
|
||||||
return [] if distributor.blank?
|
return [] if distributor.blank?
|
||||||
|
|
||||||
filter_by_category(tag_rules.filter(shipping_methods))
|
shipping_methods = shipping_methods_before_tag_rules_applied
|
||||||
|
|
||||||
|
applicator = OpenFoodNetwork::TagRuleApplicator.new(distributor,
|
||||||
|
"FilterShippingMethods", customer&.tag_list)
|
||||||
|
applicator.filter!(shipping_methods)
|
||||||
|
|
||||||
|
shipping_methods.uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def filter_by_category(methods)
|
def shipping_methods_before_tag_rules_applied
|
||||||
return methods unless OpenFoodNetwork::FeatureToggle.enabled?(:match_shipping_categories,
|
|
||||||
distributor&.owner)
|
|
||||||
|
|
||||||
required_category_ids = order.products.pluck(:shipping_category_id).to_set
|
|
||||||
return methods if required_category_ids.empty?
|
|
||||||
|
|
||||||
methods.select do |method|
|
|
||||||
provided_category_ids = method.shipping_categories.pluck(:id).to_set
|
|
||||||
required_category_ids.subset?(provided_category_ids)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def shipping_methods
|
|
||||||
if order_cycle.nil? || order_cycle.simple?
|
if order_cycle.nil? || order_cycle.simple?
|
||||||
distributor.shipping_methods
|
distributor.shipping_methods
|
||||||
else
|
else
|
||||||
distributor.shipping_methods.where(
|
distributor.shipping_methods.where(
|
||||||
id: available_distributor_shipping_methods_ids
|
id: available_distributor_shipping_methods_ids
|
||||||
)
|
)
|
||||||
end.frontend.to_a.uniq
|
end.frontend.to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
def available_distributor_shipping_methods_ids
|
def available_distributor_shipping_methods_ids
|
||||||
@@ -47,10 +40,4 @@ class OrderAvailableShippingMethods
|
|||||||
.where(distributor_id: distributor.id)
|
.where(distributor_id: distributor.id)
|
||||||
.select(:shipping_method_id)
|
.select(:shipping_method_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_rules
|
|
||||||
OpenFoodNetwork::TagRuleApplicator.new(
|
|
||||||
distributor, "FilterShippingMethods", customer&.tag_list
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# Create a webhook payload for an order cycle event.
|
|
||||||
# The payload will be delivered asynchronously.
|
|
||||||
class OrderCycleWebhookService
|
|
||||||
def self.create_webhook_job(order_cycle, event)
|
|
||||||
webhook_payload = order_cycle
|
|
||||||
.slice(:id, :name, :orders_open_at, :orders_close_at, :coordinator_id)
|
|
||||||
.merge(coordinator_name: order_cycle.coordinator.name)
|
|
||||||
|
|
||||||
# Endpoints for coordinator owner
|
|
||||||
webhook_endpoints = order_cycle.coordinator.owner.webhook_endpoints
|
|
||||||
|
|
||||||
# Plus unique endpoints for distributor owners (ignore duplicates)
|
|
||||||
webhook_endpoints |= order_cycle.distributors.map(&:owner).flat_map(&:webhook_endpoints)
|
|
||||||
|
|
||||||
webhook_endpoints.each do |endpoint|
|
|
||||||
WebhookDeliveryJob.perform_later(endpoint.url, event, webhook_payload)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -34,8 +34,7 @@ module PermittedAttributes
|
|||||||
:preferred_shopfront_producer_order, :preferred_shopfront_order_cycle_order,
|
:preferred_shopfront_producer_order, :preferred_shopfront_order_cycle_order,
|
||||||
:show_customer_names_to_suppliers, :preferred_shopfront_product_sorting_method,
|
:show_customer_names_to_suppliers, :preferred_shopfront_product_sorting_method,
|
||||||
:preferred_invoice_order_by_supplier,
|
:preferred_invoice_order_by_supplier,
|
||||||
:preferred_product_low_stock_display,
|
:preferred_product_low_stock_display
|
||||||
:hide_ofn_navigation
|
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ module PermittedAttributes
|
|||||||
:variant_unit, :variant_unit_scale, :unit_value, :unit_description, :variant_unit_name,
|
:variant_unit, :variant_unit_scale, :unit_value, :unit_description, :variant_unit_name,
|
||||||
:display_as, :sku, :available_on, :group_buy, :group_buy_unit_size,
|
:display_as, :sku, :available_on, :group_buy, :group_buy_unit_size,
|
||||||
:taxon_ids, :primary_taxon_id, :tax_category_id, :shipping_category_id,
|
:taxon_ids, :primary_taxon_id, :tax_category_id, :shipping_category_id,
|
||||||
:meta_keywords, :notes, :inherits_properties,
|
:meta_keywords, :meta_description, :notes, :inherits_properties,
|
||||||
{ product_properties_attributes: [:id, :property_name, :value],
|
{ product_properties_attributes: [:id, :property_name, :value],
|
||||||
variants_attributes: [PermittedAttributes::Variant.attributes],
|
variants_attributes: [PermittedAttributes::Variant.attributes],
|
||||||
images_attributes: [:attachment] }
|
images_attributes: [:attachment] }
|
||||||
|
|||||||
@@ -15,10 +15,7 @@ module PermittedAttributes
|
|||||||
private
|
private
|
||||||
|
|
||||||
def permitted_attributes
|
def permitted_attributes
|
||||||
[
|
[:email, :password, :password_confirmation, :disabled]
|
||||||
:email, :password, :password_confirmation, :disabled,
|
|
||||||
{ webhook_endpoints_attributes: [:id, :url] },
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,11 +29,15 @@ module Shop
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
# order_cycles is a ActiveRecord::Relation that is modified with reject in the TagRuleApplicator
|
||||||
|
# If this relation is reloaded (for example by calling count on it), the modifications are lost
|
||||||
def apply_tag_rules!(order_cycles)
|
def apply_tag_rules!(order_cycles)
|
||||||
applicator = OpenFoodNetwork::TagRuleApplicator.new(@distributor,
|
applicator = OpenFoodNetwork::TagRuleApplicator.new(@distributor,
|
||||||
"FilterOrderCycles",
|
"FilterOrderCycles",
|
||||||
@customer&.tag_list)
|
@customer&.tag_list)
|
||||||
applicator.filter(order_cycles)
|
applicator.filter!(order_cycles)
|
||||||
|
|
||||||
|
order_cycles
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,12 +9,6 @@
|
|||||||
%fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }}
|
%fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }}
|
||||||
%legend= t(".#{ item[:name] }.legend")
|
%legend= t(".#{ item[:name] }.legend")
|
||||||
|
|
||||||
- when 'vouchers'
|
|
||||||
- if feature?(:vouchers, spree_current_user)
|
|
||||||
%fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }}
|
|
||||||
%legend= t(".#{ item[:form_name] || item[:name] }.legend")
|
|
||||||
= render "admin/enterprises/form/#{ item[:form_name] || item[:name] }", f: f
|
|
||||||
|
|
||||||
- else
|
- else
|
||||||
%fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }}
|
%fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }}
|
||||||
%legend= t(".#{ item[:form_name] || item[:name] }.legend")
|
%legend= t(".#{ item[:form_name] || item[:name] }.legend")
|
||||||
|
|||||||
@@ -42,10 +42,10 @@
|
|||||||
= bf.label :state_id, t(:state)
|
= bf.label :state_id, t(:state)
|
||||||
%span.required *
|
%span.required *
|
||||||
.four.columns
|
.four.columns
|
||||||
= bf.select :country_id, options_for_select(available_countries.map { |c| [c.name, c.id] }, @enterprise.business_address.country_id), { include_blank: t(".select_country") }, { "data-controller": "tom-select", "data-dependent-select-target": "source", "data-action": "dependent-select#handleSelectChange", class: "primary" }
|
= bf.select :country_id, options_for_select(available_countries.map { |c| [c.name, c.id] }, @enterprise.business_address.country_id), {}, { "data-controller": "tom-select", "data-dependent-select-target": "source", "data-action": "dependent-select#handleSelectChange", class: "primary" }
|
||||||
.four.columns.omega
|
.four.columns.omega
|
||||||
- states = @enterprise.business_address.country.present? ? @enterprise.business_address.country&.states&.map { |s| [s.name, s.id] } : []
|
- states = @enterprise.business_address.country.present? ? @enterprise.business_address.country&.states&.map { |s| [s.name, s.id] } : []
|
||||||
= bf.select :state_id, states, { include_blank: t(".select_state") }, { disabled: @enterprise.business_address.country_id.nil?, "data-controller": "tom-select", "data-dependent-select-target": "select", class: "primary" }
|
= bf.select :state_id, states, {}, { "data-controller": "tom-select", "data-dependent-select-target": "select", class: "primary" }
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.three.columns.alpha
|
.three.columns.alpha
|
||||||
|
|||||||
@@ -31,39 +31,22 @@
|
|||||||
= f.label :invoice_text, t('.invoice_text')
|
= f.label :invoice_text, t('.invoice_text')
|
||||||
.omega.eight.columns
|
.omega.eight.columns
|
||||||
= f.text_area :invoice_text, style: "width: 100%; height: 100px;"
|
= f.text_area :invoice_text, style: "width: 100%; height: 100px;"
|
||||||
.row{ data: { controller: 'terms-and-conditions', "terms-and-conditions-message-value": t('js.admin.enterprises.form.images.immediate_terms_and_conditions_removal_warning') } }
|
|
||||||
|
.row
|
||||||
.alpha.three.columns
|
.alpha.three.columns
|
||||||
= f.label :terms_and_conditions, t('.terms_and_conditions')
|
= f.label :terms_and_conditions, t('.terms_and_conditions')
|
||||||
%i.text-big.icon-question-sign{ "data-controller": "help-modal-link", "data-action": "click->help-modal-link#open", "data-help-modal-link-target-value": "terms_and_conditions_info_modal" }
|
%i.text-big.icon-question-sign{ "data-controller": "help-modal-link", "data-action": "click->help-modal-link#open", "data-help-modal-link-target-value": "terms_and_conditions_info_modal" }
|
||||||
|
|
||||||
.omega.eight.columns#terms_and_conditions{data: { 'reflex-root': '#terms_and_conditions' } }
|
.omega.eight.columns
|
||||||
- if @enterprise.terms_and_conditions.attached?
|
%a{ href: '{{ Enterprise.terms_and_conditions }}', target: '_blank', ng: { if: 'Enterprise.terms_and_conditions' } }
|
||||||
= link_to "#{@enterprise.terms_and_conditions.blob.filename} #{ t('.uploaded_on') } #{@enterprise.terms_and_conditions.blob.created_at}", url_for(@enterprise.terms_and_conditions), target: '_blank'
|
= '{{ Enterprise.terms_and_conditions_file_name }}'
|
||||||
%div
|
= t('.uploaded_on')
|
||||||
%a.icon-trash{ href: '#', data: { action: 'click->terms-and-conditions#remove', "terms-and-conditions-message-value": t('js.admin.enterprises.form.images.immediate_terms_and_conditions_removal_warning'), 'enterprise-id': @enterprise.id}}
|
= '{{ Enterprise.terms_and_conditions_updated_at }}'
|
||||||
= t('.remove_terms_and_conditions')
|
|
||||||
.pad-top
|
.pad-top
|
||||||
%div
|
= f.file_field :terms_and_conditions, accept: 'application/pdf', 'terms-and-conditions-warning' => 'true'
|
||||||
.button.small{ data: { controller: 'help-modal-link', action: 'click->help-modal-link#open', "help-modal-link-target-value": "terms_and_conditions_warning_modal" } }
|
.pad-top
|
||||||
= t('.upload')
|
%a.button.red{ href: '', ng: {click: 'removeTermsAndConditions()', if: 'Enterprise.terms_and_conditions'} }
|
||||||
%span{ data: { "terms-and-conditions-target": "filename" } }
|
= t('.remove_terms_and_conditions')
|
||||||
= f.file_field :terms_and_conditions, accept: 'application/pdf', style: 'display: none;', data: { "terms-and-conditions-target": "fileinput" }
|
|
||||||
|
|
||||||
= render HelpModalComponent.new(id: "terms_and_conditions_warning_modal", close_button: false ) do
|
|
||||||
%div
|
|
||||||
.margin-bottom-30.text-center
|
|
||||||
.text-big{ style: 'color: red'}
|
|
||||||
= t('js.admin.modals.terms_and_conditions_warning.title')
|
|
||||||
.margin-bottom-30
|
|
||||||
%p
|
|
||||||
= t('js.admin.modals.terms_and_conditions_warning.message_1')
|
|
||||||
.margin-bottom-30
|
|
||||||
%p
|
|
||||||
= t('js.admin.modals.terms_and_conditions_warning.message_2')
|
|
||||||
|
|
||||||
.text-center
|
|
||||||
%input.button.red{ type: 'button', value: t('js.admin.modals.close'), "data-action": "click->help-modal#close"}
|
|
||||||
%input.button.red{ type: 'button', value: t('js.admin.modals.continue'), "data-action": "click->help-modal#close click->terms-and-conditions#add" }
|
|
||||||
|
|
||||||
|
|
||||||
= f.fields_for :business_address, @enterprise.business_address || @enterprise.build_business_address do |bf|
|
= f.fields_for :business_address, @enterprise.business_address || @enterprise.build_business_address do |bf|
|
||||||
@@ -80,12 +63,13 @@
|
|||||||
%legend= t('.invoice_item_sorting_legend')
|
%legend= t('.invoice_item_sorting_legend')
|
||||||
.three.columns.alpha
|
.three.columns.alpha
|
||||||
%label= t('.sort_items_by_supplier?')
|
%label= t('.sort_items_by_supplier?')
|
||||||
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.sort_items_by_supplier_tip')}
|
%div{'ofn-with-tip' => t('.sort_items_by_supplier_tip')}
|
||||||
|
%a= t 'admin.whats_this'
|
||||||
.three.columns
|
.three.columns
|
||||||
= f.radio_button :preferred_invoice_order_by_supplier, true
|
= f.radio_button :preferred_invoice_order_by_supplier, true, 'ng-model' => 'Enterprise.preferred_invoice_order_by_supplier', 'ng-value' => 'true'
|
||||||
= f.label :preffered_invoice_order_by_supplier, t('.enabled'), value: :true
|
= f.label :preffered_invoice_order_by_supplier, t('.enabled'), value: :true
|
||||||
.five.columns.omega
|
.five.columns.omega
|
||||||
= f.radio_button :preferred_invoice_order_by_supplier, false
|
= f.radio_button :preferred_invoice_order_by_supplier, false, 'ng-model' => 'Enterprise.preferred_invoice_order_by_supplier', 'ng-value' => 'false'
|
||||||
= f.label :preferred_invoice_order_by_name, t('.disabled'), value: :false
|
= f.label :preferred_invoice_order_by_name, t('.disabled'), value: :false
|
||||||
|
|
||||||
= render HelpModalComponent.new(id: "terms_and_conditions_info_modal") do
|
= render HelpModalComponent.new(id: "terms_and_conditions_info_modal") do
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
.text-right
|
|
||||||
%a.button{ href: "#{new_admin_enterprise_voucher_path(@enterprise)}"}
|
|
||||||
= t('.add_new')
|
|
||||||
%br
|
|
||||||
|
|
||||||
- if @enterprise.vouchers.present?
|
|
||||||
%table
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th= t('.voucher_code')
|
|
||||||
%th= t('.rate')
|
|
||||||
/%th= t('.label')
|
|
||||||
/%th= t('.purpose')
|
|
||||||
/%th= t('.expiry')
|
|
||||||
/%th= t('.use_limit')
|
|
||||||
/%th= t('.customers')
|
|
||||||
/%th= t('.net_value')
|
|
||||||
%tbody
|
|
||||||
- @enterprise.vouchers.each do |voucher|
|
|
||||||
%tr
|
|
||||||
%td= voucher.code
|
|
||||||
%td= voucher.display_value
|
|
||||||
/%td
|
|
||||||
/%td
|
|
||||||
/%td
|
|
||||||
/%td
|
|
||||||
/%td
|
|
||||||
/%td
|
|
||||||
|
|
||||||
- else
|
|
||||||
%p.text-center
|
|
||||||
= t('.no_voucher_yet')
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
.row
|
|
||||||
.three.columns.alpha
|
|
||||||
= f.label :hide_ofn_navigation, t('.hide_ofn_navigation')
|
|
||||||
.three.columns
|
|
||||||
= f.check_box :hide_ofn_navigation
|
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
%fieldset.no-border-bottom.print-hidden
|
%fieldset.no-border-bottom.print-hidden
|
||||||
%legend{ align: 'center'}= t(:report_filters)
|
%legend{ align: 'center'}= t(:report_filters)
|
||||||
= render partial: "admin/reports/filters/#{@report_type}", locals: { f: f }
|
= render partial: "admin/reports/filters/#{@report_type}", locals: { f: f }
|
||||||
- if @report_subtype && lookup_context.exists?(@report_subtype, "admin/reports/filters", true)
|
- if @report_subtype && lookup_context.exists?(@report_subtype, "admin/reports/filters/", true)
|
||||||
= render partial: "admin/reports/filters/#{@report_subtype}", locals: { f: f }
|
= render partial: "admin/reports/filters/#{@report_subtype}", locals: { f: f }
|
||||||
|
|
||||||
%fieldset.print-hidden
|
%fieldset.print-hidden
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.side_menu#side_menu
|
.side_menu#side_menu
|
||||||
- if @enterprise
|
- if @enterprise
|
||||||
- enterprise_side_menu_items(@enterprise).each do |item|
|
- enterprise_side_menu_items(@enterprise).each do |item|
|
||||||
- next if !item[:show] || (item[:name] == 'vouchers' && !feature?(:vouchers, spree_current_user))
|
- next unless item[:show]
|
||||||
%a.menu_item{ href: item[:href] || "##{item[:name]}_panel", id: item[:name], data: { action: "tabs-and-panels#changeActivePanel tabs-and-panels#changeActiveTab", "tabs-and-panels-target": "tab" }, class: item[:selected] }
|
%a.menu_item{ href: item[:href] || "##{item[:name]}_panel", id: item[:name], data: { action: "tabs-and-panels#changeActivePanel tabs-and-panels#changeActiveTab", "tabs-and-panels-target": "tab" }, class: item[:selected] }
|
||||||
%i{ class: item[:icon_class] }
|
%i{ class: item[:icon_class] }
|
||||||
%span= t(".enterprise.#{item[:name] }")
|
%span= t(".enterprise.#{item[:name] }")
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
= form_with model: @voucher, url: admin_enterprise_vouchers_path(@enterprise), html: { name: "voucher_form" } do |f|
|
|
||||||
.row
|
|
||||||
.sixteen.columns.alpha
|
|
||||||
.four.columns.alpha.text-right
|
|
||||||
%a.button{ href: "#{edit_admin_enterprise_path(@enterprise)}#!#vouchers_panel"}
|
|
||||||
= t('.back')
|
|
||||||
.twelve.columns.omega
|
|
||||||
.row
|
|
||||||
.eight.columns.text-center
|
|
||||||
%legend= t(".legend")
|
|
||||||
.four.columns.text-right
|
|
||||||
= f.submit t('.save'), class: 'red'
|
|
||||||
.row
|
|
||||||
.alpha.four.columns
|
|
||||||
= f.label :code, t('.voucher_code')
|
|
||||||
.omega.eight.columns
|
|
||||||
= f.text_area :code, rows: 6, class: 'fullwidth'
|
|
||||||
.row
|
|
||||||
.alpha.four.columns
|
|
||||||
= f.label :amount, t('.voucher_amount')
|
|
||||||
.omega.eight.columns
|
|
||||||
= Spree::Money.currency_symbol
|
|
||||||
= f.text_field :amount, value: @voucher.value, disabled: true
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
%span{ ng: { class: "{brick: !enterprise.is_primary_producer, turquoise: enterprise.is_primary_producer}" } }
|
%span{ ng: { class: "{brick: !enterprise.is_primary_producer, turquoise: enterprise.is_primary_producer}" } }
|
||||||
{{ enterprise.name }}
|
{{ enterprise.name }}
|
||||||
|
|
||||||
%form{ name: 'about', novalidate: true, ng: { controller: "RegistrationFormCtrl", submit: "selectIfValid('images', about)" } }
|
%form{ name: 'about', novalidate: true, ng: { controller: "RegistrationFormCtrl", submit: "update('images',about)" } }
|
||||||
.row
|
.row
|
||||||
.small-12.columns
|
.small-12.columns
|
||||||
.alert-box.info{ "ofn-inline-alert" => true, ng: { show: "visible" } }
|
.alert-box.info{ "ofn-inline-alert" => true, ng: { show: "visible" } }
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
.field
|
.field
|
||||||
%label{ for: 'enterprise_instagram' }= t(".instagram")+":"
|
%label{ for: 'enterprise_instagram' }= t(".instagram")+":"
|
||||||
%input.chunky{ id: 'enterprise_instagram', placeholder: "{{'registration.steps.social.instagram_placeholder' | t}}", ng: { model: 'enterprise.instagram' } }
|
%input.chunky{ id: 'enterprise_instagram', placeholder: "{{'registration.steps.social.instagram_placeholder' | t}}", ng: { model: 'enterprise.instagram' } }
|
||||||
%span.error.small-12.columns#instagram-error{ style: "display: none" }
|
|
||||||
|
|
||||||
.row.buttons
|
.row.buttons
|
||||||
.small-12.columns
|
.small-12.columns
|
||||||
|
|||||||
@@ -10,15 +10,14 @@
|
|||||||
= t 'powered_by'
|
= t 'powered_by'
|
||||||
%a{href: '/'}
|
%a{href: '/'}
|
||||||
= t 'title'
|
= t 'title'
|
||||||
- unless @hide_ofn_navigation
|
%ul.nav-main-menu
|
||||||
%ul.nav-main-menu
|
- [*1..7].each do |menu_number|
|
||||||
- [*1..7].each do |menu_number|
|
- menu_name = "menu_#{menu_number}"
|
||||||
- menu_name = "menu_#{menu_number}"
|
- if ContentConfig[menu_name].present?
|
||||||
- if ContentConfig[menu_name].present?
|
%li
|
||||||
%li
|
%a{href: t("#{menu_name}_url") }
|
||||||
%a{href: t("#{menu_name}_url") }
|
%span.nav-primary
|
||||||
%span.nav-primary
|
= t "#{menu_name}_title"
|
||||||
= t "#{menu_name}_title"
|
|
||||||
%ul.nav-icons-menu
|
%ul.nav-icons-menu
|
||||||
- if OpenFoodNetwork::I18nConfig.selectable_locales.count > 1
|
- if OpenFoodNetwork::I18nConfig.selectable_locales.count > 1
|
||||||
= render 'shared/menu/language_selector'
|
= render 'shared/menu/language_selector'
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
%h3
|
%h3
|
||||||
%a{"ng-click" => "triggerProductModal()", href: 'javascript:void(0)'}
|
%a{"ng-click" => "triggerProductModal()", href: 'javascript:void(0)'}
|
||||||
%span{"ng-bind" => "::product.name"}
|
%span{"ng-bind" => "::product.name"}
|
||||||
.product-description{ng: {"bind-html": "::product.description_html", click: "triggerProductModal()", show: "product.description_html.length"}}
|
%p.product-description{ng: {"bind-html": "::product.description_html", click: "triggerProductModal()", show: "product.description_html.length"}}
|
||||||
.product-producer
|
.product-producer
|
||||||
= t :products_from
|
= t :products_from
|
||||||
%span
|
%span
|
||||||
|
|||||||
@@ -76,8 +76,8 @@
|
|||||||
- display_ship_address = false
|
- display_ship_address = false
|
||||||
- ship_method_description = nil
|
- ship_method_description = nil
|
||||||
|
|
||||||
- selected_shipping_method ||= @shipping_methods[0].id if @shipping_methods.length == 1
|
- selected_shipping_method ||= @allowed_shipping_methods[0].id if @allowed_shipping_methods.length == 1
|
||||||
- @shipping_methods.each do |shipping_method|
|
- @allowed_shipping_methods.each do |shipping_method|
|
||||||
- ship_method_is_selected = shipping_method.id == selected_shipping_method.to_i
|
- ship_method_is_selected = shipping_method.id == selected_shipping_method.to_i
|
||||||
%div.checkout-input.checkout-input-radio
|
%div.checkout-input.checkout-input-radio
|
||||||
= fields_for shipping_method do |shipping_method_form|
|
= fields_for shipping_method do |shipping_method_form|
|
||||||
|
|||||||
@@ -18,28 +18,22 @@
|
|||||||
%input.red{ type: "button", value: "Save Changes", ng: { click: "submit()", disabled: "!bulk_order_form.$dirty" } }
|
%input.red{ type: "button", value: "Save Changes", ng: { click: "submit()", disabled: "!bulk_order_form.$dirty" } }
|
||||||
%legend{ align: 'center'}= t(:search)
|
%legend{ align: 'center'}= t(:search)
|
||||||
%div{ :class => "sixteen columns alpha" }
|
%div{ :class => "sixteen columns alpha" }
|
||||||
.quick_search.three.columns.alpha
|
.filter_select{ :class => "four columns" }
|
||||||
%label{ for: 'quick_filter' }
|
|
||||||
%br
|
|
||||||
%input.quick-search.fullwidth{ ng: {model: 'query'}, name: "quick_filter", type: 'text', placeholder: t('admin.quick_search'), "ng-keypress" => "$event.keyCode === 13 && fetchResults()" }
|
|
||||||
.one.columns
|
|
||||||
|
|
||||||
.filter_select{ :class => "three columns" }
|
|
||||||
%label{ :for => 'supplier_filter' }
|
%label{ :for => 'supplier_filter' }
|
||||||
= t("admin.producer")
|
= t("admin.producer")
|
||||||
%br
|
%br
|
||||||
%input#supplier_filter.ofn-select2.fullwidth{ type: 'number', 'min-search' => 5, data: 'suppliers', placeholder: "#{t(:all)}", blank: "{ id: '', name: '#{t(:all)}' }", on: { selecting: "confirmRefresh" }, ng: { model: 'supplierFilter' } }
|
%input#supplier_filter.ofn-select2.fullwidth{ type: 'number', 'min-search' => 5, data: 'suppliers', placeholder: "#{t(:all)}", blank: "{ id: '', name: '#{t(:all)}' }", on: { selecting: "confirmRefresh" }, ng: { model: 'supplierFilter' } }
|
||||||
.filter_select{ :class => "three columns" }
|
.filter_select{ :class => "four columns" }
|
||||||
%label{ :for => 'distributor_filter' }
|
%label{ :for => 'distributor_filter' }
|
||||||
= t("admin.shop")
|
= t("admin.shop")
|
||||||
%br
|
%br
|
||||||
%input#distributor_filter.ofn-select2.fullwidth{ type: 'number', 'min-search' => 5, data: 'distributors', placeholder: "#{t(:all)}", blank: "{ id: '', name: '#{t(:all)}' }", on: { selecting: "confirmRefresh" }, ng: { model: 'distributorFilter' } }
|
%input#distributor_filter.ofn-select2.fullwidth{ type: 'number', 'min-search' => 5, data: 'distributors', placeholder: "#{t(:all)}", blank: "{ id: '', name: '#{t(:all)}' }", on: { selecting: "confirmRefresh" }, ng: { model: 'distributorFilter' } }
|
||||||
.filter_select{ :class => "three columns" }
|
.filter_select{ :class => "four columns" }
|
||||||
%label{ :for => 'order_cycle_filter' }
|
%label{ :for => 'order_cycle_filter' }
|
||||||
= t("admin.order_cycle")
|
= t("admin.order_cycle")
|
||||||
%br
|
%br
|
||||||
%input#order_cycle_filter.ofn-select2.fullwidth{ type: 'number', 'min-search' => 5, data: 'orderCycles', placeholder: "#{t(:all)}", blank: "{ id: '', name: '#{t(:all)}' }", on: { selecting: "confirmRefresh" }, ng: { model: 'orderCycleFilter' } }
|
%input#order_cycle_filter.ofn-select2.fullwidth{ type: 'number', 'min-search' => 5, data: 'orderCycles', placeholder: "#{t(:all)}", blank: "{ id: '', name: '#{t(:all)}' }", on: { selecting: "confirmRefresh" }, ng: { model: 'orderCycleFilter' } }
|
||||||
.date_filter{class: "three columns"}
|
.date_filter{class: "four columns"}
|
||||||
%label
|
%label
|
||||||
= t("date_range")
|
= t("date_range")
|
||||||
%br
|
%br
|
||||||
@@ -103,6 +97,8 @@
|
|||||||
.clear
|
.clear
|
||||||
|
|
||||||
%div{ ng: { hide: 'RequestMonitor.loading || line_items.length == 0' }, style: "display: flex; justify-content: flex-start; column-gap: 10px; margin-bottom: 15px" }
|
%div{ ng: { hide: 'RequestMonitor.loading || line_items.length == 0' }, style: "display: flex; justify-content: flex-start; column-gap: 10px; margin-bottom: 15px" }
|
||||||
|
%div{ style: "flex-grow: 1" }
|
||||||
|
%input.fullwidth{ :type => "text", :id => 'quick_search', 'ng-model' => 'quickSearch', :placeholder => 'Quick Search' }
|
||||||
-# This -20px is a hack to make the dropdowns align properly
|
-# This -20px is a hack to make the dropdowns align properly
|
||||||
%div{ style: "margin-right: -20px;" }
|
%div{ style: "margin-right: -20px;" }
|
||||||
= render 'admin/shared/bulk_actions_dropdown'
|
= render 'admin/shared/bulk_actions_dropdown'
|
||||||
@@ -166,7 +162,7 @@
|
|||||||
= "#{t('admin.price')} (#{Spree::Money.currency_symbol})"
|
= "#{t('admin.price')} (#{Spree::Money.currency_symbol})"
|
||||||
%th.actions
|
%th.actions
|
||||||
|
|
||||||
%tr.line_item{ ng: { repeat: "line_item in filteredLineItems = ( line_items | variantFilter:selectedUnitsProduct:selectedUnitsVariant:sharedResource | orderBy:sorting.predicate:sorting.reverse )", 'class-even' => "'even'", 'class-odd' => "'odd'", attr: { id: "li_{{line_item.id}}" } } }
|
%tr.line_item{ ng: { repeat: "line_item in filteredLineItems = ( line_items | filter:quickSearch | variantFilter:selectedUnitsProduct:selectedUnitsVariant:sharedResource | orderBy:sorting.predicate:sorting.reverse )", 'class-even' => "'even'", 'class-odd' => "'odd'", attr: { id: "li_{{line_item.id}}" } } }
|
||||||
%td.bulk
|
%td.bulk
|
||||||
%input{ :type => "checkbox", :name => 'bulk', 'ng-model' => 'line_item.checked', 'ignore-dirty' => true }
|
%input{ :type => "checkbox", :name => 'bulk', 'ng-model' => 'line_item.checked', 'ignore-dirty' => true }
|
||||||
%td.order_no{ 'ng-show' => 'columns.order_no.visible' } {{ line_item.order.number }}
|
%td.order_no{ 'ng-show' => 'columns.order_no.visible' } {{ line_item.order.number }}
|
||||||
|
|||||||
@@ -21,27 +21,24 @@
|
|||||||
|
|
||||||
.row.index-controls{'ng-show' => '!RequestMonitor.loading && orders.length > 0'}
|
.row.index-controls{'ng-show' => '!RequestMonitor.loading && orders.length > 0'}
|
||||||
%div{style: "display: flex; justify-content: space-between;"}
|
%div{style: "display: flex; justify-content: space-between;"}
|
||||||
.ofn-drop-down-with-prepend
|
- if Spree::Config[:enable_invoices?]
|
||||||
.ofn-drop-down-prepend{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"}
|
.ofn-drop-down-with-prepend
|
||||||
{{ "spree.admin.orders.index.selected" | t:{count: selected_orders.length} }}
|
.ofn-drop-down-prepend{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"}
|
||||||
.ofn-drop-down{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"}
|
{{ "spree.admin.orders.index.selected" | t:{count: selected_orders.length} }}
|
||||||
%span{ :class => 'icon-reorder' }
|
.ofn-drop-down{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"}
|
||||||
="#{t('admin.actions')}".html_safe
|
%span{ :class => 'icon-reorder' }
|
||||||
%span{ 'ng-class' => "expanded && 'icon-caret-up' || !expanded && 'icon-caret-down'" }
|
="#{t('admin.actions')}".html_safe
|
||||||
%div.menu{ 'ng-show' => "expanded" }
|
%span{ 'ng-class' => "expanded && 'icon-caret-up' || !expanded && 'icon-caret-down'" }
|
||||||
%div.menu_item
|
%div.menu{ 'ng-show' => "expanded" }
|
||||||
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "resend_confirmation" }
|
|
||||||
= t('.resend_confirmation')
|
|
||||||
- if Spree::Config[:enable_invoices?]
|
|
||||||
%div.menu_item
|
%div.menu_item
|
||||||
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "send_invoice" }
|
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "resend_confirmation" }
|
||||||
= t('.send_invoice')
|
= t('.resend_confirmation')
|
||||||
%div.menu_item
|
%div.menu_item
|
||||||
%span.name.invoices-modal{'ng-controller' => 'bulkInvoiceCtrl', 'ng-click' => 'createBulkInvoice()' }
|
%span.name.invoices-modal{'ng-controller' => 'bulkInvoiceCtrl', 'ng-click' => 'createBulkInvoice()' }
|
||||||
= t('.print_invoices')
|
= t('.print_invoices')
|
||||||
%div.menu_item
|
%div.menu_item
|
||||||
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "cancel_orders" }
|
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "cancel_orders" }
|
||||||
= t('.cancel_orders')
|
= t('.cancel_orders')
|
||||||
|
|
||||||
= render partial: 'admin/shared/angular_per_page_controls', locals: { position: "right", model: "orders" }
|
= render partial: 'admin/shared/angular_per_page_controls', locals: { position: "right", model: "orders" }
|
||||||
|
|
||||||
@@ -127,11 +124,6 @@
|
|||||||
= render ConfirmModalComponent.new(id: "resend_confirmation", confirm_actions: "click->resend-confirmation-email#confirm", controllers: "resend-confirmation-email") do
|
= render ConfirmModalComponent.new(id: "resend_confirmation", confirm_actions: "click->resend-confirmation-email#confirm", controllers: "resend-confirmation-email") do
|
||||||
.margin-bottom-30
|
.margin-bottom-30
|
||||||
= t('.resend_confirmation_confirm_html')
|
= t('.resend_confirmation_confirm_html')
|
||||||
|
|
||||||
= render ConfirmModalComponent.new(id: "send_invoice", confirm_actions: "click->send-invoice#confirm", controllers: "send-invoice") do
|
|
||||||
.margin-bottom-30
|
|
||||||
= t('.send_invoice_confirm_html')
|
|
||||||
|
|
||||||
= render ConfirmModalComponent.new(id: "cancel_orders", confirm_actions: "click->cancel-orders#confirm", controllers: "cancel-orders", message: "spree/admin/orders/messages/cancel_orders") do
|
= render ConfirmModalComponent.new(id: "cancel_orders", confirm_actions: "click->cancel-orders#confirm", controllers: "cancel-orders", message: "spree/admin/orders/messages/cancel_orders") do
|
||||||
.margin-bottom-30
|
.margin-bottom-30
|
||||||
= t("js.admin.orders.cancel_the_order_html")
|
= t("js.admin.orders.cancel_the_order_html")
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
= f.field_container :shipping_categories do
|
= f.field_container :shipping_categories do
|
||||||
= f.label :shipping_category_id, t(:shipping_categories)
|
= f.label :shipping_category_id, t(:shipping_categories)
|
||||||
= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, {}, { :class => 'select2' })
|
= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, { :include_blank => t(:none) }, { :class => 'select2' })
|
||||||
= f.error_message_on :shipping_category
|
= f.error_message_on :shipping_category
|
||||||
|
|
||||||
= f.field_container :tax_category do
|
= f.field_container :tax_category do
|
||||||
|
|||||||
@@ -5,6 +5,11 @@
|
|||||||
%span.icon-question-sign{ 'ofn-with-tip' => t('admin.products.seo.product_search_tip') }
|
%span.icon-question-sign{ 'ofn-with-tip' => t('admin.products.seo.product_search_tip') }
|
||||||
%br/
|
%br/
|
||||||
= f.text_field :meta_keywords, :class => 'fullwidth', :rows => 6
|
= f.text_field :meta_keywords, :class => 'fullwidth', :rows => 6
|
||||||
|
= f.field_container :meta_description do
|
||||||
|
= f.label :meta_description, t('admin.products.seo.SEO_keywords')
|
||||||
|
%span.icon-question-sign{ 'ofn-with-tip' => t('admin.products.seo.seo_tip') }
|
||||||
|
%br/
|
||||||
|
= f.text_field :meta_description, :class => 'fullwidth', :rows => 6
|
||||||
.alpha.eleven.columns
|
.alpha.eleven.columns
|
||||||
= f.field_container :notes do
|
= f.field_container :notes do
|
||||||
= f.label :notes, t(:notes)
|
= f.label :notes, t(:notes)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
= tab :orders, :subscriptions, :customer_details, :adjustments, :payments, :return_authorizations, url: admin_orders_path('q[s]' => 'completed_at desc'), icon: 'icon-shopping-cart'
|
= tab :orders, :subscriptions, :customer_details, :adjustments, :payments, :return_authorizations, url: admin_orders_path('q[s]' => 'completed_at desc'), icon: 'icon-shopping-cart'
|
||||||
= tab :reports, url: main_app.admin_reports_path, icon: 'icon-file'
|
= tab :reports, url: main_app.admin_reports_path, icon: 'icon-file'
|
||||||
= tab :general_settings, :mail_methods, :tax_categories, :tax_rates, :tax_settings, :zones, :countries, :states, :payment_methods, :taxonomies, :shipping_methods, :shipping_categories, :enterprise_fees, :contents, :invoice_settings, :matomo_settings, :stripe_connect_settings, label: 'configuration', icon: 'icon-wrench', url: edit_admin_general_settings_path
|
= tab :general_settings, :mail_methods, :tax_categories, :tax_rates, :tax_settings, :zones, :countries, :states, :payment_methods, :taxonomies, :shipping_methods, :shipping_categories, :enterprise_fees, :contents, :invoice_settings, :matomo_settings, :stripe_connect_settings, label: 'configuration', icon: 'icon-wrench', url: edit_admin_general_settings_path
|
||||||
= tab :enterprises, :enterprise_relationships, :vouchers, :oidc_settings, url: main_app.admin_enterprises_path
|
= tab :enterprises, :enterprise_relationships, :oidc_settings, url: main_app.admin_enterprises_path
|
||||||
= tab :customers, url: main_app.admin_customers_path
|
= tab :customers, url: main_app.admin_customers_path
|
||||||
= tab :enterprise_groups, url: main_app.admin_enterprise_groups_path, label: 'groups'
|
= tab :enterprise_groups, url: main_app.admin_enterprise_groups_path, label: 'groups'
|
||||||
- if can? :admin, Spree::User
|
- if can? :admin, Spree::User
|
||||||
|
|||||||
@@ -66,12 +66,12 @@
|
|||||||
.field
|
.field
|
||||||
= f.label 'weight', t(:weight)+' (kg)'
|
= f.label 'weight', t(:weight)+' (kg)'
|
||||||
- value = number_with_precision(@variant.weight, precision: 2)
|
- value = number_with_precision(@variant.weight, precision: 2)
|
||||||
= f.number_field 'weight', value: value, class: 'fullwidth', step: 0.01
|
= f.text_field 'weight', value: value, class: 'fullwidth'
|
||||||
|
|
||||||
- [:height, :width, :depth].each do |field|
|
- [:height, :width, :depth].each do |field|
|
||||||
.field
|
.field
|
||||||
= f.label field, t(field)
|
= f.label field, t(field)
|
||||||
- value = number_with_precision(@variant.send(field), precision: 2)
|
- value = number_with_precision(@variant.send(field), precision: 2)
|
||||||
= f.number_field field, value: value, class: 'fullwidth', step: 0.01
|
= f.text_field field, value: value, class: 'fullwidth'
|
||||||
|
|
||||||
.clear
|
.clear
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
%script{ type: "text/ng-template", id: "account/developer_settings.html" }
|
%script{ type: "text/ng-template", id: "account/developer_settings.html" }
|
||||||
%h3= t('.title')
|
%h3= t('.title')
|
||||||
= render partial: 'api_keys'
|
= render partial: 'api_keys'
|
||||||
= render partial: 'webhook_endpoints'
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
%section{ id: "webhook_endpoints" }
|
|
||||||
%hr
|
|
||||||
%h3= t('.title')
|
|
||||||
%p= t('.description')
|
|
||||||
|
|
||||||
%table{width: "100%"}
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th= t('.event_type.header')
|
|
||||||
%th= t('.url.header')
|
|
||||||
%th.actions
|
|
||||||
%tbody
|
|
||||||
-# Existing endpoints
|
|
||||||
- @user.webhook_endpoints.each do |webhook_endpoint|
|
|
||||||
%tr
|
|
||||||
%td= t('.event_types.order_cycle_opened') # For now, we only support one type.
|
|
||||||
%td= webhook_endpoint.url
|
|
||||||
%td.actions
|
|
||||||
- if webhook_endpoint.persisted?
|
|
||||||
= button_to account_webhook_endpoint_path(webhook_endpoint), method: :delete,
|
|
||||||
class: "tiny alert no-margin",
|
|
||||||
data: { confirm: I18n.t(:are_you_sure)} do
|
|
||||||
= I18n.t(:delete)
|
|
||||||
|
|
||||||
-# Create new
|
|
||||||
- if @user.webhook_endpoints.empty? # Only one allowed for now.
|
|
||||||
%tr
|
|
||||||
%td= t('.event_types.order_cycle_opened') # For now, we only support one type.
|
|
||||||
%td
|
|
||||||
= form_for(@user.webhook_endpoints.build, url: account_webhook_endpoints_path, id: 'new_webhook_endpoint') do |f|
|
|
||||||
= f.url_field :url, placeholder: t('.url.create_placeholder'), required: true, size: 64
|
|
||||||
%td.actions
|
|
||||||
= button_tag t(:create), class: 'button primary tiny no-margin', form: 'new_webhook_endpoint'
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import ApplicationController from "./application_controller";
|
|
||||||
|
|
||||||
export default class extends ApplicationController {
|
|
||||||
connect() {
|
|
||||||
super.connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
// abstract
|
|
||||||
confirm(action) {
|
|
||||||
this.stimulate(action, this.getOrdersIds());
|
|
||||||
}
|
|
||||||
|
|
||||||
// private
|
|
||||||
getOrdersIds() {
|
|
||||||
const checkboxes = document.querySelectorAll(
|
|
||||||
"#listing_orders input[name='order_ids[]']:checked"
|
|
||||||
);
|
|
||||||
return Array.from(checkboxes).map((checkbox) => checkbox.value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,6 @@ export default class extends Controller {
|
|||||||
// private
|
// private
|
||||||
|
|
||||||
populateSelect(sourceId) {
|
populateSelect(sourceId) {
|
||||||
this.tomselect = this.selectTarget.tomselect;
|
|
||||||
this.removeCurrentOptions();
|
this.removeCurrentOptions();
|
||||||
this.populateNewOptions(sourceId);
|
this.populateNewOptions(sourceId);
|
||||||
}
|
}
|
||||||
@@ -19,12 +18,8 @@ export default class extends Controller {
|
|||||||
removeCurrentOptions() {
|
removeCurrentOptions() {
|
||||||
this.selectTarget.innerHTML = "";
|
this.selectTarget.innerHTML = "";
|
||||||
|
|
||||||
if (!this.tomselect) {
|
this.selectTarget.tomselect?.clear();
|
||||||
return;
|
this.selectTarget.tomselect?.clearOptions();
|
||||||
}
|
|
||||||
|
|
||||||
this.tomselect.clear();
|
|
||||||
this.tomselect.clearOptions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
populateNewOptions(sourceId) {
|
populateNewOptions(sourceId) {
|
||||||
@@ -34,18 +29,8 @@ export default class extends Controller {
|
|||||||
this.addOption(item[0], item[1]);
|
this.addOption(item[0], item[1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.tomselect) {
|
this.selectTarget.tomselect?.sync();
|
||||||
return;
|
this.selectTarget.tomselect?.addItem(options[0]?.[1]);
|
||||||
}
|
|
||||||
|
|
||||||
if (options.length == 0) {
|
|
||||||
this.tomselect.disable();
|
|
||||||
} else {
|
|
||||||
this.tomselect.enable();
|
|
||||||
this.tomselect.addItem(options[0]?.[1]);
|
|
||||||
this.tomselect.sync();
|
|
||||||
this.tomselect.setValue(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addOption(label, value) {
|
addOption(label, value) {
|
||||||
@@ -56,7 +41,6 @@ export default class extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependentOptionsFor(sourceId) {
|
dependentOptionsFor(sourceId) {
|
||||||
let options = this.optionsValue.find((option) => option[0] === sourceId);
|
return this.optionsValue.find((option) => option[0] === sourceId)[1];
|
||||||
return options ? options[1] : [];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Controller } from "stimulus";
|
import { Controller } from "stimulus";
|
||||||
|
import CableReady from "cable_ready";
|
||||||
|
|
||||||
export default class extends Controller {
|
export default class extends Controller {
|
||||||
static targets = ["background", "modal", "email"];
|
static targets = ["background", "modal", "email"];
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Controller } from "stimulus";
|
import { Controller } from "stimulus";
|
||||||
|
import CableReady from "cable_ready";
|
||||||
|
|
||||||
export default class extends Controller {
|
export default class extends Controller {
|
||||||
static values = { primaryProducer: String, enterpriseSells: String };
|
static values = { primaryProducer: String, enterpriseSells: String };
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
import BulkActionsController from "./bulk_actions_controller";
|
import ApplicationController from "./application_controller";
|
||||||
|
|
||||||
export default class extends BulkActionsController {
|
export default class extends ApplicationController {
|
||||||
connect() {
|
connect() {
|
||||||
super.connect();
|
super.connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm() {
|
confirm() {
|
||||||
super.confirm("BulkActionsInOrdersList#resend_confirmation_email");
|
const order_ids = [];
|
||||||
|
document
|
||||||
|
.querySelectorAll("#listing_orders input[name='order_ids[]']:checked")
|
||||||
|
.forEach((checkbox) => {
|
||||||
|
order_ids.push(checkbox.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.stimulate("ResendConfirmationEmailReflex#confirm", order_ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user