effective_bootstrap 1.21.3 → 1.21.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec216828e00b4cfff3fb8e30858c50629681b9bbe39a1d72a3e820d5cdefc419
4
- data.tar.gz: b1070b8663d763b2b4def30f28e271184603de76c831bf0eded927d28d5a7ed8
3
+ metadata.gz: 3d9fad7395dab8ef5344e348c5bc33ea0c16b31e4cb106c0493eefc3efe098b7
4
+ data.tar.gz: 7b6fd61bbe7dda965405d60eb3d28eedafa6669210e028001e63c27b0e410087
5
5
  SHA512:
6
- metadata.gz: 5c7f9145e59c41703318d5ba73c7c8cb59cbe30cbb7318a2c775fa321eb4c5c59347579b3476ca5219f315a4ce2e226ca09b93ff4b1e05ad9eea32166af16f03
7
- data.tar.gz: 3ce7db51d246e4251a4b7e080a609dacd33cfc2a73e07176164c579e401ff6ab6460bc3dc4a706253f5c74da82b36ddcc140470da6efc8a8781dd936c15f75ce
6
+ metadata.gz: 2b775dd66f8e69f719f9f3c2355dfcf54d7fbd678f8098cc8020f5b841595e3220c0aa491ad22abf72b43fd441d397e4cbbc25d055170d8410250d68564f8da9
7
+ data.tar.gz: 381b8d84acae09d68169ced5a9bb4caf7aa4dd958f862c584f873361ecce108791bfdbe42daea8173754eb75ffd670d69313ec9b1ec2b4ef616e8d76c1a2c45c
@@ -37,7 +37,7 @@ module Effective
37
37
  # Using = f.content_for does not create a row.
38
38
  # So rows wille be blank when using the default syntax
39
39
  # And rows will be present when we render a form, or any form fields
40
- build_resource_rows(only: only, except: except) if rows.blank?
40
+ build_resource_rows(only: only, except: except) unless block_given?
41
41
 
42
42
  # This gives us a second run through the rows, if you pass additionally
43
43
  build_resource_rows(only: additionally) if additionally.present?
@@ -47,10 +47,16 @@ module Effective
47
47
 
48
48
  # Filter out some hardcoded ones
49
49
  content = content.except(*filtered) if filtered.present?
50
- content = content.except(*except) if except.present?
51
50
 
52
- content_tag(:table, class: options.fetch(:class, 'table table-sm table-striped table-hover effective-table-summary')) do
53
- content_tag(:tbody, content.values.join.html_safe)
51
+ if except.present?
52
+ content = content.except(*except)
53
+ content = content.reject { |key, _| except.any? { |ex| key.to_s.start_with?(ex.to_s + '_') } }
54
+ end
55
+
56
+ if content.present?
57
+ content_tag(:table, class: options.fetch(:class, 'table table-sm table-striped table-hover effective-table-summary')) do
58
+ content_tag(:tbody, content.values.join.html_safe)
59
+ end
54
60
  end
55
61
  end
56
62
 
@@ -252,7 +258,9 @@ module Effective
252
258
  nil
253
259
  end
254
260
 
255
- def fields_for(name, object, options = {}, &block)
261
+ def fields_for(name, collection = nil, options = {}, &block)
262
+ options = collection if options.blank? && collection.kind_of?(Hash)
263
+
256
264
  values = value(name)
257
265
 
258
266
  if values.respond_to?(:each_with_index)
@@ -262,7 +270,7 @@ module Effective
262
270
  builder.rows.each { |child, content| rows["#{name}_#{child}_#{index}".to_sym] = content }
263
271
  end
264
272
  else
265
- builder = TableBuilder.new(object, template, options.merge(prefix: human_attribute_name(name)))
273
+ builder = TableBuilder.new(object.send(name), template, options)
266
274
  builder.render(&block)
267
275
  builder.rows.each { |child, content| rows["#{name}_#{child}".to_sym] = content }
268
276
  end
@@ -16,6 +16,14 @@ module Effective
16
16
  end
17
17
  end
18
18
 
19
+ # Humanized label or the label from form
20
+ def label
21
+ text = options[:label] || EffectiveResources.et(builder.object, name).sub(/^Rich text /, '').capitalize
22
+ prefix = builder.options[:prefix]
23
+
24
+ [*prefix, text].join(': ')
25
+ end
26
+
19
27
  end
20
28
  end
21
29
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '1.21.3'.freeze
2
+ VERSION = '1.21.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.21.3
4
+ version: 1.21.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: 2025-06-16 00:00:00.000000000 Z
11
+ date: 2025-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails