Clean up patches Part VII

* move version controller patch to proper place
pull/6827/head
Gregor Schmidt 13 years ago
parent 872a198016
commit c0077b2c33
  1. 2
      init.rb
  2. 25
      lib/backlogs_version_controller_patch.rb
  3. 18
      lib/redmine_backlogs/patches/version_controller_patch.rb

@ -13,7 +13,6 @@ Dispatcher.to_prepare do
end
require_dependency 'backlogs_version_patch'
require_dependency 'backlogs_version_controller_patch'
require_dependency 'backlogs_hooks'
require_dependency 'project_model_patch'
@ -25,6 +24,7 @@ Dispatcher.to_prepare do
require_dependency 'redmine_backlogs/patches/my_controller_patch'
require_dependency 'redmine_backlogs/patches/query_patch'
require_dependency 'redmine_backlogs/patches/user_patch'
require_dependency 'redmine_backlogs/patches/version_controller_patch'
require_dependency 'redmine_backlogs/issue_view'
require_dependency 'redmine_backlogs/issue_form'

@ -1,25 +0,0 @@
module Backlogs
module VersionsControllerPatch
def self.included(base)
base.extend(ClassMethods)
base.class_eval do
unloadable
include VersionSettingsHelper
helper :version_settings
find_project_explicitly_on_update
end
end
module ClassMethods
private
def find_project_explicitly_on_update
filter_chain.detect{|m| m.method == :find_project_from_association }.options[:except] << "update"
filter_chain.detect{|m| m.method == :find_project }.options[:only] << "update"
end
end
end
end
VersionsController.send(:include, Backlogs::VersionsControllerPatch)

@ -0,0 +1,18 @@
require_dependency 'versions_controller'
module RedmineBacklogs::Patches::VersionsControllerPatch
def self.included(base)
base.class_eval do
unloadable
include VersionSettingsHelper
helper :version_settings
# find project explicitly on update
filter_chain.detect { |m| m.method == :find_project_from_association }.options[:except] << "update"
filter_chain.detect { |m| m.method == :find_project }.options[:only] << "update"
end
end
end
VersionsController.send(:include, RedmineBacklogs::Patches::VersionsControllerPatch)
Loading…
Cancel
Save