Permalink
Browse files

Revert "Moved TemplateHandlers to Base"

This reverts commit 42d215a.

Conflicts:

	actionpack/lib/action_view/inline_template.rb
	actionpack/lib/action_view/template.rb
  • Loading branch information...
1 parent bad1eac commit 01637796d712943ebf9e9a76aa5c708edfab4d02 @josh josh committed Jul 4, 2008
@@ -151,7 +151,6 @@ class MissingTemplate < ActionViewError #:nodoc:
#
# See the ActionView::Helpers::PrototypeHelper::GeneratorMethods documentation for more details.
class Base
- extend TemplateHandlers
include ERB::Util
attr_accessor :base_path, :assigns, :template_extension, :first_render
@@ -32,7 +32,7 @@ module CacheHelper
# <i>Topics listed alphabetically</i>
# <% end %>
def cache(name = {}, options = nil, &block)
- handler = Base.handler_class_for_extension(current_render_extension.to_sym)
+ handler = Template.handler_class_for_extension(current_render_extension.to_sym)
handler.new(@controller).cache_fragment(block, name, options)
end
end
@@ -10,7 +10,7 @@ def initialize(view, source, locals = {}, type = nil)
@locals = locals || {}
@method_key = @source
- @handler = Base.handler_class_for_extension(@extension).new(@view)
+ @handler = Template.handler_class_for_extension(@extension).new(@view)
end
end
end
@@ -1,12 +1,8 @@
module ActionView #:nodoc:
class Template #:nodoc:
+ extend TemplateHandlers
include Renderer
- class << self
- # TODO: Deprecate
- delegate :register_template_handler, :to => 'ActionView::Base'
- end
-
attr_reader :path, :extension
def initialize(view, path, use_full_path = nil, locals = {})
@@ -25,7 +21,7 @@ def initialize(view, path, use_full_path = nil, locals = {})
@method_key = @filename
@locals = locals || {}
- @handler = Base.handler_class_for_extension(@extension).new(@view)
+ @handler = self.class.handler_class_for_extension(@extension).new(@view)
end
def render_template
@@ -40,7 +40,7 @@ def render(template)
end
end
-ActionView::Base.register_template_handler :mab, MabView
+ActionView::Template::register_template_handler :mab, MabView
class LayoutAutoDiscoveryTest < Test::Unit::TestCase
def setup
@@ -101,12 +101,12 @@ def render(template)
end
def test_render_inline_with_custom_type
- ActionView::Base.register_template_handler :foo, CustomHandler
+ ActionView::Template.register_template_handler :foo, CustomHandler
assert_equal '["Hello, World!", {}]', @view.render(:inline => "Hello, World!", :type => :foo)
end
def test_render_inline_with_locals_and_custom_type
- ActionView::Base.register_template_handler :foo, CustomHandler
+ ActionView::Template.register_template_handler :foo, CustomHandler
assert_equal '["Hello, <%= name %>!", {:name=>"Josh"}]', @view.render(:inline => "Hello, <%= name %>!", :locals => { :name => "Josh" }, :type => :foo)
end
@@ -121,12 +121,12 @@ def compile(template)
end
def test_render_inline_with_compilable_custom_type
- ActionView::Base.register_template_handler :foo, CompilableCustomHandler
+ ActionView::Template.register_template_handler :foo, CompilableCustomHandler
assert_equal 'locals: {}, source: "Hello, World!"', @view.render(:inline => "Hello, World!", :type => :foo)
end
def test_render_inline_with_locals_and_compilable_custom_type
- ActionView::Base.register_template_handler :foo, CompilableCustomHandler
+ ActionView::Template.register_template_handler :foo, CompilableCustomHandler
assert_equal 'locals: {:name=>"Josh"}, source: "Hello, <%= name %>!"', @view.render(:inline => "Hello, <%= name %>!", :locals => { :name => "Josh" }, :type => :foo)
end
end

0 comments on commit 0163779

Please sign in to comment.