aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorCarlhuda <carlhuda@engineyard.com>2010-03-17 16:28:05 -0700
committerCarlhuda <carlhuda@engineyard.com>2010-03-17 16:29:35 -0700
commitd9375f3f302a5d1856ad57946c7263d4e6a45a2a (patch)
tree76769a45da7b1315df173976067ff37edcb59b49 /actionpack/lib/action_view
parent7872fa9a4397c450ee22c511966e149d594d153e (diff)
downloadrails-d9375f3f302a5d1856ad57946c7263d4e6a45a2a.tar.gz
rails-d9375f3f302a5d1856ad57946c7263d4e6a45a2a.tar.bz2
rails-d9375f3f302a5d1856ad57946c7263d4e6a45a2a.zip
Modify assert_template to use notifications. Also, remove ActionController::Base#template since it is no longer needed.
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/base.rb9
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb2
-rw-r--r--actionpack/lib/action_view/render/rendering.rb3
-rw-r--r--actionpack/lib/action_view/test_case.rb4
4 files changed, 12 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index 326b79f9bf..4d9f53cf95 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -196,7 +196,7 @@ module ActionView #:nodoc:
end
attr_accessor :base_path, :assigns, :template_extension, :lookup_context
- attr_internal :captures, :request, :layout, :controller, :template, :config
+ attr_internal :captures, :request, :controller, :template, :config
delegate :find_template, :template_exists?, :formats, :formats=, :locale, :locale=,
:view_paths, :view_paths=, :with_fallbacks, :update_details, :to => :lookup_context
@@ -206,6 +206,11 @@ module ActionView #:nodoc:
delegate :logger, :to => :controller, :allow_nil => true
+ # TODO: HACK FOR RJS
+ def view_context
+ self
+ end
+
def self.xss_safe? #:nodoc:
true
end
@@ -254,7 +259,7 @@ module ActionView #:nodoc:
@helpers = self.class.helpers || Module.new
@_controller = controller
- @_config = ActiveSupport::InheritableOptions.new(controller.config) if controller
+ @_config = ActiveSupport::InheritableOptions.new(controller.config) if controller && controller.respond_to?(:config)
@_content_for = Hash.new { |h,k| h[k] = ActiveSupport::SafeBuffer.new }
@_virtual_path = nil
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb
index 2e5fe5744e..aba2565c67 100644
--- a/actionpack/lib/action_view/helpers/prototype_helper.rb
+++ b/actionpack/lib/action_view/helpers/prototype_helper.rb
@@ -582,7 +582,7 @@ module ActionView
# page.hide 'spinner'
# end
def update_page(&block)
- JavaScriptGenerator.new(@template, &block).to_s.html_safe
+ JavaScriptGenerator.new(view_context, &block).to_s.html_safe
end
# Works like update_page but wraps the generated JavaScript in a <script>
diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb
index d8dfd5077b..b0fed556c3 100644
--- a/actionpack/lib/action_view/render/rendering.rb
+++ b/actionpack/lib/action_view/render/rendering.rb
@@ -53,13 +53,12 @@ module ActionView
layout = find_layout(layout) if layout
ActiveSupport::Notifications.instrument("action_view.render_template",
- :identifier => template.identifier, :layout => layout.try(:identifier)) do
+ :identifier => template.identifier, :layout => layout.try(:virtual_path)) do
content = template.render(self, locals) { |*name| _layout_for(*name) }
@_content_for[:layout] = content
if layout
- @_layout = layout.identifier
content = _render_layout(layout, locals)
end
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb
index 1c69c23bfc..b0ababe344 100644
--- a/actionpack/lib/action_view/test_case.rb
+++ b/actionpack/lib/action_view/test_case.rb
@@ -4,6 +4,8 @@ require 'action_view'
module ActionView
class TestCase < ActiveSupport::TestCase
class TestController < ActionController::Base
+ include ActionDispatch::TestProcess
+
attr_accessor :request, :response, :params
def self.controller_path
@@ -44,7 +46,7 @@ module ActionView
end
def config
- @controller.config
+ @controller.config if @controller.respond_to?(:config)
end
def render(options = {}, local_assigns = {}, &block)