view_component 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of view_component might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/controllers/concerns/view_component/preview_actions.rb +1 -1
- data/docs/CHANGELOG.md +14 -0
- data/lib/view_component/base.rb +2 -0
- data/lib/view_component/inline_template.rb +1 -1
- data/lib/view_component/rails/tasks/view_component.rake +2 -0
- data/lib/view_component/test_helpers.rb +5 -1
- data/lib/view_component/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfae7c952ad3086e6df45516e19bdbf8699b3c87209675dbe6e98d07d7457678
|
4
|
+
data.tar.gz: 11b457c1aa7784e98b4e09913e6206083ad8e6e6c0bb66832ee7b91f097a481a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d90880b28c40393b2d198e71df13a12fe078069aeeb8c629fd34b96e636b67120017cb9d49948fe4f73f2a41dbd2d345ba5465728d940668a895ce5ca6407ee5
|
7
|
+
data.tar.gz: da53115421cdad2b9522bb6db4d518c0851dde9d5e6191a677316bd1a8fe56945be99ac3632e3a9b2f069f69141f32fa77797c6d8d3f056a4bb7e8323a465b71
|
@@ -59,7 +59,7 @@ module ViewComponent
|
|
59
59
|
def find_preview
|
60
60
|
candidates = []
|
61
61
|
params[:path].to_s.scan(%r{/|$}) { candidates << Regexp.last_match.pre_match }
|
62
|
-
preview = candidates.detect { |candidate| ViewComponent::Preview.exists?(candidate) }
|
62
|
+
preview = candidates.sort_by(&:length).reverse_each.detect { |candidate| ViewComponent::Preview.exists?(candidate) }
|
63
63
|
|
64
64
|
if preview
|
65
65
|
@preview = ViewComponent::Preview.find(preview)
|
data/docs/CHANGELOG.md
CHANGED
@@ -10,6 +10,20 @@ nav_order: 5
|
|
10
10
|
|
11
11
|
## main
|
12
12
|
|
13
|
+
## 3.3.0
|
14
|
+
|
15
|
+
* Include InlineTemplate by default in Base. **Note:** It's no longer necessary to include `ViewComponent::InlineTemplate` to use inline templates.
|
16
|
+
|
17
|
+
*Joel Hawksley*
|
18
|
+
|
19
|
+
* Allow Setting host when using the `with_request_url` test helper.
|
20
|
+
|
21
|
+
*Daniel Alfaro*
|
22
|
+
|
23
|
+
* Resolve ambiguous preview paths when using components without the Component suffix.
|
24
|
+
|
25
|
+
*Reed Law*
|
26
|
+
|
13
27
|
## 3.2.0
|
14
28
|
|
15
29
|
* Fix viewcomponent.org Axe violations.
|
data/lib/view_component/base.rb
CHANGED
@@ -7,6 +7,7 @@ require "view_component/compile_cache"
|
|
7
7
|
require "view_component/compiler"
|
8
8
|
require "view_component/config"
|
9
9
|
require "view_component/errors"
|
10
|
+
require "view_component/inline_template"
|
10
11
|
require "view_component/preview"
|
11
12
|
require "view_component/slotable"
|
12
13
|
require "view_component/translatable"
|
@@ -29,6 +30,7 @@ module ViewComponent
|
|
29
30
|
attr_writer :config
|
30
31
|
end
|
31
32
|
|
33
|
+
include ViewComponent::InlineTemplate
|
32
34
|
include ViewComponent::Slotable
|
33
35
|
include ViewComponent::Translatable
|
34
36
|
include ViewComponent::WithContentHelper
|
@@ -156,7 +156,9 @@ module ViewComponent
|
|
156
156
|
# ```
|
157
157
|
#
|
158
158
|
# @param path [String] The path to set for the current request.
|
159
|
-
|
159
|
+
# @param host [String] The host to set for the current request.
|
160
|
+
def with_request_url(path, host: nil)
|
161
|
+
old_request_host = vc_test_request.host
|
160
162
|
old_request_path_info = vc_test_request.path_info
|
161
163
|
old_request_path_parameters = vc_test_request.path_parameters
|
162
164
|
old_request_query_parameters = vc_test_request.query_parameters
|
@@ -164,12 +166,14 @@ module ViewComponent
|
|
164
166
|
old_controller = defined?(@vc_test_controller) && @vc_test_controller
|
165
167
|
|
166
168
|
path, query = path.split("?", 2)
|
169
|
+
vc_test_request.host = host if host
|
167
170
|
vc_test_request.path_info = path
|
168
171
|
vc_test_request.path_parameters = Rails.application.routes.recognize_path_with_request(vc_test_request, path, {})
|
169
172
|
vc_test_request.set_header("action_dispatch.request.query_parameters", Rack::Utils.parse_nested_query(query))
|
170
173
|
vc_test_request.set_header(Rack::QUERY_STRING, query)
|
171
174
|
yield
|
172
175
|
ensure
|
176
|
+
vc_test_request.host = old_request_host
|
173
177
|
vc_test_request.path_info = old_request_path_info
|
174
178
|
vc_test_request.path_parameters = old_request_path_parameters
|
175
179
|
vc_test_request.set_header("action_dispatch.request.query_parameters", old_request_query_parameters)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ViewComponent Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|