brick 1.0.195 → 1.0.197

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: 48a47a4a4fd18918a7e1b3f90ffb1953afb11c569e19664920d3921e4806b4fe
4
- data.tar.gz: 2a50f06d5790c7facfec994693c5f88f747b96825f62cf6b51a81dbf97f88aca
3
+ metadata.gz: bfd8798f339e1bb363ca73f7b3285cdb32471cbae2c6ff5a500b43db6536840a
4
+ data.tar.gz: be5744fd98d6323ecb33be2b77f50e9ee5b872bc8356ef4d08372cddab4d9920
5
5
  SHA512:
6
- metadata.gz: dc9840fb52d71e04ef8a899d16289276d11556f55492d9190aaf6387659d520c105c7885c80c65a5ddba5a4294c0f088cbf03adb70969b9f948dd85721865fe2
7
- data.tar.gz: 2846f746ad0f325ea5915b8ad68db9bb39d8a81061adf3ca6dfa996bc209d193887eea22b4eb9c6bdf65131c1c82f2ce980eedea9f7be886b0d9084017fcd553
6
+ metadata.gz: 8848e2c6a93a75f454b0b9ebd4712769c39868583fc6d6659548c6eb3818eec12bfb7968580a4c684eab67095fca754553a42bc4b71729b223f79882731ebfd3
7
+ data.tar.gz: b764da2f667e22e5d02e6f5354e3b4b30164827c5b40647b7fca672038f7435ebe14f32dc22d05c54375a29e94c68d82b61dc590099f9e26f2b4843092861bed
@@ -436,13 +436,9 @@ module ActiveRecord
436
436
  order_by = ordering&.each_with_object([]) do |ord_part, s| # %%% If a term is also used as an eqi-condition in the WHERE clause, it can be omitted from ORDER BY
437
437
  case ord_part
438
438
  when String
439
- ord_expr = if ord_part.index('^^^')
440
- ord_part.gsub('^^^', _br_quoted_name(table_name))
441
- else
442
- _br_quoted_name(ord_part)
443
- end
439
+ ord_expr = _br_quoted_name(ord_part.gsub('^^^', table_name))
444
440
  s << Arel.sql(ord_expr)
445
- order_by_txt&.<<("Arel.sql(#{ord_expr.inspect})")
441
+ order_by_txt&.<<(ord_expr.index('.') ? "Arel.sql(#{ord_expr.inspect})" : ord_expr)
446
442
  else # Expecting only Symbol
447
443
  ord_part = ord_part.to_s
448
444
  if ord_part[0] == '-' # First char '-' means descending order
@@ -1917,7 +1913,7 @@ class Object
1917
1913
  cspd.select! { |val| val == "'self'" }
1918
1914
  cspd << style_value
1919
1915
  else
1920
- cspd << "'sha256-ZMGrNwNigXBkvHBZrPrNurCVlJycGWtt2uvoEigUowg='"
1916
+ cspd << "'sha256-0Vb7j3kDGE3oNfwMpRLClTSCUo/q74bvbt3p6kG/gkM='"
1921
1917
  end
1922
1918
  cspd << 'https://cdn.jsdelivr.net'
1923
1919
  end
@@ -3472,9 +3468,9 @@ module Brick
3472
3468
  separator ||= '_'
3473
3469
  res_name = (tbl_name_parts = tbl_name.split('.'))[0..-2].first
3474
3470
  res_name << '.' if res_name
3475
- (res_name ||= +'') << (relation || ::Brick.relations.fetch(tbl_name, nil))&.fetch(:resource, nil) || tbl_name_parts.last
3471
+ (res_name ||= +'') << (relation ||= ::Brick.relations.fetch(tbl_name, nil))&.fetch(:resource, nil) || tbl_name_parts.last
3476
3472
 
3477
- res_parts = ((mode == :singular) ? res_name.singularize : res_name).split('.')
3473
+ res_parts = ((mode == :singular) ? tbl_name.singularize : tbl_name).split('.')
3478
3474
  res_parts.shift if ::Brick.apartment_multitenant && res_parts.length > 1 && res_parts.first == ::Brick.apartment_default_tenant
3479
3475
  if (aps = relation&.fetch(:auto_prefixed_schema, nil)) && res_parts.last.start_with?(aps)
3480
3476
  last_part = res_parts.last[aps.length..-1]
@@ -3491,7 +3487,7 @@ module Brick
3491
3487
  index = index.tr('_', 'x') if separator == 'x'
3492
3488
  # Rails applies an _index suffix to that route when the resource name isn't something plural
3493
3489
  index << '_index' if mode != :singular && separator == '_' &&
3494
- index == (path_prefix + [name&.underscore&.tr('/', '_') || '_']).join(separator)
3490
+ index == (path_prefix + [relation[:class_name]&.underscore&.tr('/', '_') || '_']).join(separator)
3495
3491
  index
3496
3492
  end
3497
3493
 
@@ -940,7 +940,11 @@ tr th a {
940
940
  .add-hm-related {
941
941
  float: right;
942
942
  }
943
-
943
+ #tblAddCol {
944
+ position: relative;
945
+ z-index: 2;
946
+ border: 2px solid blue;
947
+ }
944
948
  tr th, tr td {
945
949
  padding: 0.2em 0.5em;
946
950
  }
@@ -998,6 +1002,12 @@ a.big-arrow {
998
1002
  .right {
999
1003
  text-align: right;
1000
1004
  }
1005
+ .paddingBottomZero {
1006
+ padding-bottom: 0px;
1007
+ }
1008
+ .paddingTopZero {
1009
+ padding-top: 0px;
1010
+ }
1001
1011
  .orphan {
1002
1012
  color: red;
1003
1013
  white-space: nowrap;
@@ -1193,18 +1203,18 @@ erDiagram
1193
1203
  # Make into a server control with a javascript snippet
1194
1204
  # Have post back go to a common "brick_schema" endpoint, this one for add_column
1195
1205
  "
1196
- <table style=\"position: relative; z-index: 2; border: 2px solid blue;\"><tr>
1206
+ <table id=\"tblAddCol\"><tr>
1197
1207
  <td rowspan=\"2\">Add<br>Column</td>
1198
- <td style=\"padding-bottom: 0px\">Type</td><td style=\"padding-bottom: 0px\">Name</td>
1208
+ <td class=\"paddingBottomZero\">Type</td><td class=\"paddingBottomZero\">Name</td>
1199
1209
  <td rowspan=\"2\"><input type=\"button\" id=\"btnAddCol\" value=\"+\"></td>
1200
- </tr><tr><td style=\"padding-top: 0px\">
1210
+ </tr><tr><td class=\"paddingTopZero\">
1201
1211
  <select id=\"ddlColType\">
1202
1212
  <option value=\"string\">String</option>
1203
1213
  <option value=\"text\">Text</option>
1204
1214
  <option value=\"integer\">Integer</option>
1205
1215
  <option value=\"bool\">Boolean</option>
1206
1216
  </select></td>
1207
- <td style=\"padding-top: 0px\"><input id=\"txtColName\"></td>
1217
+ <td class=\"paddingTopZero\"><input id=\"txtColName\"></td>
1208
1218
  </tr></table>
1209
1219
  <script>
1210
1220
  var btnAddCol = document.getElementById(\"btnAddCol\");
@@ -1590,9 +1600,12 @@ end %>#{"
1590
1600
  <table id=\"resourceName\"><td><h1><%= page_title %></h1></td>
1591
1601
  <% rel = Brick.relations[#{model_name}.table_name]
1592
1602
  if (in_app = rel.fetch(:existing, nil)&.fetch(:show, nil))
1593
- in_app = send(\"#\{in_app}_path\", #{pk.is_a?(String) ? "obj.#{pk}" : '[' + pk.map { |pk_part| "obj.#{pk_part}" }.join(', ') + ']' }) if in_app.is_a?(Symbol) %>
1603
+ begin
1604
+ in_app = send(\"#\{in_app}_path\", #{pk.is_a?(String) ? "obj.#{pk}" : '[' + pk.map { |pk_part| "obj.#{pk_part}" }.join(', ') + ']' }) if in_app.is_a?(Symbol) %>
1594
1605
  <td><%= link_to(::Brick::Rails::IN_APP.html_safe, in_app) %></td>
1595
- <% end
1606
+ <% rescue ActionController::UrlGenerationError
1607
+ end
1608
+ end
1596
1609
 
1597
1610
  if Object.const_defined?('Avo') && ::Avo.respond_to?(:railtie_namespace) %>
1598
1611
  <td><%= link_to_brick(
@@ -47,9 +47,12 @@ module Brick::Rails::FormTags
47
47
  "
48
48
  end
49
49
  if rel && show_in_app_button != false && (in_app = rel.fetch(:existing, nil)&.fetch(:index, nil))
50
- in_app = send("#{in_app}_path") if in_app.is_a?(Symbol)
51
- out << " <td title=\"Show in app\">#{link_to(::Brick::Rails::IN_APP.html_safe, in_app)}</td>
50
+ begin
51
+ in_app = send("#{in_app}_path") if in_app.is_a?(Symbol)
52
+ out << " <td title=\"Show in app\">#{link_to(::Brick::Rails::IN_APP.html_safe, in_app)}</td>
52
53
  "
54
+ rescue ActionController::UrlGenerationError # Avoid snags like "No route matches {:action=>"index", :controller=>"categories/products"}, missing required keys: [:category_id]"
55
+ end
53
56
  end
54
57
  if show_avo_button != false && Object.const_defined?('Avo') && ::Avo.respond_to?(:railtie_namespace) && klass.name.exclude?('::')
55
58
  out << "
@@ -74,7 +74,7 @@ module Brick
74
74
  schema_prefix = "#{schema_name}."
75
75
  end
76
76
 
77
- resource_name = v.fetch(:resource, nil)
77
+ resource_name = v.fetch(:resource, nil) || k
78
78
  next if !resource_name ||
79
79
  existing_controllers.key?(
80
80
  controller_prefix + (resource_name = "#{schema_prefix&.tr('.', '/')}#{resource_name}".pluralize)
@@ -82,7 +82,7 @@ module Brick
82
82
 
83
83
  object_name = k.split('.').last # Take off any first schema part
84
84
 
85
- full_schema_prefix = if (full_aps = aps = v.fetch(:auto_prefixed_schema, nil))
85
+ full_schema_prefix = if (aps = v.fetch(:auto_prefixed_schema, nil))
86
86
  aps = aps[0..-2] if aps[-1] == '_'
87
87
  (schema_prefix&.dup || +'') << "#{aps}."
88
88
  else
@@ -90,7 +90,6 @@ module Brick
90
90
  end
91
91
 
92
92
  # Track routes being built
93
- resource_name = v.fetch(:resource, nil) || k
94
93
  if (class_name = v.fetch(:class_name, nil))
95
94
  if v.key?(:isView)
96
95
  view_class_length = class_name.length if class_name.length > view_class_length
@@ -98,7 +97,7 @@ module Brick
98
97
  else
99
98
  table_class_length = class_name.length if class_name.length > table_class_length
100
99
  tables
101
- end << [class_name, aps, "#{"#{schema_name}/" if schema_name}#{resource_name[full_aps&.length || 0 .. -1]}"]
100
+ end << [class_name, aps, "#{"#{schema_name}/" if schema_name}#{resource_name}"]
102
101
  end
103
102
 
104
103
  options = {}
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 195
8
+ TINY = 197
9
9
 
10
10
  # PRE is nil unless it's a pre-release (beta, RC, etc.)
11
11
  PRE = nil
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.195
4
+ version: 1.0.197
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-12-30 00:00:00.000000000 Z
11
+ date: 2024-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord