diff .svn/pristine/b6/b6683def4ff299aa9cca77fe57bb77ce73743047.svn-base @ 909:cbb26bc654de redmine-1.3

Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author Chris Cannam
date Fri, 24 Feb 2012 19:09:32 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/pristine/b6/b6683def4ff299aa9cca77fe57bb77ce73743047.svn-base	Fri Feb 24 19:09:32 2012 +0000
@@ -0,0 +1,21 @@
+module PrependEngineViews
+  def self.included(base)
+    base.send(:include, InstanceMethods)
+    base.class_eval do
+      alias_method_chain :add_engine_view_paths, :prepend
+    end
+  end
+
+  module InstanceMethods
+    # Patch Rails so engine's views are prepended to the view_path,
+    # thereby letting plugins override application views
+    def add_engine_view_paths_with_prepend
+      paths = ActionView::PathSet.new(engines.collect(&:view_path))
+      ActionController::Base.view_paths.unshift(*paths)
+      ActionMailer::Base.view_paths.unshift(*paths) if configuration.frameworks.include?(:action_mailer)
+    end
+  end
+end
+
+Rails::Plugin::Loader.send :include, PrependEngineViews
+