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 +4 -4
- data/app/models/effective/table_builder.rb +10 -2
- data/lib/effective_bootstrap/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: 473950005d6f69ad8d03ccdb176cbddf84c3cc89cbec7a73dcfc968e2ef1eca9
|
4
|
+
data.tar.gz: c72db95cd5971de88cb157fc2e35ef9e6b507038af495b53ea0ab94181eae2c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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)
|
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.
|
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-
|
11
|
+
date: 2023-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|