new_responds_to_parent 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cba5949364165b29c89f645c9eda3e920f981c08
4
- data.tar.gz: 83c337295424705facdd37cc70c0d45a3f333e1c
3
+ metadata.gz: 0a6e47fac063ab31e7fcabea36959929247fdd85
4
+ data.tar.gz: d15eae08b73a78fb3f1ffcef0450207a3de29f05
5
5
  SHA512:
6
- metadata.gz: 941bccc817f787dc4ccfc8c8ab022dd689edb96e7a3bf782125ba6a409f3085401770c0832e79b55d1419788999ee4774f61f6a1757314ad10c830693b64198f
7
- data.tar.gz: 742a8d472a37dd6d8b50453d11bc1bc430aaacdec15d2650c4aec8512a76706c28e1809353a582b71f0746948c4dff5ba395f66bb98809fe81d44127dcdb948d
6
+ metadata.gz: 95cacdd16d12450d572bc0bce6749d549cae2b6f68e89ba861d105b63df4551bf3c5af8fc040c1444804efc7d2e70d22c00b59478523164db08e82f5953baba1
7
+ data.tar.gz: 9f1ec84c47415b47f31a5c61dfa68d492d64324b5dc447aec581296f79ba86b23aa191b35118ed4e2150cf2aa051b20a23c9dbd863fac2f2df840a4ad93c6b8e
@@ -4,7 +4,7 @@ module NewRespondsToParent
4
4
  # Executes the response body as JavaScript in the context of the parent window.
5
5
  # Use this method of you are posting a form to a hidden IFRAME or if you would like
6
6
  # to use IFRAME base RPC.
7
- def responds_to_parent(&block)
7
+ def responds_to_parent
8
8
  yield
9
9
 
10
10
  if performed?
@@ -13,20 +13,20 @@ module NewRespondsToParent
13
13
 
14
14
  # Either pull out a redirect or the request body
15
15
  script = if response.headers['Location']
16
- #TODO: erase_redirect_results is missing in rails 3.0 has to be implemented
17
- # erase redirect
18
- "document.location.href = #{location.to_s.inspect}"
19
- else
20
- response.body
16
+ # TODO: erase_redirect_results is missing in rails 3.0 has to be implemented
17
+ # erase redirect
18
+ "document.location.href = #{location.to_s.inspect}"
19
+ else
20
+ response.body
21
21
  end
22
22
 
23
23
  # Escape quotes, linebreaks and slashes, maintaining previously escaped slashes
24
24
  # Suggestions for improvement?
25
- script = (script || '').
26
- gsub('\\', '\\\\\\').
27
- gsub(/\r\n|\r|\n/, '\\n').
28
- gsub(/['"]/, '\\\\\&').
29
- gsub('</script>','</scr"+"ipt>')
25
+ script = (script || '')
26
+ .gsub('\\', '\\\\\\')
27
+ .gsub(/\r\n|\r|\n/, '\\n')
28
+ .gsub(/['"]/, '\\\\\&')
29
+ .gsub('</script>', '</scr"+"ipt>')
30
30
 
31
31
  # Clear out the previous render to prevent double render
32
32
  response.request.env['action_controller.instance'].instance_variable_set(:@_response_body, nil)
@@ -38,8 +38,7 @@ module NewRespondsToParent
38
38
  # setTimeout - scope the execution in the windows parent for safari
39
39
  # window.eval - legal eval for Opera
40
40
  render plain: "<html><body><script type='text/javascript' charset='utf-8'>
41
- var loc = document.location;
42
- with(window.parent) { setTimeout(function() { window.eval('#{script}'); if (typeof(loc) !== 'undefined') loc.replace('about:blank'); }, 1) };
41
+ with(window.parent) { setTimeout(function() { window.eval('#{script}'); }, 1) };
43
42
  </script></body></html>".html_safe
44
43
  end
45
44
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{new_responds_to_parent}
8
- s.version = "0.1.6"
8
+ s.version = "0.1.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Huynh"]
12
- s.date = %q{2018-04-11}
12
+ s.date = %q{2012-03-17}
13
13
  s.description = %q{Adds responds_to_parent to your controller to respond to the parent document of your page. Make Ajaxy file uploads by posting the form to a hidden iframe, and respond with javascript call to the parent window. This gem version can support rails 3.0+}
14
14
  s.email = %q{james@rubify.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: new_responds_to_parent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Huynh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-11 00:00:00.000000000 Z
11
+ date: 2012-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda