public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Add RJS#page.reload. [#277 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Sean Huber (author)
Thu May 29 10:49:38 -0700 2008
lifo (committer)
Wed Jun 04 05:32:53 -0700 2008
commit  30a0ebb3eb9fd4c8e4401bcaa4887eb1ce95defa
tree    2d0a36512d6c956b7e64e0e70c78c4da2181917d
parent  82e96eb294ae21528c3e05e91c05c7ee5222afbd
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *Edge*
0
 
0
+* Added page.reload functionality. Resolves #277. [Sean Huber]
0
+
0
 * 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]
0
 
0
 * Allow caches_action to accept a layout option [José Valim]
...
868
869
870
 
 
 
 
 
 
 
 
 
 
871
872
873
...
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
0
@@ -868,6 +868,16 @@ module ActionView
0
             record "window.location.href = #{url.inspect}"
0
           end
0
           
0
+          # Reloads the browser's current +location+ using JavaScript
0
+          #
0
+          # Examples:
0
+          #
0
+          #  # Generates: window.location.reload();
0
+          #  page.reload
0
+          def reload
0
+            record 'window.location.reload()'
0
+          end
0
+
0
           # Calls the JavaScript +function+, optionally with the given +arguments+.
0
           #
0
           # If a block is given, the block will be passed to a new JavaScriptGenerator;
...
347
348
349
 
 
 
 
 
350
351
352
...
347
348
349
350
351
352
353
354
355
356
357
0
@@ -347,6 +347,11 @@ class JavaScriptGeneratorTest < PrototypeHelperBaseTest
0
       @generator.redirect_to("http://www.example.com/welcome?a=b&c=d")
0
   end
0
   
0
+  def test_reload
0
+    assert_equal 'window.location.reload();',
0
+      @generator.reload
0
+  end
0
+
0
   def test_delay
0
     @generator.delay(20) do
0
       @generator.hide('foo')

Comments