view_component 2.69.0 → 2.71.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5962b947a0d1b1947cfcadfc8fd723fe5b6374fafd9f95368104bfe2530d027
4
- data.tar.gz: 7ae40ccec4380ef0e4cda0ce82a3d0eeab7b3cd4bc13d9ece4056d25862e88f9
3
+ metadata.gz: 0fbced9eb4c36f970d2b46f99dfd3aca2043b619b807b89b27ae772596c3fe1d
4
+ data.tar.gz: 82ccdda90514c215f72b6e4d654db71b3ed42e55a52c8eebbd99742f047d0b4f
5
5
  SHA512:
6
- metadata.gz: f5f07263aa6af89b88887537df69617998e127a952021b6be07789139b488531433c8dc10199fc23215473850c959a49a566c29360f4531805d67ae0f3c4acab
7
- data.tar.gz: e56104679094959d05fa902b8e498270cd07e415742372fbbba377801fd7be1fd8b2d15658fe3be00d71436929e3380f8d4c4b9f37bbc0cfb44030e032541f29
6
+ metadata.gz: e874d63dd57bd39186244c95f351e975d8bb8e54f21c8619659b171084426c5c038ad52e710760fb0ef7301ed956c9eac99a3be5bc6f48fea0aa35f8c4459186
7
+ data.tar.gz: db9fef63203b0cde5f7a867c553ef776b8b485ac21b4e7911ec78d0a5e3e8d484545b715dfd41f71c31bdab0f155d605b11554be8b33c21373e94f76aa132907
data/docs/CHANGELOG.md CHANGED
@@ -1,24 +1,63 @@
1
1
  ---
2
2
  layout: default
3
3
  title: Changelog
4
+ nav_order: 5
4
5
  ---
5
6
 
6
7
  <!-- Add unreleased changes under the "main" heading. -->
7
8
 
8
9
  # Changelog
9
10
 
10
- * Add missing `require` to fix `pvc` build.
11
+ ## main
12
+
13
+ ## 2.71.0
14
+
15
+ **ViewComponent has moved to a new organization: [https://github.com/viewcomponent/view_component](https://github.com/viewcomponent/view_component). See [https://github.com/viewcomponent/view_component/issues/1424](https://github.com/viewcomponent/view_component/issues/1424) for more details.**
16
+
17
+ ## 2.70.0
18
+
19
+ * `render_preview` can pass parameters to preview.
11
20
 
12
21
  *Joel Hawksley*
13
22
 
14
- * Add `config.view_component.use_consistent_rendering_lifecycle` to ensure side-effects in `content` are consistently evaluated before components are rendered. This change effectively means that `content` is evaluated for every component render where `render?` returns true. As a result, code that's passed to a component via a block/content will now always be evaluated, before `#call`, which can reveal bugs in existing components. This configuration option defaults to `false` but will be enabled in 3.0 and the old behavior will be removed.
23
+ * Fix docs typos.
15
24
 
16
- *Blake Williams*
25
+ *Joel Hawksley*
17
26
 
18
- ## main
27
+ * Add architectural decisions to documentation and rename sidebar sections.
28
+
29
+ *Joel Hawksley*
30
+
31
+ * Clarify documentation on testability of Rails views.
32
+
33
+ *Joel Hawksley*
34
+
35
+ * Add Arrows to list of companies using ViewComponent.
36
+
37
+ *Matt Swanson*
38
+
39
+ * Add WIP to list of companies using ViewComponent.
40
+
41
+ *Marc Köhlbrugge*
42
+
43
+ * Update slots documentation to include how to reference slots.
44
+
45
+ *Brittany Ellich*
46
+
47
+ * Add Clio to list of companies using ViewComponent.
48
+
49
+ *Mike Buckley*
19
50
 
20
51
  ## 2.69.0
21
52
 
53
+ * Add missing `require` to fix `pvc` build.
54
+
55
+ *Joel Hawksley*
56
+
57
+ * Add `config.view_component.use_consistent_rendering_lifecycle` to ensure side-effects in `content` are consistently evaluated before components are rendered. This change effectively means that `content` is evaluated for every component render where `render?` returns true. As a result, code that's passed to a component via a block/content will now always be evaluated, before `#call`, which can reveal bugs in existing components. This configuration option defaults to `false` but will be enabled in 3.0 and the old behavior will be removed.
58
+
59
+ *Blake Williams*
60
+
22
61
  * Update Prism to version 1.28.0.
23
62
 
24
63
  *Thomas Hutterer*
@@ -80,9 +80,10 @@ module ViewComponent
80
80
  #
81
81
  # In RSpec, `Preview` is appended to `described_class`.
82
82
  #
83
- # @param preview [String] The name of the preview to be rendered.
83
+ # @param name [String] The name of the preview to be rendered.
84
+ # @param params [Hash] Parameters to be passed to the preview.
84
85
  # @return [Nokogiri::HTML]
85
- def render_preview(name)
86
+ def render_preview(name, params: {})
86
87
  begin
87
88
  preview_klass = if respond_to?(:described_class)
88
89
  raise "`render_preview` expected a described_class, but it is nil." if described_class.nil?
@@ -97,6 +98,13 @@ module ViewComponent
97
98
  end
98
99
 
99
100
  previews_controller = build_controller(Rails.application.config.view_component.preview_controller.constantize)
101
+
102
+ # From what I can tell, it's not possible to overwrite all request parameters
103
+ # at once, so we set them individually here.
104
+ params.each do |k, v|
105
+ previews_controller.request.params[k] = v
106
+ end
107
+
100
108
  previews_controller.request.params[:path] = "#{preview_klass.preview_name}/#{name}"
101
109
  previews_controller.response = ActionDispatch::Response.new
102
110
  result = previews_controller.previews
@@ -3,7 +3,7 @@
3
3
  module ViewComponent
4
4
  module VERSION
5
5
  MAJOR = 2
6
- MINOR = 69
6
+ MINOR = 71
7
7
  PATCH = 0
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH].join(".")
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.69.0
4
+ version: 2.71.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-08-17 00:00:00.000000000 Z
11
+ date: 2022-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport