view_component 2.32.0 → 2.33.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/CHANGELOG.md +10 -0
- data/lib/view_component/base.rb +9 -1
- data/lib/view_component/collection.rb +1 -0
- 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: 3e1d8f453f26f7d62a3549dcfb34a85a6fadfc05a7b38515ebe53bba7500acc9
|
4
|
+
data.tar.gz: 39122c530de9fb557f7e66a0a3e6b94c20c492776edc45b193e2b3b60b834e39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f016eb4da5b952a220971e0163853b8ca77dd5bc820b634d525316b4117654b78a279ffeb7bb8d66ce68401cc41a350861696152992923445a1c3d6c587b2ed
|
7
|
+
data.tar.gz: 4203337d6188eea75e7d79ca246ca5309e5af7197256207e48c37b248958dbad49c07efff0a964d206d9c462ee5d1af3365f36f9f2d9e68661f7dbfe066e4a01
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
## main
|
4
4
|
|
5
|
+
## 2.33.0
|
6
|
+
|
7
|
+
* Add support for `_iteration` parameter when rendering in a collection
|
8
|
+
|
9
|
+
*Will Cosgrove*
|
10
|
+
|
11
|
+
* Don't raise an error when rendering empty components.
|
12
|
+
|
13
|
+
*Alex Robbin*
|
14
|
+
|
5
15
|
## 2.32.0
|
6
16
|
|
7
17
|
* Enable previews by default in test environment.
|
data/lib/view_component/base.rb
CHANGED
@@ -91,7 +91,7 @@ module ViewComponent
|
|
91
91
|
before_render
|
92
92
|
|
93
93
|
if render?
|
94
|
-
render_template_for(@variant) + _output_postamble
|
94
|
+
render_template_for(@variant).to_s + _output_postamble
|
95
95
|
else
|
96
96
|
""
|
97
97
|
end
|
@@ -425,6 +425,14 @@ module ViewComponent
|
|
425
425
|
initialize_parameter_names.include?(collection_counter_parameter)
|
426
426
|
end
|
427
427
|
|
428
|
+
def collection_iteration_parameter
|
429
|
+
"#{collection_parameter}_iteration".to_sym
|
430
|
+
end
|
431
|
+
|
432
|
+
def iteration_argument_present?
|
433
|
+
initialize_parameter_names.include?(collection_iteration_parameter)
|
434
|
+
end
|
435
|
+
|
428
436
|
private
|
429
437
|
|
430
438
|
def initialize_parameter_names
|
@@ -38,6 +38,7 @@ module ViewComponent
|
|
38
38
|
def component_options(item, iterator)
|
39
39
|
item_options = { component.collection_parameter => item }
|
40
40
|
item_options[component.collection_counter_parameter] = iterator.index + 1 if component.counter_argument_present?
|
41
|
+
item_options[component.collection_iteration_parameter] = iterator if component.iteration_argument_present?
|
41
42
|
|
42
43
|
@options.merge(item_options)
|
43
44
|
end
|
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.33.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|