mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add RJS#page.reload. [#277 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
This commit is contained in:
parent
82e96eb294
commit
30a0ebb3eb
3 changed files with 17 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
*Edge*
|
||||
|
||||
* Added page.reload functionality. Resolves #277. [Sean Huber]
|
||||
|
||||
* Fixed Request#remote_ip to only raise hell if the HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR doesn't match (not just if they're both present) [Mark Imbriaco, Bradford Folkens]
|
||||
|
||||
* Allow caches_action to accept a layout option [José Valim]
|
||||
|
|
|
@ -868,6 +868,16 @@ module ActionView
|
|||
record "window.location.href = #{url.inspect}"
|
||||
end
|
||||
|
||||
# Reloads the browser's current +location+ using JavaScript
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# # Generates: window.location.reload();
|
||||
# page.reload
|
||||
def reload
|
||||
record 'window.location.reload()'
|
||||
end
|
||||
|
||||
# Calls the JavaScript +function+, optionally with the given +arguments+.
|
||||
#
|
||||
# If a block is given, the block will be passed to a new JavaScriptGenerator;
|
||||
|
|
|
@ -347,6 +347,11 @@ class JavaScriptGeneratorTest < PrototypeHelperBaseTest
|
|||
@generator.redirect_to("http://www.example.com/welcome?a=b&c=d")
|
||||
end
|
||||
|
||||
def test_reload
|
||||
assert_equal 'window.location.reload();',
|
||||
@generator.reload
|
||||
end
|
||||
|
||||
def test_delay
|
||||
@generator.delay(20) do
|
||||
@generator.hide('foo')
|
||||
|
|
Loading…
Reference in a new issue