mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
Remove System namespace
This commit is contained in:
parent
cfbc3888e9
commit
4f9b23c077
4 changed files with 27 additions and 25 deletions
|
@ -1,7 +1,6 @@
|
||||||
require 'action_view'
|
require 'action_view'
|
||||||
|
|
||||||
require 'draper/version'
|
require 'draper/version'
|
||||||
require 'draper/system'
|
|
||||||
require 'draper/view_helpers'
|
require 'draper/view_helpers'
|
||||||
require 'draper/finders'
|
require 'draper/finders'
|
||||||
require 'draper/decorator'
|
require 'draper/decorator'
|
||||||
|
@ -20,6 +19,29 @@ require 'draper/test/rspec_integration' if defined?(RSpec) and RSpec.respond_
|
||||||
require 'draper/test/minitest_integration' if defined?(MiniTest::Rails)
|
require 'draper/test/minitest_integration' if defined?(MiniTest::Rails)
|
||||||
|
|
||||||
module Draper
|
module Draper
|
||||||
|
def self.setup_action_controller(base)
|
||||||
|
base.class_eval do
|
||||||
|
include Draper::ViewContext
|
||||||
|
extend Draper::HelperSupport
|
||||||
|
before_filter ->(controller) {
|
||||||
|
Draper::ViewContext.current = nil
|
||||||
|
Draper::ViewContext.current_controller = controller
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.setup_action_mailer(base)
|
||||||
|
base.class_eval do
|
||||||
|
include Draper::ViewContext
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.setup_active_record(base)
|
||||||
|
base.class_eval do
|
||||||
|
include Draper::Decoratable
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class UninferrableDecoratorError < NameError
|
class UninferrableDecoratorError < NameError
|
||||||
def initialize(klass)
|
def initialize(klass)
|
||||||
super("Could not infer a decorator for #{klass}.")
|
super("Could not infer a decorator for #{klass}.")
|
||||||
|
|
|
@ -24,19 +24,19 @@ module Draper
|
||||||
|
|
||||||
initializer "draper.extend_action_controller_base" do |app|
|
initializer "draper.extend_action_controller_base" do |app|
|
||||||
ActiveSupport.on_load(:action_controller) do
|
ActiveSupport.on_load(:action_controller) do
|
||||||
Draper::System.setup_action_controller(self)
|
Draper.setup_action_controller(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
initializer "draper.extend_action_mailer_base" do |app|
|
initializer "draper.extend_action_mailer_base" do |app|
|
||||||
ActiveSupport.on_load(:action_mailer) do
|
ActiveSupport.on_load(:action_mailer) do
|
||||||
Draper::System.setup_action_mailer(self)
|
Draper.setup_action_mailer(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
initializer "draper.extend_active_record_base" do |app|
|
initializer "draper.extend_active_record_base" do |app|
|
||||||
ActiveSupport.on_load(:active_record) do
|
ActiveSupport.on_load(:active_record) do
|
||||||
self.send(:include, Draper::Decoratable)
|
Draper.setup_active_record(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
module Draper
|
|
||||||
class System
|
|
||||||
def self.setup_action_controller(component)
|
|
||||||
component.class_eval do
|
|
||||||
include Draper::ViewContext
|
|
||||||
extend Draper::HelperSupport
|
|
||||||
before_filter lambda {|controller|
|
|
||||||
Draper::ViewContext.current = nil
|
|
||||||
Draper::ViewContext.current_controller = controller
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.setup_action_mailer(component)
|
|
||||||
component.class_eval do
|
|
||||||
include Draper::ViewContext
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,6 +1,6 @@
|
||||||
module ActionController
|
module ActionController
|
||||||
class Base
|
class Base
|
||||||
Draper::System.setup_action_controller(self)
|
Draper.setup_action_controller(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue