brick 1.0.180 → 1.0.181

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: c5cc0c73d63cbebcbad81388f8ae444c72dafa57a38c1f2a95b3b7f5bd4a621a
4
- data.tar.gz: 8670884c20ac46ee01d28c97fabe97694a2f3862761228e16c0422790a937cc8
3
+ metadata.gz: 322ed139c5ec7c48572ab2ea87830998fe742c32ac56e91d2eed97084f7d8c42
4
+ data.tar.gz: 836c21610811fb2322bdfd572d2b1ccce0a23464bf54512ae160149a6bfdb972
5
5
  SHA512:
6
- metadata.gz: 62d010ea2765fe14369e18db8b123426f5ace62025b053b453656870223073b75f95add727e5cb2073f78d0f58a88cb293904bcbee08726b0ba09947c16f3709
7
- data.tar.gz: 25dbb2878198256df74cc36934bb7fcaab24a3dfd0b9cac55de8d04e2fcfce8ff0158458cd2d76004e354020addd6b38de5001ab79bebecb9f8afaa1f3e5133f
6
+ metadata.gz: 034b252fc08bc09216a33d8cd34a97c4afa81a86943d319e0bccd26a387060d69a3d1e0b80de2ba29e9f57c06e7eff3b41cbdfa92354f8a754e350b0ab8daacf
7
+ data.tar.gz: 0ba1422cb56af76c4e0eb89de5fd940a90dcfb93fd90016852cb9631d71542825dea0187fd44ac66fa65a79905583b9dec92b3615b67db1f16d4ad5e5357f1ac
@@ -115,14 +115,30 @@ if Object.const_defined?('ActionPack') && !ActionPack.respond_to?(:version)
115
115
  end
116
116
  end
117
117
  end
118
- if Bundler.locked_gems&.dependencies.key?('action_view')
118
+ if Object.const_defined?('Bundler') && Bundler.locked_gems&.dependencies.key?('action_view')
119
119
  require 'action_view' # Needed for Rails <= 4.0
120
- if Object.const_defined?('ActionView') && !ActionView.respond_to?(:version)
121
- module ActionView
120
+ module ::ActionView
121
+ if Object.const_defined?('ActionView') && !ActionView.respond_to?(:version)
122
122
  def self.version
123
123
  ActionPack.version
124
124
  end
125
125
  end
126
+ if self.version < ::Gem::Version.new('5.2')
127
+ module Helpers
128
+ module TextHelper
129
+ # Older versions of #pluralize lack the all-important .to_s
130
+ def pluralize(count, singular, plural_arg = nil, plural: plural_arg, locale: I18n.locale)
131
+ word = if (count == 1 || count.to_s =~ /^1(\.0+)?$/)
132
+ singular
133
+ else
134
+ plural || singular.pluralize(locale)
135
+ end
136
+
137
+ "#{count || 0} #{word}"
138
+ end
139
+ end
140
+ end
141
+ end
126
142
  end
127
143
  end
128
144
 
@@ -1404,12 +1404,6 @@ end
1404
1404
  #{erd_markup}
1405
1405
 
1406
1406
  <%= # Consider getting the name from the association -- hm.first.name -- if a more \"friendly\" alias should be used for a screwy table name
1407
- cols = {#{hms_keys = []
1408
- hms_headers.map do |hm|
1409
- hms_keys << (assoc_name = (assoc = hm.first).name.to_s)
1410
- "#{assoc_name.inspect} => [#{(assoc.options[:through] && !assoc.through_reflection).inspect}, #{assoc.klass.name}, #{hm[1].inspect}, #{hm[2].inspect}]"
1411
- end.join(', ')}}
1412
-
1413
1407
  # If the resource is missing, has the user simply created an inappropriately pluralised name for a table?
1414
1408
  @#{table_name} ||= if (dym_list = instance_variables.reject do |entry|
1415
1409
  entry.to_s.start_with?('@_') ||
@@ -1429,6 +1423,13 @@ end
1429
1423
  end
1430
1424
  end
1431
1425
 
1426
+ # Starts as being just has_many columns, and will be augmented later with all the other columns
1427
+ cols = {#{hms_keys = []
1428
+ hms_headers.map do |hm|
1429
+ hms_keys << (assoc_name = (assoc = hm.first).name.to_s)
1430
+ "#{assoc_name.inspect} => [#{(assoc.options[:through] && !assoc.through_reflection).inspect}, #{assoc.klass.name}, #{hm[1].inspect}, #{hm[2].inspect}]"
1431
+ end.join(', ')}}
1432
+
1432
1433
  # %%% Why in the Canvas LMS app does ActionView::Helpers get cleared / reloaded, or otherwise lose access to #brick_grid ???
1433
1434
  # Possible fix if somewhere we can implement the #include with:
1434
1435
  # (ActiveSupport.const_defined?('Reloader') ? ActiveSupport : ActionDispatch)::Reloader.to_prepare do ... end
@@ -1436,8 +1437,8 @@ end
1436
1437
  # Rails.application.reloader.to_prepare do ... end
1437
1438
  self.class.class_exec { include ::Brick::Rails::FormTags } unless respond_to?(:brick_grid)
1438
1439
  # Write out the mega-grid
1439
- brick_grid(@#{table_name}, @_brick_bt_descrip, @_brick_sequence, @_brick_incl, @_brick_excl,
1440
- cols, poly_cols, bts, #{hms_keys.inspect}, {#{hms_columns.join(', ')}}) %>
1440
+ brick_grid(@#{table_name}, @_brick_sequence, @_brick_incl, @_brick_excl,
1441
+ cols, bt_descrip: @_brick_bt_descrip, poly_cols: poly_cols, bts: bts, hms_keys: #{hms_keys.inspect}, hms_cols: {#{hms_columns.join(', ')}}) %>
1441
1442
 
1442
1443
  #{"<hr><%= link_to(\"New #{new_path_name = "new_#{path_obj_name}_path"
1443
1444
  obj_name}\", #{new_path_name}, { class: '__brick' }) if respond_to?(:#{new_path_name}) %>" unless @_brick_model.is_view?}
@@ -1,7 +1,7 @@
1
1
  module Brick::Rails::FormTags
2
2
  # Our super speedy grid
3
- def brick_grid(relation = nil, bt_descrip = nil, sequence = nil, inclusions = nil, exclusions = nil,
4
- cols = {}, poly_cols = nil, bts = {}, hms_keys = [], hms_cols = {},
3
+ def brick_grid(relation = nil, sequence = nil, inclusions = nil, exclusions = nil,
4
+ cols = {}, bt_descrip: nil, poly_cols: nil, bts: {}, hms_keys: [], hms_cols: {},
5
5
  show_header: nil, show_row_count: nil, show_erd_button: nil, show_new_button: nil, show_avo_button: nil, show_aa_button: nil)
6
6
  # When a relation is not provided, first see if one exists which matches the controller name
7
7
  unless (relation ||= instance_variable_get("@#{controller_name}".to_sym))
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 180
8
+ TINY = 181
9
9
 
10
10
  # PRE is nil unless it's a pre-release (beta, RC, etc.)
11
11
  PRE = nil
data/lib/brick.rb CHANGED
@@ -1544,7 +1544,7 @@ ActiveSupport.on_load(:active_record) do
1544
1544
  else
1545
1545
  {}
1546
1546
  end
1547
- _original_initialize(klass, **kwargs)
1547
+ _original_initialize(klass, *args, **kwargs)
1548
1548
  end
1549
1549
  end
1550
1550
  end
@@ -2036,11 +2036,13 @@ if ActiveRecord.version < ::Gem::Version.new('6.0') && ruby_version >= ::Gem::Ve
2036
2036
  end
2037
2037
 
2038
2038
  # AR >= 5.0 on Ruby >= 3.0
2039
- ::ActiveRecord::Type::AdapterSpecificRegistry.class_exec do
2040
- alias :_brick_add_modifier :add_modifier
2041
- def add_modifier(*args, **kwargs)
2042
- kwargs.merge!(args.pop) if args.length > 2 && args.last.is_a?(Hash)
2043
- _brick_add_modifier(*args, **kwargs)
2039
+ if ActiveRecord.version >= ::Gem::Version.new('5.0')
2040
+ ::ActiveRecord::Type::AdapterSpecificRegistry.class_exec do
2041
+ alias :_brick_add_modifier :add_modifier
2042
+ def add_modifier(*args, **kwargs)
2043
+ kwargs.merge!(args.pop) if args.length > 2 && args.last.is_a?(Hash)
2044
+ _brick_add_modifier(*args, **kwargs)
2045
+ end
2044
2046
  end
2045
2047
  end
2046
2048
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brick
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.180
4
+ version: 1.0.181
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorin Thwaits
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-08 00:00:00.000000000 Z
11
+ date: 2023-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord