view_component 4.0.0.rc2 → 4.0.0.rc3

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
2
  SHA256:
3
- metadata.gz: cfdffe5b162240d97c986ddbdee4f537e04bddebde4f622a573c691599a73bed
4
- data.tar.gz: d98395c2fe7910511a22da7a42864fa9a3c7c47c3a865be52defd3e54ad0b7c7
3
+ metadata.gz: c9389db3857fccdd96788494eb6992ceca37f1934f9587317b806a992f53a599
4
+ data.tar.gz: 675ca1e487f5724cc5ac33e397fb9b1f2027347c6ca569223e4e5e772150ad05
5
5
  SHA512:
6
- metadata.gz: b8a6d36f48196994b26af63743dd1f9cbf9cf3bd71cd656e2de9b6f34a8fb69c5620e348dd9b791c1d59864627f6d0dc1fb7d56e50ad5e1a1376c611bd555864
7
- data.tar.gz: ec1366449379c2817bc18e8c8fd565e0aee7a564c99a5c6c564d8da5ee2f60ae5582c1d46fbef25af532fc2e96a5c9b1de5d5e0907850c3af78b394ca49b772d
6
+ metadata.gz: 4810cd0a918e52322ef4f0b36b830cbb79cd80b2fce6d9cc680b9b43f5b490e76b412d8504aee3cc577bf6892053ac5ed789fdb14c8c2d71fce582b0011efc95
7
+ data.tar.gz: b8821ec370dbf668ad03c19b832ccbd8754d0da6a23b131d77f6c4898088214d2d51cb3e0c404ad919a75bf63ea387324f95decf03a497df30f8396650c2cd35
data/docs/CHANGELOG.md CHANGED
@@ -10,6 +10,20 @@ nav_order: 6
10
10
 
11
11
  ## main
12
12
 
13
+ ## 4.0.0.rc3
14
+
15
+ * Reformat the avatars section to arrange them in a grid.
16
+
17
+ *Josh Cohen*
18
+
19
+ * Fix bug where relative paths in `translate` didn't work in blocks passed to ViewComponents.
20
+
21
+ *Joel Hawksley*
22
+
23
+ * Add SerpApi to "Who uses ViewComponent" list.
24
+
25
+ *Andy from SerpApi*
26
+
13
27
  ## 4.0.0.rc2
14
28
 
15
29
  * Add `around_render` lifecyle method for wrapping component rendering in custom instrumentation, etc.
@@ -108,7 +108,7 @@ module ViewComponent
108
108
  self.class.__vc_compile(raise_errors: true)
109
109
 
110
110
  @view_context = view_context
111
- old_virtual_path = view_context.instance_variable_get(:@virtual_path)
111
+ @old_virtual_path = view_context.instance_variable_get(:@virtual_path)
112
112
  self.__vc_original_view_context ||= view_context
113
113
 
114
114
  @output_buffer = view_context.output_buffer
@@ -166,7 +166,7 @@ module ViewComponent
166
166
  ""
167
167
  end
168
168
  ensure
169
- view_context.instance_variable_set(:@virtual_path, old_virtual_path)
169
+ view_context.instance_variable_set(:@virtual_path, @old_virtual_path)
170
170
  @current_template = old_current_template
171
171
  end
172
172
 
@@ -341,7 +341,9 @@ module ViewComponent
341
341
 
342
342
  @__vc_content =
343
343
  if __vc_render_in_block_provided?
344
- view_context.capture(self, &@__vc_render_in_block)
344
+ with_original_virtual_path do
345
+ view_context.capture(self, &@__vc_render_in_block)
346
+ end
345
347
  elsif __vc_content_set_by_with_content_defined?
346
348
  @__vc_content_set_by_with_content
347
349
  end
@@ -358,6 +360,14 @@ module ViewComponent
358
360
  self.class.__vc_response_format
359
361
  end
360
362
 
363
+ # @private
364
+ def with_original_virtual_path
365
+ @view_context.instance_variable_set(:@virtual_path, @old_virtual_path)
366
+ yield
367
+ ensure
368
+ @view_context.instance_variable_set(:@virtual_path, virtual_path)
369
+ end
370
+
361
371
  private
362
372
 
363
373
  attr_reader :view_context
@@ -58,7 +58,9 @@ module ViewComponent
58
58
  if defined?(@__vc_content_block)
59
59
  # render_in is faster than `parent.render`
60
60
  @__vc_component_instance.render_in(view_context) do |*args|
61
- @__vc_content_block.call(*args)
61
+ @parent.with_original_virtual_path do
62
+ @__vc_content_block.call(*args)
63
+ end
62
64
  end
63
65
  else
64
66
  @__vc_component_instance.render_in(view_context)
@@ -66,7 +68,9 @@ module ViewComponent
66
68
  elsif defined?(@__vc_content)
67
69
  @__vc_content
68
70
  elsif defined?(@__vc_content_block)
69
- view_context.capture(&@__vc_content_block)
71
+ @parent.with_original_virtual_path do
72
+ view_context.capture(&@__vc_content_block)
73
+ end
70
74
  elsif defined?(@__vc_content_set_by_with_content)
71
75
  @__vc_content_set_by_with_content
72
76
  end
@@ -5,7 +5,7 @@ module ViewComponent
5
5
  MAJOR = 4
6
6
  MINOR = 0
7
7
  PATCH = 0
8
- PRE = "rc2"
8
+ PRE = "rc3"
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_component
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.rc2
4
+ version: 4.0.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ViewComponent Team