brick 1.0.114 → 1.0.115
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brick/extensions.rb +5 -2
- data/lib/brick/frameworks/rails/engine.rb +40 -12
- data/lib/brick/version_number.rb +1 -1
- data/lib/brick.rb +23 -5
- 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: 6e92e1445b603e8611ad927b8864b6ff04fd819d2f2243051d109d0894838e0d
|
4
|
+
data.tar.gz: b76bc7adf85927a5ff4988027a0d7ff1d40b84d4a80531d23390867bcca0fc5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9caa3d9fdbc5229123058ec526482bf4c6926c42a44012d974a26d4f94f6f0e2f1dd2040ee76b1fbec21e431ea479694030365a1982878c6100245a607803260
|
7
|
+
data.tar.gz: 0e09bb3d9556bc8b4a442eccc9f19a374684c901dc0f9769030313ebdc57248f31a994e5deb7dbde394f066187b961eab169545e3466ab0851cb6df7636c62f1
|
data/lib/brick/extensions.rb
CHANGED
@@ -972,7 +972,10 @@ Module.class_exec do
|
|
972
972
|
end
|
973
973
|
# puts "#{self.name} - #{args.first}"
|
974
974
|
desired_classname = (self == Object || !name) ? requested : "#{name}::#{requested}"
|
975
|
-
if ((is_defined = self.const_defined?(args.first)) && (possible = self.const_get(args.first)) &&
|
975
|
+
if ((is_defined = self.const_defined?(args.first)) && (possible = self.const_get(args.first)) &&
|
976
|
+
# Reset `possible` if it's a controller request that's not a perfect match
|
977
|
+
# Was: (possible = nil) but changed to #local_variable_set in order to suppress the "= should be ==" warning
|
978
|
+
(possible.name == desired_classname || (is_controller && binding.local_variable_set(:possible, nil)))) ||
|
976
979
|
# Try to require the respective Ruby file
|
977
980
|
((filename = ActiveSupport::Dependencies.search_for_file(desired_classname.underscore) ||
|
978
981
|
(self != Object && ActiveSupport::Dependencies.search_for_file((desired_classname = requested).underscore))
|
@@ -983,7 +986,7 @@ Module.class_exec do
|
|
983
986
|
# then return what we've found.
|
984
987
|
(is_defined && !::Brick.is_eager_loading) # Used to also have: && possible != self
|
985
988
|
if (!brick_root && (filename || possible.instance_of?(Class))) ||
|
986
|
-
(possible.instance_of?(Module) && possible
|
989
|
+
(possible.instance_of?(Module) && possible&.module_parent == self) ||
|
987
990
|
(possible.instance_of?(Class) && possible == self) # Are we simply searching for ourselves?
|
988
991
|
return possible
|
989
992
|
end
|
@@ -82,6 +82,15 @@ function linkSchemas() {
|
|
82
82
|
}
|
83
83
|
};
|
84
84
|
"
|
85
|
+
BRICK_SVG = "<svg version=\"1.1\" style=\"display: inline; padding-left: 0.5em;\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"
|
86
|
+
viewBox=\"0 0 58 58\" height=\"1.4em\" xml:space=\"preserve\">
|
87
|
+
<g>
|
88
|
+
<polygon style=\"fill:#C2615F;\" points=\"58,15.831 19.106,35.492 0,26.644 40,6\"/>
|
89
|
+
<polygon style=\"fill:#6D4646;\" points=\"19,52 0,43.356 0,26.644 19,35\"/>
|
90
|
+
<polygon style=\"fill:#894747;\" points=\"58,31.559 19,52 19,35 58,15.831\"/>
|
91
|
+
</g>
|
92
|
+
</svg>
|
93
|
+
".html_safe
|
85
94
|
|
86
95
|
# paths['app/models'] << 'lib/brick/frameworks/active_record/models'
|
87
96
|
config.brick = ActiveSupport::OrderedOptions.new
|
@@ -246,15 +255,7 @@ window.addEventListener(\"popstate\", linkSchemas);
|
|
246
255
|
end
|
247
256
|
def to_s
|
248
257
|
@_name.to_s.html_safe + @vc.instance_variable_get(:@__vc_helpers)&.link_to_brick(nil,
|
249
|
-
|
250
|
-
viewBox=\"0 0 58 58\" height=\"1.4em\" xml:space=\"preserve\">
|
251
|
-
<g>
|
252
|
-
<polygon style=\"fill:#C2615F;\" points=\"58,15.831 19.106,35.492 0,26.644 40,6\"/>
|
253
|
-
<polygon style=\"fill:#6D4646;\" points=\"19,52 0,43.356 0,26.644 19,35\"/>
|
254
|
-
<polygon style=\"fill:#894747;\" points=\"58,31.559 19,52 19,35 58,15.831\"/>
|
255
|
-
</g>
|
256
|
-
</svg>
|
257
|
-
".html_safe,
|
258
|
+
BRICK_SVG,
|
258
259
|
{ title: "#{@_name} in Brick" }
|
259
260
|
)
|
260
261
|
end
|
@@ -298,7 +299,14 @@ window.addEventListener(\"popstate\", linkSchemas);
|
|
298
299
|
)
|
299
300
|
nil
|
300
301
|
else # This is either a non-Avo request or a proper Avo request, so carry on
|
301
|
-
|
302
|
+
begin
|
303
|
+
_brick_url_for(options, *args)
|
304
|
+
rescue
|
305
|
+
# Last-ditch effort in case we were in yet a different RouteSet
|
306
|
+
unless (rar = ::Rails.application.routes) == self
|
307
|
+
rar.url_for(options, *args)
|
308
|
+
end
|
309
|
+
end
|
302
310
|
end
|
303
311
|
end
|
304
312
|
end
|
@@ -314,14 +322,34 @@ window.addEventListener(\"popstate\", linkSchemas);
|
|
314
322
|
::Brick.relations.each do |k, v|
|
315
323
|
next if k == 'active_admin_comments'
|
316
324
|
|
317
|
-
|
318
|
-
|
325
|
+
begin
|
326
|
+
if (class_name = Object.const_get(v.fetch(:class_name, nil)))
|
327
|
+
::ActiveAdmin.register(class_name) { config.clear_batch_actions! }
|
328
|
+
end
|
329
|
+
rescue
|
319
330
|
end
|
320
331
|
end
|
321
332
|
_brick_routes(*args)
|
322
333
|
end
|
323
334
|
end
|
324
335
|
end
|
336
|
+
::ActiveAdmin::Views::TitleBar.class_exec do
|
337
|
+
alias _brick_build_title_tag build_title_tag
|
338
|
+
def build_title_tag
|
339
|
+
if klass = begin
|
340
|
+
aa_id = helpers.instance_variable_get(:@current_tab)&.id
|
341
|
+
::Brick.relations.fetch(aa_id, nil)&.fetch(:class_name, nil)&.constantize
|
342
|
+
rescue
|
343
|
+
end
|
344
|
+
h2((@title + link_to_brick(nil,
|
345
|
+
BRICK_SVG, # This would do well to be sized a bit smaller
|
346
|
+
{ title: "#{@_name} in Brick" }
|
347
|
+
)).html_safe)
|
348
|
+
else
|
349
|
+
_brick_build_title_tag # Revert to the original
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
325
353
|
end
|
326
354
|
|
327
355
|
# ====================================
|
data/lib/brick/version_number.rb
CHANGED
data/lib/brick.rb
CHANGED
@@ -660,7 +660,7 @@ In config/initializers/brick.rb appropriate entries would look something like:
|
|
660
660
|
module RouteSet
|
661
661
|
def finalize!
|
662
662
|
routeset_to_use = ::Rails.application.routes
|
663
|
-
return super
|
663
|
+
return super if self != routeset_to_use || ::Brick.routes_done
|
664
664
|
|
665
665
|
path_prefix = ::Brick.config.path_prefix
|
666
666
|
existing_controllers = routes.each_with_object({}) do |r, s|
|
@@ -867,9 +867,12 @@ In config/initializers/brick.rb appropriate entries would look something like:
|
|
867
867
|
|
868
868
|
# Trestle compatibility
|
869
869
|
if Object.const_defined?('Trestle') && ::Trestle.config.options&.key?(:site_title) &&
|
870
|
-
!Object.const_defined?("#{resource_name.camelize}Admin")
|
871
|
-
|
872
|
-
|
870
|
+
!Object.const_defined?("#{(res_name = resource_name.tr('/', '_')).camelize}Admin")
|
871
|
+
begin
|
872
|
+
::Trestle.resource(res_sym = res_name.to_sym, model: class_name&.constantize) do
|
873
|
+
menu { item res_sym, icon: "fa fa-star" }
|
874
|
+
end
|
875
|
+
rescue
|
873
876
|
end
|
874
877
|
end
|
875
878
|
end
|
@@ -920,7 +923,6 @@ In config/initializers/brick.rb appropriate entries would look something like:
|
|
920
923
|
end
|
921
924
|
end
|
922
925
|
|
923
|
-
::Brick.routes_done = true
|
924
926
|
puts "\n" if tables.present? || views.present?
|
925
927
|
if tables.present?
|
926
928
|
puts "Classes that can be built from tables:#{' ' * (table_class_length - 38)} Path:"
|
@@ -934,6 +936,7 @@ In config/initializers/brick.rb appropriate entries would look something like:
|
|
934
936
|
end
|
935
937
|
end
|
936
938
|
end
|
939
|
+
::Brick.routes_done = true
|
937
940
|
super
|
938
941
|
end
|
939
942
|
end
|
@@ -976,6 +979,21 @@ module ::Rails
|
|
976
979
|
end
|
977
980
|
end
|
978
981
|
|
982
|
+
# # Support for when a table or view is named just 's'
|
983
|
+
# ActiveSupport::Inflector.class_eval do
|
984
|
+
# class << self
|
985
|
+
# alias _brick_singularize singularize
|
986
|
+
# def singularize(word, locale = :en)
|
987
|
+
# if word.present? && ((ret = _brick_singularize(word, locale)).empty? || ret[-1] == '/')
|
988
|
+
# # puts word
|
989
|
+
# # binding.pry if ret.empty? || ret[-1] == '/'
|
990
|
+
# ret << 's'
|
991
|
+
# end
|
992
|
+
# ret
|
993
|
+
# end
|
994
|
+
# end
|
995
|
+
# end
|
996
|
+
|
979
997
|
# Major compatibility fixes for ActiveRecord < 4.2
|
980
998
|
# ================================================
|
981
999
|
ActiveSupport.on_load(:active_record) do
|
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.115
|
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-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|