effective_bootstrap 1.21.2 → 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: 0b8ff70344d83b63351e5b03f2c05c82fc2c14bb45588a973dfadd8c644efd28
4
- data.tar.gz: f8f97aa9e4e108c25cd521aca8d656a5086f6bfc6a4857b4ed71c6d639ba0025
3
+ metadata.gz: 3d9fad7395dab8ef5344e348c5bc33ea0c16b31e4cb106c0493eefc3efe098b7
4
+ data.tar.gz: 7b6fd61bbe7dda965405d60eb3d28eedafa6669210e028001e63c27b0e410087
5
5
  SHA512:
6
- metadata.gz: c73246a94e4a8d2fd8b4c4af5415ea1ca5ba555a7c54a4bbafd5a0f942726f1e512e3ea86e59f082bd58d56c6c3573a8950fccaad44c46bfb83724e072b8a2fd
7
- data.tar.gz: bc720e9b612b6a28b1144a993f87b2f1d51b4f48c8e9a818d47881e4c1c5c4ba4a7aa30122983b9b28fc7ff61fa907e70ef458bca03ae3dfa91be1d107b50eae
6
+ metadata.gz: 2b775dd66f8e69f719f9f3c2355dfcf54d7fbd678f8098cc8020f5b841595e3220c0aa491ad22abf72b43fd441d397e4cbbc25d055170d8410250d68564f8da9
7
+ data.tar.gz: 381b8d84acae09d68169ced5a9bb4caf7aa4dd958f862c584f873361ecce108791bfdbe42daea8173754eb75ffd670d69313ec9b1ec2b4ef616e8d76c1a2c45c
@@ -192,6 +192,18 @@ module Effective
192
192
  EffectiveResources.authorized?(@template, :admin, :effective_article_editor) ? :default : :restricted
193
193
  end
194
194
 
195
+ def build_human_label
196
+ name = self.name.to_s
197
+
198
+ label = if object
199
+ object.class.human_attribute_name(name).sub(/^Rich text /, '').capitalize
200
+ else
201
+ BLANK
202
+ end
203
+
204
+ label
205
+ end
206
+
195
207
  end
196
208
  end
197
209
  end
@@ -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.2'.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.2
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-11 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