render_component_4 4.1.4 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2b25925b5536281831d8c613483166489b67ec1d
4
- data.tar.gz: 0cfbfd0052ab37972b3245cd897f043938fa057c
2
+ SHA256:
3
+ metadata.gz: 342575964da9245a81edb094eb985146157a0e46fbbb5079010e80a66d27c035
4
+ data.tar.gz: 337b7cdbf6c71ceef802b9574e7c2b481d85068c16669b2dee1b49edcda355e1
5
5
  SHA512:
6
- metadata.gz: f132ae42ab636a1c75b4e707aceea9f37a88a4a192ea9e1ddfeaf3076ba1a4a2b8f58bb66ae2ac6b160593b5d492f7877ae45d083b8d1cb2a0853fd2d999f2aa
7
- data.tar.gz: d4b51c2d3dac0094ba6bf3f3d6b41c501a138d4b82afe52495f14c0c814b1c8403fdca972a9763243bd2ecbbb5e162719b07e9aeceae93376b7ebaa31879888c
6
+ metadata.gz: 80bd5194868e0a59a73c53045cb1738065796ea9b0d71b842c7d2d87b12dc840ea84dfacd08216401ae51e6ba7f86b02a0952f22697c3ca984deb1892f805e35
7
+ data.tar.gz: 01a508d3e443850d088ab8f8aabbe5ff60c820ac1f76f54d2d673d442a67586098baf220871cee25f2363bfb5402714f8f146b83ead92497bbc4b8896d2c65cb
@@ -22,7 +22,7 @@ module RenderComponent
22
22
  def process_with_components(request, action, parent_controller = nil) #:nodoc:
23
23
  controller = new
24
24
  controller.parent_controller = parent_controller
25
- controller.dispatch(action, request)
25
+ controller.dispatch(action, request, make_response!(request))
26
26
  end
27
27
  end
28
28
 
@@ -35,14 +35,23 @@ module RenderComponent
35
35
  module InstanceMethods
36
36
 
37
37
  protected
38
+ def response_redirect(response)
39
+ if response.respond_to?(:to_path)
40
+ response.to_path
41
+ elsif response.is_a?(ActionDispatch::Response)
42
+ response.redirect_url
43
+ end
44
+ end
45
+
38
46
  # Renders the component specified as the response for the current method
39
47
  def render_component(options) #:doc:
40
48
  component_logging(options) do
41
49
  response = component_response(options, true)[2]
42
- if response.redirect_url
50
+ redirect_url = response_redirect(response)
51
+ if redirect_url
43
52
  redirect_to response.redirect_url
44
53
  else
45
- render :text => response.body, :status => response.status
54
+ render :html => response.body.html_safe, :status => response.status
46
55
  end
47
56
  end
48
57
  end
@@ -50,8 +59,9 @@ module RenderComponent
50
59
  # Returns the component response as a string
51
60
  def render_component_into_view(options) #:doc:
52
61
  component_logging(options) do
53
- response = component_response(options, false)[2]
54
- if redirected = response.redirect_url
62
+ response = component_response(options, true)[2]
63
+ redirected = response_redirect(response)
64
+ if redirected
55
65
  if redirected =~ %r{://}
56
66
  location = URI.parse(redirected)
57
67
  redirected = location.query ? "#{location.path}?#{location.query}" : location.path
@@ -126,8 +136,8 @@ module RenderComponent
126
136
  request_env['REQUEST_URI'] = url_for(options)
127
137
  request_env["PATH_INFO"] = url_for(options.merge(:only_path => true))
128
138
  request_env["action_dispatch.request.symbolized_path_parameters"] = request_params
129
- request_env["action_dispatch.request.parameters"] = request_params.with_indifferent_access
130
- request_env["action_dispatch.request.path_parameters"] = Hash[request_params.select{|key, value| [:controller, :action].include?(key)}].with_indifferent_access
139
+ request_env["action_dispatch.request.parameters"] = request_params.symbolize_keys
140
+ request_env["action_dispatch.request.path_parameters"] = Hash[request_params.select{|key, value| [:controller, :action].include?(key)}].symbolize_keys
131
141
  request_env["warden"] = request.env["warden"] if (request.env.has_key?("warden"))
132
142
  component_request = ActionDispatch::Request.new(request_env)
133
143
 
@@ -1,8 +1,8 @@
1
1
  module RenderComponent
2
2
  module Version
3
- MAJOR = 4
4
- MINOR = 1
5
- PATCH = 4
3
+ MAJOR = 3
4
+ MINOR = 2
5
+ PATCH = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render_component_4
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.4
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-07-12 00:00:00.000000000 Z
13
+ date: 2020-02-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: 4.1.0
21
+ version: 5.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: 4.1.0
28
+ version: 5.0.0
29
29
  description: Components allow you to call other actions for their rendered response
30
30
  while executing another action
31
31
  email:
@@ -62,10 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  requirements: []
65
- rubyforge_project:
66
- rubygems_version: 2.5.1
65
+ rubygems_version: 3.0.6
67
66
  signing_key:
68
67
  specification_version: 4
69
68
  summary: render actions in other controllers for their rendered response
70
69
  test_files: []
71
- has_rdoc: