futurism 1.2.0.pre2 → 1.2.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00f16be3e103b54e5c6bbd9efaea16b7196d0e4a561bde8b61051989b1e74e59
4
- data.tar.gz: 67c9a17bb4a80fcc12f830bf8ce39174086e336b93d041f822308a20359381dc
3
+ metadata.gz: 80e0ce6e5c458215afe4266493a6644a029b75f005bfbadcdc181b82325e0d43
4
+ data.tar.gz: 902744214a43cee7e28c57f1999e52191aaf2d2022860c53c4784ba9fda200fd
5
5
  SHA512:
6
- metadata.gz: ff6e67f624ad9ccd114800b457c4f7e48fa6232f87aa970f7f1513b59bd4ea3daedf05806e2582af057588d1cd19075e87ab81f8f4ffde23544f64b6e8ae2a5c
7
- data.tar.gz: 1bafaacb876d3d50d020692a555946112a74bdb10b0cabac0e67b3b57f561b7935ba25024c0792102ec9f89addfa54fde03daf10101364cb27b51f687817956f
6
+ metadata.gz: a8638ce1768afd2da09199dc9e033b32168b54c401fd5ab2b26e20e127b38e4c172b93d8846cca8cc0adb28078073fb0bcd2554d70a5d070e60f631d1d596e5b
7
+ data.tar.gz: cf8c0a7ecd8451b15f7d71f496bd0e49adb358e1bf9770449424e4d4780709b410ba197f8c459a71468f46c3d7961b4ae331bd9e61e4d0e1d959720b46a7dd88
@@ -28,12 +28,13 @@ module Futurism
28
28
 
29
29
  WrappingFuturismElement.new(extends: extends, placeholder: placeholder, options: options).render
30
30
  else
31
- placeholder = capture(record, index, &block) if block_given?
32
-
33
31
  collection_class_name = collection.try(:klass).try(:name) || collection.first.class.to_s
34
32
  as = options.delete(:as) || collection_class_name.underscore
35
33
  broadcast_each = options.delete(:broadcast_each) || false
34
+
36
35
  collection.each_with_index.map { |record, index|
36
+ placeholder = capture(record, index, &block) if block_given?
37
+
37
38
  WrappingFuturismElement.new(extends: extends, placeholder: placeholder, options: options.deep_merge(
38
39
  broadcast_each: broadcast_each,
39
40
  locals: {as.to_sym => record, "#{as}_counter".to_sym => index}
@@ -55,7 +56,7 @@ module Futurism
55
56
  include ActionView::Helpers
56
57
  include Futurism::MessageVerifier
57
58
 
58
- attr_reader :extends, :placeholder, :html_options, :data_attributes, :model, :options, :eager, :broadcast_each, :controller
59
+ attr_reader :placeholder, :html_options, :data_attributes, :model, :options, :eager, :broadcast_each, :controller
59
60
 
60
61
  def initialize(extends:, placeholder:, options:)
61
62
  @extends = extends
@@ -80,14 +81,7 @@ module Futurism
80
81
  end
81
82
 
82
83
  def render
83
- case extends
84
- when :li
85
- content_tag :li, placeholder, html_options.deep_merge({data: dataset, is: "futurism-li"})
86
- when :tr
87
- content_tag :tr, placeholder, html_options.deep_merge({data: dataset, is: "futurism-table-row"})
88
- else
89
- content_tag :"futurism-element", placeholder, html_options.deep_merge({data: dataset})
90
- end
84
+ content_tag :"futurism-element", placeholder, html_options.deep_merge({data: dataset, extends: extends})
91
85
  end
92
86
 
93
87
  def transformed_options
@@ -112,6 +106,15 @@ module Futurism
112
106
 
113
107
  message_verifier.generate(controller.to_s)
114
108
  end
109
+
110
+ def extends
111
+ # TODO remove this in the next major version
112
+ case @extends
113
+ when :li then "list-item"
114
+ when :tr then "table-row"
115
+ else @extends
116
+ end
117
+ end
115
118
  end
116
119
  end
117
120
  end
@@ -1,3 +1,3 @@
1
1
  module Futurism
2
- VERSION = "1.2.0.pre2"
2
+ VERSION = "1.2.0.pre3"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Futurism
2
- VERSION = "1.2.0.pre1"
2
+ VERSION = "1.2.0.pre2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: futurism
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.pre2
4
+ version: 1.2.0.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Rubisch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-01 00:00:00.000000000 Z
11
+ date: 2021-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler