effective_bootstrap 1.14.2 → 1.14.4

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: aed59c9600110db574cd48ae66e133ae62fc70a35a505dbebb4f616e6e4076cd
4
- data.tar.gz: 68c1cc80c112c82f3c9581afbfaae2ea6a802f81b9858252b2d17bcd90968236
3
+ metadata.gz: 473950005d6f69ad8d03ccdb176cbddf84c3cc89cbec7a73dcfc968e2ef1eca9
4
+ data.tar.gz: c72db95cd5971de88cb157fc2e35ef9e6b507038af495b53ea0ab94181eae2c2
5
5
  SHA512:
6
- metadata.gz: 9ecdba3a4550958031f5022db5a98afce4cbae662ac0724e1364e8295df162c3de544041ee85c8b88a90c1e19fb9cd3f10b1178babd966774f140d55e5dbe956
7
- data.tar.gz: 123bd9f3aca61d8cd390dbbab1af836933c3413cf61bf9d8b0a2c5c1e7b0a330e240a7be94b1bf363c988424ebf89f9bfb89623efb1f15f97d27c1ca2ae4e752
6
+ metadata.gz: d8501f7f6cedefdac92a3cf349c9009f89115a5fd308107fda70c6e229e152455b7517d8ad9e0a70450b263c5e6dc0922dd05e58fb360726acf2d36332e2d1ce
7
+ data.tar.gz: d2ea39ec1d62ba781999bf5211e91414f30f96020dcdea79af0501cc7b20bb96791884fa64ece4f412bf36f5a2f64084ff5c12c63f5b98e2ddb8c161f6ead38c
@@ -28,7 +28,7 @@ module Effective
28
28
  capture(&block) if block_given?
29
29
 
30
30
  # Build from the resource if we didn't do anything in the block
31
- build_resource_rows if rows.blank?
31
+ build_resource_rows if rows.blank? && !block_given?
32
32
 
33
33
  only = Array(options[:only])
34
34
  except = Array(options[:except])
@@ -164,6 +164,10 @@ module Effective
164
164
  # Nothing to do
165
165
  end
166
166
 
167
+ def static_field(name, options = {}, &block)
168
+ rows[name] = (value(name).is_a?(ActiveRecord::Base)) ? belongs_to(name, options) : default_row(name, options)
169
+ end
170
+
167
171
  def text_area(name, options = {})
168
172
  rows[name] = TableRows::TextArea.new(name, options, builder: self).to_html
169
173
  end
@@ -191,7 +195,11 @@ module Effective
191
195
 
192
196
  # Has Many
193
197
  def has_many(name, collection = nil, options = {}, &block)
194
- raise('unsupported')
198
+ value(name).each_with_index do |object, index|
199
+ builder = TableBuilder.new(object, template, options.merge(prefix: human_attribute_name(name).singularize + " ##{index+1}"))
200
+ builder.render(&block)
201
+ builder.rows.each { |child, content| rows["#{name}_#{child}_#{index}".to_sym] = content }
202
+ end
195
203
  end
196
204
 
197
205
  def fields_for(name, object, options = {}, &block)
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '1.14.2'.freeze
2
+ VERSION = '1.14.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.2
4
+ version: 1.14.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-03 00:00:00.000000000 Z
11
+ date: 2023-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails