view_component 2.72.0 → 2.74.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.
Potentially problematic release.
This version of view_component might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/docs/CHANGELOG.md +48 -0
- data/lib/view_component/base.rb +5 -15
- data/lib/view_component/compiler.rb +1 -2
- data/lib/view_component/engine.rb +1 -2
- data/lib/view_component/test_helpers.rb +1 -1
- data/lib/view_component/translatable.rb +1 -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: 5727f1bca2f67cc366ef202592ccdcd6689be24204594f2bab68f25fed713034
|
4
|
+
data.tar.gz: ef16e764d7a1403cf7480a44c93f8953a5cf943364d612146c71cde948dd7e72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bb378b5fc5181c5807a46af1cbdb8f51569d12b1d1b35791b41bdbc1b51ffea8b833bb86bbd37e442d5a1546e1dec9b2d8793728fb9fbd9f1ba427b9ebaa090
|
7
|
+
data.tar.gz: cc6fc6362298a9ca1e6ec6d2e8fccd2b0ad06eb013cd710bdfb651245457c674ed0b0900c8407fa2f559e991c81ad9a53cdc4e48d630e739853b63b9621393c2
|
data/docs/CHANGELOG.md
CHANGED
@@ -10,6 +10,54 @@ nav_order: 5
|
|
10
10
|
|
11
11
|
## main
|
12
12
|
|
13
|
+
## 2.74.0
|
14
|
+
|
15
|
+
* Add Avo to list of companies using ViewComponent.
|
16
|
+
|
17
|
+
*Adrian Marin*
|
18
|
+
|
19
|
+
* Promote experimental `_output_postamble` method to public API as `output_postamble`.
|
20
|
+
|
21
|
+
*Joel Hawksley*
|
22
|
+
|
23
|
+
* Promote experimental `_sidecar_files` method to public API as `sidecar_files`.
|
24
|
+
|
25
|
+
*Joel Hawksley*
|
26
|
+
|
27
|
+
* Fix `show_previews` regression introduced in 2.73.0.
|
28
|
+
|
29
|
+
*Andy Baranov*
|
30
|
+
|
31
|
+
## 2.73.0
|
32
|
+
|
33
|
+
* Remove experimental `_after_compile` lifecycle method.
|
34
|
+
|
35
|
+
*Joel Hawksley*
|
36
|
+
|
37
|
+
* Fix capitalization of JavaScript in docs.
|
38
|
+
|
39
|
+
*Erinna Chen*
|
40
|
+
|
41
|
+
* Add PrintReleaf to list of companies using ViewComponent.
|
42
|
+
|
43
|
+
*Ry Kulp*
|
44
|
+
|
45
|
+
* Simplify CI configuration to a single build per Ruby/Rails version.
|
46
|
+
|
47
|
+
*Joel Hawksley*
|
48
|
+
|
49
|
+
* Correctly document `generate.sidecar` config option.
|
50
|
+
|
51
|
+
*Ruben Smit*
|
52
|
+
|
53
|
+
* Add Yobbers to list of companies using ViewComponent.
|
54
|
+
|
55
|
+
*Anton Prins*
|
56
|
+
|
57
|
+
* `with_request_url` test helper supports router constraints (such as Devise).
|
58
|
+
|
59
|
+
*Aotokitsuruya*
|
60
|
+
|
13
61
|
## 2.72.0
|
14
62
|
|
15
63
|
* Deprecate support for Ruby < 2.7 for removal in v3.0.0.
|
data/lib/view_component/base.rb
CHANGED
@@ -59,15 +59,6 @@ module ViewComponent
|
|
59
59
|
self.__vc_original_view_context = view_context
|
60
60
|
end
|
61
61
|
|
62
|
-
# EXPERIMENTAL: This API is experimental and may be removed at any time.
|
63
|
-
# Hook for allowing components to do work as part of the compilation process.
|
64
|
-
#
|
65
|
-
# For example, one might compile component-specific assets at this point.
|
66
|
-
# @private TODO: add documentation
|
67
|
-
def self._after_compile
|
68
|
-
# noop
|
69
|
-
end
|
70
|
-
|
71
62
|
# @!macro [attach] deprecated_generate_mattr_accessor
|
72
63
|
# @method generate_$1
|
73
64
|
# @deprecated Use `#generate.$1` instead. Will be removed in v3.0.0.
|
@@ -137,7 +128,7 @@ module ViewComponent
|
|
137
128
|
# component template is evaluated.
|
138
129
|
content if self.class.use_consistent_rendering_lifecycle
|
139
130
|
|
140
|
-
render_template_for(@__vc_variant).to_s +
|
131
|
+
render_template_for(@__vc_variant).to_s + output_postamble
|
141
132
|
else
|
142
133
|
""
|
143
134
|
end
|
@@ -160,10 +151,10 @@ module ViewComponent
|
|
160
151
|
nil
|
161
152
|
end
|
162
153
|
|
163
|
-
#
|
154
|
+
# Optional content to be returned after the rendered template.
|
164
155
|
#
|
165
156
|
# @return [String]
|
166
|
-
def
|
157
|
+
def output_postamble
|
167
158
|
""
|
168
159
|
end
|
169
160
|
|
@@ -418,15 +409,14 @@ module ViewComponent
|
|
418
409
|
# @private
|
419
410
|
attr_accessor :source_location, :virtual_path
|
420
411
|
|
421
|
-
# EXPERIMENTAL: This API is experimental and may be removed at any time.
|
422
412
|
# Find sidecar files for the given extensions.
|
423
413
|
#
|
424
414
|
# The provided array of extensions is expected to contain
|
425
415
|
# strings starting without the "dot", example: `["erb", "haml"]`.
|
426
416
|
#
|
427
417
|
# For example, one might collect sidecar CSS files that need to be compiled.
|
428
|
-
# @
|
429
|
-
def
|
418
|
+
# @param extensions [Array<String>] Extensions of which to return matching sidecar files.
|
419
|
+
def sidecar_files(extensions)
|
430
420
|
return [] unless source_location
|
431
421
|
|
432
422
|
extensions = extensions.join(",")
|
@@ -90,7 +90,6 @@ module ViewComponent
|
|
90
90
|
define_render_template_for
|
91
91
|
|
92
92
|
component_class.build_i18n_backend
|
93
|
-
component_class._after_compile
|
94
93
|
|
95
94
|
CompileCache.register(component_class)
|
96
95
|
end
|
@@ -205,7 +204,7 @@ module ViewComponent
|
|
205
204
|
begin
|
206
205
|
extensions = ActionView::Template.template_handler_extensions
|
207
206
|
|
208
|
-
component_class.
|
207
|
+
component_class.sidecar_files(extensions).each_with_object([]) do |path, memo|
|
209
208
|
pieces = File.basename(path).split(".")
|
210
209
|
memo << {
|
211
210
|
path: path,
|
@@ -19,8 +19,7 @@ module ViewComponent
|
|
19
19
|
end
|
20
20
|
options.instrumentation_enabled = false if options.instrumentation_enabled.nil?
|
21
21
|
options.render_monkey_patch_enabled = true if options.render_monkey_patch_enabled.nil?
|
22
|
-
options.show_previews = Rails.env.development? || Rails.env.test? if options.show_previews.nil?
|
23
|
-
options.instrumentation_enabled = false if options.instrumentation_enabled.nil?
|
22
|
+
options.show_previews = (Rails.env.development? || Rails.env.test?) if options.show_previews.nil?
|
24
23
|
|
25
24
|
if options.show_previews
|
26
25
|
# This is still necessary because when `config.view_component` is declared, `Rails.root` is unspecified.
|
@@ -200,7 +200,7 @@ module ViewComponent
|
|
200
200
|
|
201
201
|
path, query = path.split("?", 2)
|
202
202
|
request.path_info = path
|
203
|
-
request.path_parameters = Rails.application.routes.
|
203
|
+
request.path_parameters = Rails.application.routes.recognize_path_with_request(request, path, {})
|
204
204
|
request.set_header("action_dispatch.request.query_parameters", Rack::Utils.parse_nested_query(query))
|
205
205
|
request.set_header(Rack::QUERY_STRING, query)
|
206
206
|
yield
|
@@ -23,7 +23,7 @@ module ViewComponent
|
|
23
23
|
def build_i18n_backend
|
24
24
|
return if CompileCache.compiled? self
|
25
25
|
|
26
|
-
self.i18n_backend = if (translation_files =
|
26
|
+
self.i18n_backend = if (translation_files = sidecar_files(%w[yml yaml])).any?
|
27
27
|
# Returning nil cleans up if translations file has been removed since the last compilation
|
28
28
|
|
29
29
|
I18nBackend.new(
|
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: 2.
|
4
|
+
version: 2.74.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: 2022-09-
|
11
|
+
date: 2022-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|