annotate .svn/pristine/b6/b6683def4ff299aa9cca77fe57bb77ce73743047.svn-base @ 1519:afce8026aaeb redmine-2.4-integration

Merge from branch "live"
author Chris Cannam
date Tue, 09 Sep 2014 09:34:53 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 module PrependEngineViews
Chris@909 2 def self.included(base)
Chris@909 3 base.send(:include, InstanceMethods)
Chris@909 4 base.class_eval do
Chris@909 5 alias_method_chain :add_engine_view_paths, :prepend
Chris@909 6 end
Chris@909 7 end
Chris@909 8
Chris@909 9 module InstanceMethods
Chris@909 10 # Patch Rails so engine's views are prepended to the view_path,
Chris@909 11 # thereby letting plugins override application views
Chris@909 12 def add_engine_view_paths_with_prepend
Chris@909 13 paths = ActionView::PathSet.new(engines.collect(&:view_path))
Chris@909 14 ActionController::Base.view_paths.unshift(*paths)
Chris@909 15 ActionMailer::Base.view_paths.unshift(*paths) if configuration.frameworks.include?(:action_mailer)
Chris@909 16 end
Chris@909 17 end
Chris@909 18 end
Chris@909 19
Chris@909 20 Rails::Plugin::Loader.send :include, PrependEngineViews
Chris@909 21