diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index a99e9d7831c0f4ef125d34649c51b467d9efa770..3f85c3810662791b30f6801562160964633a855a 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,19 @@ *SVN* +* Add the ability to call JavaScriptGenerator methods from helpers called in update blocks. [Sam Stephenson] Example: + module ApplicationHelper + def update_time + page.replace_html 'time', Time.now.to_s(:db) + page.visual_effect :highlight, 'time' + end + end + + class UserController < ApplicationController + def poll + render :update { |page| page.update_time } + end + end + * Add render(:update) to ActionView::Base. [Sam Stephenson] * Fix render(:update) to not render layouts. [Sam Stephenson] diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 0a9368f68458aca1d0bb4f6349a40ea8a97b7f3b..7f8ff5ed098ad4c6696cf5964a08c609bef11344 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -687,7 +687,7 @@ def render_text(text = nil, status = nil) end def render_javascript(javascript, status = nil) - @response.headers['Content-type'] = 'text/javascript' + @response.headers['Content-Type'] = 'text/javascript' render_text(javascript, status) end @@ -719,7 +719,8 @@ def erase_render_results @response.body = nil @performed_render = false end - + + # Clears the redirected results from the headers, resets the status to 200 and returns # the URL that was used to redirect or nil if there was no redirected URL # Note that +redirect_to+ will change the body of the response to indicate a redirection. diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index d35334a98c60c86f5f08ff75678efca1a9dc66e8..27dc9c93cfa7bfb4a05452e9fede16e4ca8a7fd1 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -370,34 +370,52 @@ def observe_form(form_id, options = {}) # this in your Ajax response bodies, either in a ), sortable_element("mylist", :url => { :action => "order" })