view_component 2.32.0 → 2.33.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cdb5a57cbe401fab359e9daedfcb0180b2e6ec07bd332e7616c6a611442df13
4
- data.tar.gz: 11ec2515ac60b615adc2a52cc7b526c7632871363a24a7b3128ca9a4873d57a1
3
+ metadata.gz: 3e1d8f453f26f7d62a3549dcfb34a85a6fadfc05a7b38515ebe53bba7500acc9
4
+ data.tar.gz: 39122c530de9fb557f7e66a0a3e6b94c20c492776edc45b193e2b3b60b834e39
5
5
  SHA512:
6
- metadata.gz: ba44487de1f76102ec0fa9ea4fdd4af85c079c665c0e879855af5fe57577878a176badfef0af2a3d06d3384e852986048ab1332ed0a78fc589adea83f087b037
7
- data.tar.gz: 32b565ca3c4759b366acf47de7f42a74ec52adb96d951013759cb5a289ffc16956b432bbee8e0dd79c3291c16386655fd7b8332da2ad3ba29db9dadcc87456a9
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.
@@ -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
@@ -3,7 +3,7 @@
3
3
  module ViewComponent
4
4
  module VERSION
5
5
  MAJOR = 2
6
- MINOR = 32
6
+ MINOR = 33
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.32.0
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-05-21 00:00:00.000000000 Z
11
+ date: 2021-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport