2009-05-21 17:22:07 -04:00
|
|
|
require "active_support/core_ext/class/inheritable_attributes"
|
2009-05-21 19:35:40 -04:00
|
|
|
require "action_dispatch/http/mime_type"
|
2009-05-21 17:22:07 -04:00
|
|
|
|
2008-07-18 17:00:20 -04:00
|
|
|
# Legacy TemplateHandler stub
|
|
|
|
module ActionView
|
2008-11-23 14:57:01 -05:00
|
|
|
module TemplateHandlers #:nodoc:
|
|
|
|
module Compilable
|
|
|
|
def self.included(base)
|
|
|
|
base.extend(ClassMethods)
|
|
|
|
end
|
|
|
|
|
|
|
|
module ClassMethods
|
|
|
|
def call(template)
|
|
|
|
new.compile(template)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def compile(template)
|
|
|
|
raise "Need to implement #{self.class.name}#compile(template)"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2008-07-18 17:00:20 -04:00
|
|
|
class TemplateHandler
|
2009-05-21 17:22:07 -04:00
|
|
|
extlib_inheritable_accessor :default_format
|
|
|
|
self.default_format = Mime::HTML
|
|
|
|
|
2008-07-18 17:00:20 -04:00
|
|
|
def self.call(template)
|
2008-11-23 14:57:01 -05:00
|
|
|
"#{name}.new(self).render(template, local_assigns)"
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(view = nil)
|
|
|
|
@view = view
|
|
|
|
end
|
|
|
|
|
|
|
|
def render(template, local_assigns)
|
|
|
|
raise "Need to implement #{self.class.name}#render(template, local_assigns)"
|
2008-01-10 23:45:06 -05:00
|
|
|
end
|
2007-12-09 17:11:11 -05:00
|
|
|
end
|
|
|
|
end
|