diff --git a/app/decorators/controllers/alchemy/solidus/alchemy_base_controller_decorator.rb b/app/decorators/controllers/alchemy/solidus/alchemy_base_controller_decorator.rb new file mode 100644 index 0000000..2c79d4e --- /dev/null +++ b/app/decorators/controllers/alchemy/solidus/alchemy_base_controller_decorator.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Alchemy + module Solidus + module AlchemyBaseControllerDecorator + def self.prepended(base) + base.include Spree::Core::ControllerHelpers::Auth + base.include Spree::Core::ControllerHelpers::Common + base.include Spree::Core::ControllerHelpers::Order + base.include Spree::Core::ControllerHelpers::PaymentParameters + base.include Spree::Core::ControllerHelpers::Pricing + base.include Spree::Core::ControllerHelpers::Search + base.include Spree::Core::ControllerHelpers::Store + base.include Spree::Core::ControllerHelpers::StrongParameters + end + + if defined?(::Alchemy::BaseController) + ::Alchemy::BaseController.prepend self + end + end + end +end diff --git a/app/decorators/helpers/alchemy/solidus/alchemy_base_helper_decorator.rb b/app/decorators/helpers/alchemy/solidus/alchemy_base_helper_decorator.rb new file mode 100644 index 0000000..03a3f48 --- /dev/null +++ b/app/decorators/helpers/alchemy/solidus/alchemy_base_helper_decorator.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Alchemy + module Solidus + module AlchemyBaseHelperDecorator + def self.prepended(base) + base.include Spree::BaseHelper + base.include Spree::CheckoutHelper + base.include Spree::ProductsHelper + base.include Spree::StoreHelper + base.include Spree::TaxonsHelper + end + + if defined?(::Alchemy::BaseHelper) + ::Alchemy::BaseHelper.prepend self + end + end + end +end diff --git a/lib/alchemy/solidus/engine.rb b/lib/alchemy/solidus/engine.rb index 66596f8..ab3de68 100644 --- a/lib/alchemy/solidus/engine.rb +++ b/lib/alchemy/solidus/engine.rb @@ -36,9 +36,6 @@ class Engine < ::Rails::Engine # See https://github.com/AlchemyCMS/alchemy_cms/issues/1626 ActionView::Base.prefix_partial_path_with_controller_namespace = false end - - # Allows to use Solidus helpers within Alchemys controller views - require_dependency "alchemy/solidus/use_solidus_layout" end end end diff --git a/lib/alchemy/solidus/use_solidus_layout.rb b/lib/alchemy/solidus/use_solidus_layout.rb deleted file mode 100644 index c965745..0000000 --- a/lib/alchemy/solidus/use_solidus_layout.rb +++ /dev/null @@ -1,19 +0,0 @@ -# Allows to use Solidus helpers within Alchemys controller views -Alchemy::BaseHelper.include( - Spree::BaseHelper, - Spree::CheckoutHelper, - Spree::ProductsHelper, - Spree::StoreHelper, - Spree::TaxonsHelper -) - -Alchemy::BaseController.include( - Spree::Core::ControllerHelpers::Auth, - Spree::Core::ControllerHelpers::Common, - Spree::Core::ControllerHelpers::Order, - Spree::Core::ControllerHelpers::PaymentParameters, - Spree::Core::ControllerHelpers::Pricing, - Spree::Core::ControllerHelpers::Search, - Spree::Core::ControllerHelpers::Store, - Spree::Core::ControllerHelpers::StrongParameters -)