Skip to content

Commit

Permalink
Add reloader callback on engine initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
entantoencuanto committed Oct 8, 2021
1 parent 09ed1a8 commit 30d0266
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
6 changes: 4 additions & 2 deletions lib/decidim/extra_user_fields/admin_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ class AdminEngine < ::Rails::Engine
end

initializer "decidim_extra_user_fields.admin_export_users" do
Decidim::Admin::ApplicationHelper.class_eval do
include ExtraUserFields::Admin::ApplicationHelper
config.to_prepare do
Decidim::Admin::ApplicationHelper.class_eval do
include ExtraUserFields::Admin::ApplicationHelper
end
end
end

Expand Down
54 changes: 28 additions & 26 deletions lib/decidim/extra_user_fields/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,34 @@ class Engine < ::Rails::Engine
end

initializer "decidim_extra_user_fields.registration_additions" do
Decidim::RegistrationForm.class_eval do
include ExtraUserFields::FormsDefinitions
end

Decidim::OmniauthRegistrationForm.class_eval do
include ExtraUserFields::FormsDefinitions
end

Decidim::AccountForm.class_eval do
include ExtraUserFields::FormsDefinitions
end

Decidim::CreateRegistration.class_eval do
prepend ExtraUserFields::CommandsOverrides
end

Decidim::CreateOmniauthRegistration.class_eval do
prepend ExtraUserFields::OmniauthCommandsOverrides
end

Decidim::UpdateAccount.class_eval do
prepend ExtraUserFields::CommandsOverrides
end

Decidim::FormBuilder.class_eval do
include ExtraUserFields::FormBuilderMethods
config.to_prepare do
Decidim::RegistrationForm.class_eval do
include ExtraUserFields::FormsDefinitions
end

Decidim::OmniauthRegistrationForm.class_eval do
include ExtraUserFields::FormsDefinitions
end

Decidim::AccountForm.class_eval do
include ExtraUserFields::FormsDefinitions
end

Decidim::CreateRegistration.class_eval do
prepend ExtraUserFields::CommandsOverrides
end

Decidim::CreateOmniauthRegistration.class_eval do
prepend ExtraUserFields::OmniauthCommandsOverrides
end

Decidim::UpdateAccount.class_eval do
prepend ExtraUserFields::CommandsOverrides
end

Decidim::FormBuilder.class_eval do
include ExtraUserFields::FormBuilderMethods
end
end
end
end
Expand Down

0 comments on commit 30d0266

Please sign in to comment.