brick 1.0.111 → 1.0.112
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 +4 -4
- data/lib/brick/frameworks/rails/engine.rb +32 -19
- data/lib/brick/version_number.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: 69051263cec00b3672b8d48b0c595ff6875b81f27e7995be72a03d6699ad6d02
|
4
|
+
data.tar.gz: 217687ad2f6b93c33dc781f5930a0475a60fb27d782593109055beaae19f4e55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eff4c8a9f59673d14be1d890b067e17e631b1d6938a22b81c1ec45c3785489195d5d9e93939a38c681d36d844df2ad9a932584d8269b0fd2ef678de428c805c
|
7
|
+
data.tar.gz: 723425258d449708f18e086f289147b3402f728c93fbcba3a16654c3d15b4fe715022e427cb3f87e731bf9b73d693a5d4f43a500bdbde3641b69ac61e4c35e35
|
@@ -322,18 +322,26 @@ window.addEventListener(\"popstate\", linkSchemas);
|
|
322
322
|
end
|
323
323
|
|
324
324
|
def set_brick_model(find_args)
|
325
|
-
#
|
326
|
-
#
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
325
|
+
# Return an appropriate model for a given view template request.
|
326
|
+
# find_args will generally be something like: ["index", ["categories"]]
|
327
|
+
# and must cycle through all of find_args[1] because in some cases such as with Devise we get something like:
|
328
|
+
# ["create", ["users/sessions", "sessions", "devise/sessions", "devise", "application"], false, []]
|
329
|
+
find_args[1]&.any? do |resource_name|
|
330
|
+
if (class_name = (resource_parts = resource_name.split('/')).last&.singularize)
|
331
|
+
resource_parts[-1] = class_name # Make sure the last part, defining the class name, is singular
|
332
|
+
begin
|
333
|
+
if (model = Object.const_get(resource_parts.map(&:camelize).join('::')))&.is_a?(Class) && (
|
334
|
+
['index', 'show'].include?(find_args.first) || # Everything has index and show
|
335
|
+
# Only CUD stuff has create / update / destroy
|
336
|
+
(!model.is_view? && ['new', 'create', 'edit', 'update', 'destroy'].include?(find_args.first))
|
337
|
+
)
|
338
|
+
@_brick_model = model
|
339
|
+
end
|
340
|
+
rescue
|
341
|
+
end
|
335
342
|
end
|
336
343
|
end
|
344
|
+
@_brick_model
|
337
345
|
end
|
338
346
|
|
339
347
|
def path_keys(hm_assoc, fk_name, pk)
|
@@ -356,6 +364,7 @@ window.addEventListener(\"popstate\", linkSchemas);
|
|
356
364
|
|
357
365
|
alias :_brick_find_template :find_template
|
358
366
|
def find_template(*args, **options)
|
367
|
+
find_template_err = nil
|
359
368
|
unless (model_name = @_brick_model&.name) ||
|
360
369
|
(is_status = ::Brick.config.add_status && args[0..1] == ['status', ['brick_gem']]) ||
|
361
370
|
(is_orphans = ::Brick.config.add_orphans && args[0..1] == ['orphans', ['brick_gem']]) ||
|
@@ -364,10 +373,11 @@ window.addEventListener(\"popstate\", linkSchemas);
|
|
364
373
|
if (possible_template = _brick_find_template(*args, **options))
|
365
374
|
return possible_template
|
366
375
|
end
|
367
|
-
rescue
|
376
|
+
rescue StandardError => e
|
377
|
+
find_template_err = e # Can come up with stuff like Devise which has its own view templates
|
368
378
|
end
|
369
379
|
# Used to also have: ActionView.version < ::Gem::Version.new('5.0') &&
|
370
|
-
model_name =
|
380
|
+
model_name = set_brick_model(args)&.name
|
371
381
|
end
|
372
382
|
|
373
383
|
if @_brick_model
|
@@ -1154,7 +1164,7 @@ erDiagram
|
|
1154
1164
|
td_count += 1 %>
|
1155
1165
|
<td><%= link_to_brick(
|
1156
1166
|
avo_svg,
|
1157
|
-
{ index_proc: Proc.new do |
|
1167
|
+
{ index_proc: Proc.new do |_avo_model, relation|
|
1158
1168
|
path_helper = \"resources_#\{relation.fetch(:auto_prefixed_schema, nil)}#\{model.model_name.route_key}_path\".to_sym
|
1159
1169
|
::Avo.railtie_routes_url_helpers.send(path_helper) if ::Avo.railtie_routes_url_helpers.respond_to?(path_helper)
|
1160
1170
|
end,
|
@@ -1436,11 +1446,9 @@ end
|
|
1436
1446
|
<% when :boolean %>
|
1437
1447
|
<%= f.check_box k.to_sym %>
|
1438
1448
|
<% when :integer, :decimal, :float %>
|
1439
|
-
<%=
|
1440
|
-
|
1441
|
-
|
1442
|
-
f.number_field k.to_sym
|
1443
|
-
end %>
|
1449
|
+
<%= digit_pattern = col_type == :integer ? '\\d*' : '\\d*(?:\\.\\d*|)'
|
1450
|
+
# Used to do this for float / decimal: f.number_field k.to_sym
|
1451
|
+
f.text_field k.to_sym, { pattern: digit_pattern, class: 'check-validity' } %>
|
1444
1452
|
<% when *dt_pickers.keys
|
1445
1453
|
is_includes_dates = true %>
|
1446
1454
|
<%= f.text_field k.to_sym, { class: dt_pickers[col_type] } %>
|
@@ -1542,7 +1550,12 @@ end}
|
|
1542
1550
|
</body>
|
1543
1551
|
</html>
|
1544
1552
|
"
|
1545
|
-
|
1553
|
+
else # args.first isn't index / show / edit / new / orphans / status
|
1554
|
+
if find_template_err # Can surface when gems have their own view templates
|
1555
|
+
raise find_template_err
|
1556
|
+
else # Can surface if someone made their own controller which has a screwy action
|
1557
|
+
puts "Couldn't work with action #{args.first}"
|
1558
|
+
end
|
1546
1559
|
end
|
1547
1560
|
unless is_crosstab
|
1548
1561
|
inline << "
|
data/lib/brick/version_number.rb
CHANGED
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.
|
4
|
+
version: 1.0.112
|
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-02-
|
11
|
+
date: 2023-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|