brick 1.0.66 → 1.0.67
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/extensions.rb +9 -4
- data/lib/brick/frameworks/rails/engine.rb +15 -11
- 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: 60ed6bcfecfc09b579a605a6141e06b958d0e274c010432be8b97980833be6fc
|
4
|
+
data.tar.gz: 4ce18cf47d569f61e58cf25d3bd26577fea4932e7171cbcf5cb7756f9d4a8cc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7691f14a41dad2cea3fcc73f60fc88a57e24ecd8ab1d69575be6b716e43f9ae15eddc6e0e1bd089ba8b3daf7cef2e78ecdaf12a0a86e249ec8f609d00b0a473d
|
7
|
+
data.tar.gz: 237aa7e873db35c6dad6c89c3641c7b9d81016520ddbbc0d1ddfc94576e067adc162c3e8a5f15c983df624e4e3d185d1e1e695a505f7b3a66bda6dd036d91e8c
|
data/lib/brick/extensions.rb
CHANGED
@@ -657,9 +657,12 @@ Module.class_exec do
|
|
657
657
|
full_class_name = +''
|
658
658
|
full_class_name << "::#{self.name}" unless self == Object
|
659
659
|
full_class_name << "::#{plural_class_name.underscore.singularize.camelize}"
|
660
|
-
if
|
661
|
-
(
|
662
|
-
|
660
|
+
if plural_class_name == 'BrickSwagger' ||
|
661
|
+
(
|
662
|
+
(::Brick.config.add_status || ::Brick.config.add_orphans) &&
|
663
|
+
plural_class_name == 'BrickGem'
|
664
|
+
) ||
|
665
|
+
model = self.const_get(full_class_name)
|
663
666
|
# if it's a controller and no match or a model doesn't really use the same table name, eager load all models and try to find a model class of the right name.
|
664
667
|
Object.send(:build_controller, self, class_name, plural_class_name, model, relations)
|
665
668
|
end
|
@@ -1033,7 +1036,7 @@ class Object
|
|
1033
1036
|
self.define_method :orphans do
|
1034
1037
|
instance_variable_set(:@orphans, ::Brick.find_orphans(::Brick.set_db_schema(params)))
|
1035
1038
|
end
|
1036
|
-
return [new_controller_class, code +
|
1039
|
+
return [new_controller_class, code + "end # BrickGem controller\n"]
|
1037
1040
|
when 'BrickSwagger'
|
1038
1041
|
is_swagger = true # if request.format == :json)
|
1039
1042
|
end
|
@@ -1193,6 +1196,8 @@ class Object
|
|
1193
1196
|
else
|
1194
1197
|
instance_variable_set("@#{singular_table_name}".to_sym,
|
1195
1198
|
model.send(:create, send(params_name_sym)))
|
1199
|
+
index
|
1200
|
+
render :index
|
1196
1201
|
end
|
1197
1202
|
end
|
1198
1203
|
|
@@ -96,12 +96,13 @@ module Brick
|
|
96
96
|
|
97
97
|
alias :_brick_find_template :find_template
|
98
98
|
def find_template(*args, **options)
|
99
|
-
unless (
|
99
|
+
unless (is_status = ::Brick.config.add_status && args[0..1] == ['status', ['brick_gem']]) ||
|
100
|
+
(is_orphans = ::Brick.config.add_orphans && args[0..1] == ['orphans', ['brick_gem']]) ||
|
101
|
+
(model_name = (
|
100
102
|
@_brick_model ||
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
(is_orphans = ::Brick.config.add_orphans && args[0..1] == ['orphans', ['brick_gem']])
|
103
|
+
# Used to also have: ActionView.version < ::Gem::Version.new('5.0') &&
|
104
|
+
(args[1].is_a?(Array) ? set_brick_model(args) : nil)
|
105
|
+
)&.name)
|
105
106
|
return _brick_find_template(*args, **options)
|
106
107
|
end
|
107
108
|
|
@@ -156,7 +157,7 @@ module Brick
|
|
156
157
|
end
|
157
158
|
hm_entry << ']'
|
158
159
|
hms_columns << hm_entry
|
159
|
-
when 'show', 'update'
|
160
|
+
when 'show', 'new', 'update'
|
160
161
|
hm_stuff << if hm_fk_name
|
161
162
|
"<%= link_to '#{assoc_name}', #{hm_assoc.klass.name.underscore.tr('/', '_').pluralize}_path({ #{path_keys(hm_assoc, hm_fk_name, "@#{obj_name}", pk)} }) %>\n"
|
162
163
|
else # %%% Would be able to remove this when multiple foreign keys to same destination becomes bulletproof
|
@@ -179,6 +180,7 @@ module Brick
|
|
179
180
|
end.keys.sort.each_with_object(+'') do |v, s|
|
180
181
|
s << "<option value=\"#{v.underscore.gsub('.', '/').pluralize}\">#{v}</option>"
|
181
182
|
end.html_safe
|
183
|
+
table_options << '<option value="brick_status">(Status)</option>'.html_safe
|
182
184
|
table_options << '<option value="brick_orphans">(Orphans)</option>'.html_safe if is_orphans
|
183
185
|
css = +"<style>
|
184
186
|
h1, h3 {
|
@@ -379,9 +381,10 @@ def display_value(col_type, val)
|
|
379
381
|
'?'
|
380
382
|
end
|
381
383
|
end
|
382
|
-
end
|
384
|
+
end
|
385
|
+
callbacks = {} %>"
|
383
386
|
|
384
|
-
if ['index', 'show', 'update'].include?(args.first)
|
387
|
+
if ['index', 'show', 'new', 'update'].include?(args.first)
|
385
388
|
poly_cols = []
|
386
389
|
css << "<% bts = { #{
|
387
390
|
bt_items = bts.each_with_object([]) do |v, s|
|
@@ -537,10 +540,10 @@ if (headerTop) {
|
|
537
540
|
}
|
538
541
|
</script>"
|
539
542
|
|
540
|
-
erd_markup =
|
543
|
+
erd_markup = if @_brick_model
|
544
|
+
"<div id=\"mermaidErd\" class=\"mermaid\">
|
541
545
|
erDiagram
|
542
546
|
<% model_short_name = #{@_brick_model.name.split('::').last.inspect}
|
543
|
-
callbacks = {}
|
544
547
|
@_brick_bt_descrip&.each do |bt|
|
545
548
|
bt_class = bt[1].first.first
|
546
549
|
callbacks[bt_name = bt_class.name.split('::').last] = bt_class
|
@@ -595,6 +598,7 @@ erDiagram
|
|
595
598
|
%>
|
596
599
|
</div>
|
597
600
|
"
|
601
|
+
end
|
598
602
|
inline = case args.first
|
599
603
|
when 'index'
|
600
604
|
obj_pk = if pk&.is_a?(Array) # Composite primary key?
|
@@ -890,7 +894,7 @@ erDiagram
|
|
890
894
|
#{script}"
|
891
895
|
end
|
892
896
|
|
893
|
-
when 'show', 'update'
|
897
|
+
when 'show', 'new', 'update'
|
894
898
|
+"#{css}
|
895
899
|
|
896
900
|
<svg id=\"revertTemplate\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"
|
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.67
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lorin Thwaits
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|