jets 3.0.19 → 3.0.20
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 549f5889b18b5a6dc74ec29259f874a80a6064291b1598ef92c4fd0cdcdc499b
|
4
|
+
data.tar.gz: 1b6a1b5534296e24729763c26b9c9aeba359412aa13da1fad9912d186c1cbef5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc852f9754df45b1b8098a44de6d8b238554ad6ac8baacc005d7b2ce7a6d0a352ae12e19c6f232e8eef1d51fd1fc3fca2326025eeb4b3794d6b5c769b9748fa5
|
7
|
+
data.tar.gz: 818e6be78492e348119d083bc50ac91a34cf63f1e4a1785e4e1f96250418ba391388b876055b1f4916ef9a5c53dab59a1d10732b1d27d2f14ea7d64989ba7b96
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [3.0.20] - 2021-10-20
|
7
|
+
- [#603](https://github.com/boltops-tools/jets/pull/603) redirect_to: smarter handling of request xhr
|
8
|
+
- [#604](https://github.com/boltops-tools/jets/pull/604) fix redirect_to 301 and keep use default
|
9
|
+
|
6
10
|
## [3.0.19] - 2021-10-20
|
7
11
|
- [#602](https://github.com/boltops-tools/jets/pull/602) pin zeitwerk to 2.4.x in gemfile
|
8
12
|
|
@@ -10,12 +10,22 @@ class Jets::Controller
|
|
10
10
|
redirect_url = add_stage(url)
|
11
11
|
redirect_url = ensure_protocol(redirect_url)
|
12
12
|
|
13
|
-
|
14
|
-
status: options[:status] || 302,
|
13
|
+
default = {
|
15
14
|
headers: { "Location" => redirect_url },
|
16
|
-
body: "",
|
17
15
|
isBase64Encoded: false,
|
18
|
-
|
16
|
+
}
|
17
|
+
if request.xhr?
|
18
|
+
options[:content_type] = "application/json"
|
19
|
+
options[:status] = 200
|
20
|
+
options[:body] = JSON.dump(success: true, location: redirect_url)
|
21
|
+
else
|
22
|
+
options[:status] = 301
|
23
|
+
options[:body] = ""
|
24
|
+
end
|
25
|
+
Jets.logger.info("redirect_to options #{options}")
|
26
|
+
options = default.merge(options)
|
27
|
+
|
28
|
+
aws_proxy = Rendering::RackRenderer.new(self, options)
|
19
29
|
resp = aws_proxy.render
|
20
30
|
# redirect is a type of rendering
|
21
31
|
@rendered = true
|
@@ -29,11 +29,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
29
29
|
@<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
|
30
30
|
|
31
31
|
if @<%= orm_instance.save %>
|
32
|
-
|
33
|
-
render json: {success: true, location: url_for(@<%= singular_table_name %>)}
|
34
|
-
else
|
35
|
-
redirect_to <%= singular_table_name %>_path(@<%= singular_table_name %>)
|
36
|
-
end
|
32
|
+
redirect_to <%= singular_table_name %>_path(@<%= singular_table_name %>)
|
37
33
|
else
|
38
34
|
render :new
|
39
35
|
end
|
@@ -42,11 +38,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
42
38
|
# PUT <%= route_url %>/1
|
43
39
|
def update
|
44
40
|
if @<%= orm_instance.update("#{singular_table_name}_params") %>
|
45
|
-
|
46
|
-
render json: {success: true, location: url_for(@<%= singular_table_name %>)}
|
47
|
-
else
|
48
|
-
redirect_to <%= singular_table_name %>_path(@<%= singular_table_name %>)
|
49
|
-
end
|
41
|
+
redirect_to <%= singular_table_name %>_path(@<%= singular_table_name %>)
|
50
42
|
else
|
51
43
|
render :edit
|
52
44
|
end
|
@@ -55,11 +47,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
55
47
|
# DELETE <%= route_url %>/1
|
56
48
|
def delete
|
57
49
|
@<%= orm_instance.destroy %>
|
58
|
-
|
59
|
-
render json: {success: true, location: <%= table_name %>_path}
|
60
|
-
else
|
61
|
-
redirect_to <%= table_name %>_path
|
62
|
-
end
|
50
|
+
redirect_to <%= table_name %>_path
|
63
51
|
end
|
64
52
|
|
65
53
|
private
|
@@ -13,7 +13,7 @@ module Jets::Middleware
|
|
13
13
|
middleware.use Shotgun::Static
|
14
14
|
middleware.use Rack::Runtime
|
15
15
|
middleware.use Jets::Controller::Middleware::Cors if cors_enabled?
|
16
|
-
middleware.use Rack::MethodOverride # must come before Middleware::Local for multipart post forms to work
|
16
|
+
middleware.use Rack::MethodOverride unless ENV['JETS_RACK_METHOD_OVERRIDE'] == '0' # must come before Middleware::Local for multipart post forms to work
|
17
17
|
middleware.use Jets::Controller::Middleware::Reloader if Jets.config.hot_reload
|
18
18
|
middleware.use Jets::Controller::Middleware::Local # mimics AWS Lambda for local server only
|
19
19
|
middleware.use session_store, session_options
|
data/lib/jets/version.rb
CHANGED