prevent duplicate loading of patch

We have to patch the originating module and not the application helper for that
pull/6827/head
Jens Ulferts 10 years ago
parent bb204c508c
commit b608e0e207
  1. 7
      lib/open_project/documents/engine.rb
  2. 6
      lib/open_project/documents/patches/text_formatting_patch.rb

@ -60,7 +60,7 @@ module OpenProject::Documents
Redmine::Search.register :documents
end
patches [:ApplicationHelper, :CustomFieldsHelper, :Project]
patches [:CustomFieldsHelper, :Project]
assets %w(documents.css)
@ -75,6 +75,11 @@ module OpenProject::Documents
config.to_prepare do
require_dependency 'document_category'
require_dependency 'document_category_custom_field'
# Have to apply this one by hand and not via op_engine patches method
# becauses the op_engine method does not allow for patching something
# in the lib/open_project directory. Bummer.
require_dependency 'open_project/documents/patches/text_formatting_patch'
end
end
end

@ -30,7 +30,7 @@
#++
module OpenProject::Documents::Patches
module ApplicationHelperPatch
module TextFormattingPatch
def self.included(base)
base.class_eval do
@ -69,6 +69,6 @@ module OpenProject::Documents::Patches
end
end
unless ApplicationHelper.included_modules.include?(OpenProject::Documents::Patches::ApplicationHelperPatch)
ApplicationHelper.send(:include, OpenProject::Documents::Patches::ApplicationHelperPatch)
unless OpenProject::TextFormatting.included_modules.include?(OpenProject::Documents::Patches::TextFormattingPatch)
OpenProject::TextFormatting.send(:include, OpenProject::Documents::Patches::TextFormattingPatch)
end
Loading…
Cancel
Save