Created
August 27, 2015 10:18
-
-
Save n-rodriguez/abe8c0c20e54e502062c to your computer and use it in GitHub Desktop.
Redmine Contact Loading Patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/init.rb b/init.rb | |
index 57ff0d8..c2d2bdb 100755 | |
--- a/init.rb | |
+++ b/init.rb | |
@@ -107,6 +107,4 @@ Redmine::Plugin.register :redmine_contacts do | |
end | |
-ActionDispatch::Callbacks.to_prepare do | |
- require 'redmine_contacts' | |
-end | |
+require 'redmine_contacts' | |
diff --git a/lib/redmine_contacts.rb b/lib/redmine_contacts.rb | |
index 4dbadf6..6f8b483 100644 | |
--- a/lib/redmine_contacts.rb | |
+++ b/lib/redmine_contacts.rb | |
@@ -25,40 +25,41 @@ require 'redmine_contacts/helpers/crm_calendar_helper' | |
require 'acts_as_viewable/init' | |
require 'acts_as_priceable/init' | |
-require_dependency 'redmine_contacts/utils/thumbnail' | |
-require_dependency 'redmine_contacts/utils/check_mail' | |
-require_dependency 'redmine_contacts/utils/date_utils' | |
-require_dependency 'redmine_contacts/utils/csv_utils' | |
-require_dependency 'redmine_contacts/contacts_project_setting' | |
+# Hooks | |
+require 'redmine_contacts/hooks/views_projects_hook' | |
+require 'redmine_contacts/hooks/views_issues_hook' | |
+require 'redmine_contacts/hooks/views_layouts_hook' | |
-# Patches | |
-require_dependency 'redmine_contacts/patches/compatibility/active_record_base_patch' | |
-require_dependency 'redmine_contacts/patches/compatibility/active_record_sanitization_patch.rb' | |
-require_dependency 'redmine_contacts/patches/compatibility/user_patch.rb' | |
-require_dependency 'redmine_contacts/patches/compatibility_patch' | |
-require_dependency 'redmine_contacts/patches/issue_patch' | |
-require_dependency 'redmine_contacts/patches/project_patch' | |
-require_dependency 'redmine_contacts/patches/mailer_patch' | |
-require_dependency 'redmine_contacts/patches/notifiable_patch' | |
-require_dependency 'redmine_contacts/patches/application_controller_patch' | |
-require_dependency 'redmine_contacts/patches/attachments_controller_patch' | |
-require_dependency 'redmine_contacts/patches/auto_completes_controller_patch' | |
-require_dependency 'redmine_contacts/patches/issue_query_patch' | |
-require_dependency 'redmine_contacts/patches/queries_helper_patch' | |
-require_dependency 'redmine_contacts/patches/timelog_helper_patch' | |
-require_dependency 'redmine_contacts/patches/projects_helper_patch' | |
+Rails.configuration.to_prepare do | |
+ require_dependency 'redmine_contacts/utils/thumbnail' | |
+ require_dependency 'redmine_contacts/utils/check_mail' | |
+ require_dependency 'redmine_contacts/utils/date_utils' | |
+ require_dependency 'redmine_contacts/utils/csv_utils' | |
+ require_dependency 'redmine_contacts/contacts_project_setting' | |
-require_dependency 'redmine_contacts/wiki_macros/contacts_wiki_macros' | |
+ # Patches | |
+ require_dependency 'redmine_contacts/patches/compatibility/active_record_base_patch' | |
+ require_dependency 'redmine_contacts/patches/compatibility/active_record_sanitization_patch.rb' | |
+ require_dependency 'redmine_contacts/patches/compatibility/user_patch.rb' | |
+ require_dependency 'redmine_contacts/patches/compatibility_patch' | |
+ require_dependency 'redmine_contacts/patches/issue_patch' | |
+ require_dependency 'redmine_contacts/patches/project_patch' | |
+ require_dependency 'redmine_contacts/patches/mailer_patch' | |
+ require_dependency 'redmine_contacts/patches/notifiable_patch' | |
+ require_dependency 'redmine_contacts/patches/application_controller_patch' | |
+ require_dependency 'redmine_contacts/patches/attachments_controller_patch' | |
+ require_dependency 'redmine_contacts/patches/auto_completes_controller_patch' | |
+ require_dependency 'redmine_contacts/patches/issue_query_patch' | |
+ require_dependency 'redmine_contacts/patches/queries_helper_patch' | |
+ require_dependency 'redmine_contacts/patches/timelog_helper_patch' | |
+ require_dependency 'redmine_contacts/patches/projects_helper_patch' | |
-# Hooks | |
-require_dependency 'redmine_contacts/hooks/views_projects_hook' | |
-require_dependency 'redmine_contacts/hooks/views_issues_hook' | |
-require_dependency 'redmine_contacts/hooks/views_layouts_hook' | |
+ require_dependency 'redmine_contacts/wiki_macros/contacts_wiki_macros' | |
+end | |
require 'redmine_contacts/liquid/liquid' if Object.const_defined?("Liquid") rescue false | |
- | |
module RedmineContacts | |
def self.companies_select | |
diff --git a/lib/redmine_contacts/patches/application_controller_patch.rb b/lib/redmine_contacts/patches/application_controller_patch.rb | |
index 0c40099..29b43bf 100644 | |
--- a/lib/redmine_contacts/patches/application_controller_patch.rb | |
+++ b/lib/redmine_contacts/patches/application_controller_patch.rb | |
@@ -1,3 +1,5 @@ | |
+require_dependency 'application_controller' | |
+ | |
# This file is a part of Redmine CRM (redmine_contacts) plugin, | |
# customer relationship management plugin for Redmine | |
# | |
@@ -20,21 +22,26 @@ | |
module RedmineContacts | |
module Patches | |
module ApplicationControllerPatch | |
+ | |
def self.included(base) | |
base.send(:include, InstanceMethods) | |
- | |
base.class_eval do | |
+ unloadable | |
+ | |
alias_method_chain :user_setup, :contacts | |
end | |
end | |
+ | |
module InstanceMethods | |
+ | |
def user_setup_with_contacts | |
user_setup_without_contacts | |
ContactsSetting.check_cache | |
end | |
end | |
+ | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment