diff --git a/Gemfile b/Gemfile index ebd168f..f3c6184 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,7 @@ group :test do gem "pg", "~> 1.0" if ENV["DB"] == "postgresql" end +gem "solidus_support", github: "mamhoff/solidus_support", branch: "re-enable-flickwerk" gem "github_fast_changelog", require: false gem "standardrb", "~> 1.0", require: false diff --git a/alchemy-devise.gemspec b/alchemy-devise.gemspec index e388ed7..15bde19 100644 --- a/alchemy-devise.gemspec +++ b/alchemy-devise.gemspec @@ -17,6 +17,7 @@ Gem::Specification.new do |s| s.add_dependency "alchemy_cms", ["~> 7.0"] s.add_dependency "devise", ["~> 4.9"] + s.add_dependency "flickwerk", ["~> 0.3.4"] s.add_development_dependency "capybara" s.add_development_dependency "factory_bot_rails" diff --git a/app/controllers/alchemy/base_controller_extension.rb b/app/controllers/alchemy/base_controller_extension.rb deleted file mode 100644 index 8300592..0000000 --- a/app/controllers/alchemy/base_controller_extension.rb +++ /dev/null @@ -1,18 +0,0 @@ -module Alchemy - module BaseControllerExtension - def self.prepended(base) - base.before_action(:store_user_request_time) - end - - private - - # Stores the users request time. - def store_user_request_time - if alchemy_user_signed_in? - current_alchemy_user.store_request_time! - end - end - end -end - -Alchemy::BaseController.prepend Alchemy::BaseControllerExtension diff --git a/app/patches/controllers/alchemy/devise/base_controller_patch.rb b/app/patches/controllers/alchemy/devise/base_controller_patch.rb new file mode 100644 index 0000000..89337e1 --- /dev/null +++ b/app/patches/controllers/alchemy/devise/base_controller_patch.rb @@ -0,0 +1,19 @@ +module Alchemy + module Devise + module BaseControllerPatch + def self.prepended(base) + base.before_action(:store_user_request_time) + end + + private + + # Stores the users request time. + def store_user_request_time + if alchemy_user_signed_in? + current_alchemy_user.store_request_time! + end + end + Alchemy::BaseController.prepend self + end + end +end diff --git a/lib/alchemy/devise/engine.rb b/lib/alchemy/devise/engine.rb index d172e3a..b4c07d9 100644 --- a/lib/alchemy/devise/engine.rb +++ b/lib/alchemy/devise/engine.rb @@ -1,9 +1,11 @@ require "alchemy_cms" require "devise" +require "flickwerk" module Alchemy module Devise class Engine < ::Rails::Engine + include Flickwerk isolate_namespace Alchemy engine_name "alchemy_devise" @@ -16,10 +18,6 @@ class Engine < ::Rails::Engine "alchemy-devise.css" ] end - - config.to_prepare do - require_relative "../../../app/controllers/alchemy/base_controller_extension" - end end end end