render_component_4 4.1.4 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/render_component/components.rb +17 -7
- data/lib/render_component/version.rb +3 -3
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 342575964da9245a81edb094eb985146157a0e46fbbb5079010e80a66d27c035
|
4
|
+
data.tar.gz: 337b7cdbf6c71ceef802b9574e7c2b481d85068c16669b2dee1b49edcda355e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
50
|
+
redirect_url = response_redirect(response)
|
51
|
+
if redirect_url
|
43
52
|
redirect_to response.redirect_url
|
44
53
|
else
|
45
|
-
render :
|
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,
|
54
|
-
|
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.
|
130
|
-
request_env["action_dispatch.request.path_parameters"] = Hash[request_params.select{|key, value| [:controller, :action].include?(key)}].
|
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
|
|
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
|
+
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:
|
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:
|
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:
|
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
|
-
|
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:
|