Move view_context definition back into System.setup

This commit is contained in:
Ryan Fitzgerald 2012-07-18 17:58:12 -07:00
parent c54341c1d9
commit 5b9288b3f6
4 changed files with 7 additions and 10 deletions

View File

@ -10,7 +10,6 @@ require 'draper/helper_support'
require 'draper/view_context'
require 'draper/decorated_enumerable_proxy'
require 'draper/railtie' if defined?(Rails)
require 'draper/action_controller/base'
# Test Support
require 'draper/test/rspec_integration' if defined?(RSpec) and RSpec.respond_to?(:configure)

View File

@ -1,9 +0,0 @@
module DraperViewContext
def view_context
super.tap do |context|
Draper::ViewContext.current = context
end
end
end
ActionController::Base.send(:include, DraperViewContext)

View File

@ -2,6 +2,7 @@ module Draper
class System
def self.setup(component)
component.class_eval do
include Draper::ViewContext
extend Draper::HelperSupport unless defined?(::ActionMailer) && self.is_a?(::ActionMailer::Base)
end
end

View File

@ -7,5 +7,11 @@ module Draper
def self.current=(input)
Thread.current[:current_view_context] = input
end
def view_context
super.tap do |context|
Draper::ViewContext.current = context
end
end
end
end