brick 1.0.116 → 1.0.118
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 -8
- data/lib/brick/frameworks/rails/engine.rb +81 -25
- 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: bc284b8783ca27862ff567079ba680a238690e3779a57d705ee67a54ed016ab2
|
4
|
+
data.tar.gz: 812044a88cff33dbf4fe7dbfa37a80e91b1b1a94980091590f4665a123529e80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a5f82a5956b40beeaa8aeca2861672561ea552b3b21cb85ebf9b426a31bdbd4025f4c047131ae962cdefb31378c8845c9bea947a50dfc34cf497cd9b68ae6b9
|
7
|
+
data.tar.gz: 83e1c1399045dc67d6c5dcd98347d2c84a7dec4ac474b5cc09da43b86ce21859d01204844be75d6764a5653c7ea1c220f3887835d07f703c789a82b6311bfad0
|
data/lib/brick/extensions.rb
CHANGED
@@ -279,7 +279,7 @@ module ActiveRecord
|
|
279
279
|
end
|
280
280
|
|
281
281
|
def self.brick_import_template
|
282
|
-
template = constants.include?(:IMPORT_TEMPLATE) ? self::IMPORT_TEMPLATE : suggest_template(
|
282
|
+
template = constants.include?(:IMPORT_TEMPLATE) ? self::IMPORT_TEMPLATE : suggest_template(0, false, true)
|
283
283
|
# Add the primary key to the template as being unique (unless it's already there)
|
284
284
|
template[:uniques] = [pk = primary_key.to_sym]
|
285
285
|
template[:all].unshift(pk) unless template[:all].include?(pk)
|
@@ -1034,18 +1034,19 @@ Module.class_exec do
|
|
1034
1034
|
|
1035
1035
|
# AVO Resource
|
1036
1036
|
elsif base_module == Object && Object.const_defined?('Avo') && requested.end_with?('Resource') &&
|
1037
|
-
|
1038
|
-
|
1037
|
+
# Expect that anything called MotorResource or SpinaResource could be from those administrative gems
|
1038
|
+
requested.length > 8 && ['MotorResource', 'SpinaResource'].exclude?(requested)
|
1039
|
+
if (model = Object.const_get(requested[0..-9])) && model < ActiveRecord::Base
|
1039
1040
|
require 'generators/avo/resource_generator'
|
1040
1041
|
field_generator = Generators::Avo::ResourceGenerator.new([''])
|
1041
1042
|
field_generator.instance_variable_set(:@model, model)
|
1042
|
-
fields = field_generator.send(:generate_fields)
|
1043
|
-
|
1043
|
+
fields = field_generator.send(:generate_fields)&.split("\n")
|
1044
|
+
&.each_with_object([]) do |f, s|
|
1044
1045
|
if (f = f.strip).start_with?('field ')
|
1045
1046
|
f = f[6..-1].split(',')
|
1046
1047
|
s << [f.first[1..-1].to_sym, [f[1][1..-1].split(': :').map(&:to_sym)].to_h]
|
1047
1048
|
end
|
1048
|
-
end
|
1049
|
+
end || []
|
1049
1050
|
built_resource = Class.new(Avo::BaseResource) do |new_resource_class|
|
1050
1051
|
self.model_class = model
|
1051
1052
|
self.title = :brick_descrip
|
@@ -2385,11 +2386,11 @@ ORDER BY 1, 2, c.internal_column_id, acc.position"
|
|
2385
2386
|
"NOT IN ('information_schema', 'pg_catalog', 'pg_toast', 'heroku_ext',
|
2386
2387
|
'INFORMATION_SCHEMA', 'sys')"
|
2387
2388
|
:
|
2388
|
-
"= '#{ActiveRecord::Base.connection.current_database
|
2389
|
+
"= '#{ActiveRecord::Base.connection.current_database&.tr("'", "''")}'"}#{"
|
2389
2390
|
AND t.table_schema = COALESCE(current_setting('SEARCH_PATH'), 'public')" if is_postgres && schema }
|
2390
2391
|
-- AND t.table_type IN ('VIEW') -- 'BASE TABLE', 'FOREIGN TABLE'
|
2391
2392
|
AND t.table_name NOT IN ('pg_stat_statements', ?, ?)
|
2392
|
-
ORDER BY 1, t.table_type DESC, 2,
|
2393
|
+
ORDER BY 1, t.table_type DESC, 2, c.ordinal_position"
|
2393
2394
|
ActiveRecord::Base.execute_sql(sql, *ar_tables)
|
2394
2395
|
end
|
2395
2396
|
|
@@ -76,6 +76,11 @@ function linkSchemas() {
|
|
76
76
|
[... ev.target.getElementsByTagName(\"SELECT\")].forEach(function (select) {
|
77
77
|
if (select.value === \"^^^brick_NULL^^^\") select.value = null;
|
78
78
|
});
|
79
|
+
// Take outer <div> tag off the HTML being returned by any Trix editor
|
80
|
+
[... document.getElementsByTagName(\"TRIX-EDITOR\")].forEach(function (trix) {
|
81
|
+
var trixHidden = trix.inputElement;
|
82
|
+
if (trixHidden) trixHidden.value = trixHidden.value.slice(5, -6);
|
83
|
+
});
|
79
84
|
return true;
|
80
85
|
});
|
81
86
|
});
|
@@ -215,16 +220,16 @@ function linkSchemas() {
|
|
215
220
|
TurboFrameWrapperComponent.class_exec do
|
216
221
|
alias _brick_content content
|
217
222
|
def content
|
218
|
-
# Avo's logo partial fails if there is not a URL helper called exactly "root_path"
|
219
|
-
# (Finicky line over there is: avo/app/views/avo/partials/_logo.html.erb:1)
|
220
223
|
if ::Brick.instance_variable_get(:@_brick_avo_js) == view_renderer.object_id
|
221
224
|
_brick_content
|
222
225
|
else
|
223
226
|
::Brick.instance_variable_set(:@_brick_avo_js, view_renderer.object_id)
|
227
|
+
# Avo's logo partial fails if there is not a URL helper called exactly "root_path"
|
228
|
+
# (Finicky line over there is: avo/app/views/avo/partials/_logo.html.erb:1)
|
224
229
|
unless ::Rails.application.routes.named_routes.names.include?(:root) || ActionView::Base.respond_to?(:root_path)
|
225
230
|
ActionView::Base.class_exec do
|
226
231
|
def root_path
|
227
|
-
Avo
|
232
|
+
Avo.configuration.root_path
|
228
233
|
end
|
229
234
|
end
|
230
235
|
end
|
@@ -350,6 +355,21 @@ window.addEventListener(\"popstate\", linkSchemas);
|
|
350
355
|
end
|
351
356
|
end
|
352
357
|
end
|
358
|
+
# Build out the main dashboard with default boilerplate if it's missing
|
359
|
+
if (namespace = ::ActiveAdmin.application.namespaces.names.first&.to_s) &&
|
360
|
+
!Object.const_defined?("#{namespace.camelize}::Dashboard")
|
361
|
+
::ActiveAdmin.register_page "Dashboard" do
|
362
|
+
menu priority: 1, label: proc { I18n.t("active_admin.dashboard") }
|
363
|
+
content title: proc { I18n.t("active_admin.dashboard") } do
|
364
|
+
div class: "blank_slate_container", id: "dashboard_default_message" do
|
365
|
+
span class: "blank_slate" do
|
366
|
+
span I18n.t("active_admin.dashboard_welcome.welcome")
|
367
|
+
small I18n.t("active_admin.dashboard_welcome.call_to_action")
|
368
|
+
end
|
369
|
+
end
|
370
|
+
end
|
371
|
+
end
|
372
|
+
end
|
353
373
|
end
|
354
374
|
|
355
375
|
# Forest Admin compatibility
|
@@ -405,6 +425,32 @@ window.addEventListener(\"popstate\", linkSchemas);
|
|
405
425
|
end
|
406
426
|
end
|
407
427
|
|
428
|
+
# Unconfigured Mobility gem?
|
429
|
+
if Object.const_defined?('Mobility') && Mobility.respond_to?(:translations_class)
|
430
|
+
# Find the current defaults
|
431
|
+
defs = if Mobility.instance_variable_defined?(:@translations_class)
|
432
|
+
::Mobility.translations_class.defaults
|
433
|
+
else
|
434
|
+
{}
|
435
|
+
end
|
436
|
+
# Fill in the blanks for any missing defaults
|
437
|
+
::Mobility.configure do |config|
|
438
|
+
config.plugins do
|
439
|
+
# Default initializer would also set these:
|
440
|
+
# :backend_reader=>true
|
441
|
+
# :query=>:i18n
|
442
|
+
# :cache=>true
|
443
|
+
# :presence=>true
|
444
|
+
backend :key_value, type: :string unless defs.key?(:backend)
|
445
|
+
reader unless defs.key?(:reader)
|
446
|
+
writer unless defs.key?(:writer)
|
447
|
+
active_record unless ::Mobility::Plugins.instance_variable_get(:@plugins)&.key?(:active_record)
|
448
|
+
fallbacks false unless defs.key?(:fallbacks)
|
449
|
+
default nil unless defs.key?(:default)
|
450
|
+
end
|
451
|
+
end
|
452
|
+
end
|
453
|
+
|
408
454
|
# ====================================
|
409
455
|
# Dynamically create generic templates
|
410
456
|
# ====================================
|
@@ -750,6 +796,7 @@ input+svg.revert {
|
|
750
796
|
|
751
797
|
<% is_includes_dates = nil
|
752
798
|
is_includes_json = nil
|
799
|
+
is_includes_text = nil
|
753
800
|
def is_bcrypt?(val)
|
754
801
|
val.is_a?(String) && val.length == 60 && val.start_with?('$2a$')
|
755
802
|
end
|
@@ -1554,32 +1601,36 @@ end
|
|
1554
1601
|
<td>
|
1555
1602
|
<table><tr><td>
|
1556
1603
|
<% dt_pickers = { datetime: 'datetimepicker', timestamp: 'datetimepicker', time: 'timepicker', date: 'datepicker' }
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1604
|
+
html_options = {}
|
1605
|
+
html_options[:class] = 'dimmed' unless val
|
1606
|
+
is_revert = true
|
1607
|
+
if bt
|
1608
|
+
html_options[:prompt] = \"Select #\{bt_name\}\" %>
|
1609
|
+
<%= f.select k.to_sym, bt[3], { value: val || '^^^brick_NULL^^^' }, html_options %>
|
1610
|
+
<%= if (bt_obj = bt_class&.find_by(bt_pair[1] => val))
|
1611
|
+
link_to('⇛', send(\"#\{bt_class.base_class._brick_index(:singular)\}_path\".to_sym, bt_obj.send(bt_class.primary_key.to_sym)), { class: 'show-arrow' })
|
1612
|
+
elsif val
|
1613
|
+
\"<span class=\\\"orphan\\\">Orphaned ID: #\{val}</span>\".html_safe
|
1614
|
+
end %>
|
1568
1615
|
<% else
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1616
|
+
col_type = if ::Brick.config.json_columns[tbl_name]&.include?(k)
|
1617
|
+
:json
|
1618
|
+
elsif col&.sql_type == 'geography'
|
1619
|
+
col.sql_type
|
1620
|
+
else
|
1621
|
+
col&.type
|
1622
|
+
end
|
1623
|
+
case (col_type ||= col&.sql_type)
|
1624
|
+
when :string, :text
|
1625
|
+
if is_bcrypt?(val) # || .readonly?
|
1579
1626
|
is_revert = false %>
|
1580
1627
|
<%= hide_bcrypt(val, nil, 1000) %>
|
1581
|
-
<%
|
1628
|
+
<% elsif col_type == :string %>
|
1582
1629
|
<%= f.text_field(k.to_sym, html_options) %>
|
1630
|
+
<% else
|
1631
|
+
is_includes_text = true %>
|
1632
|
+
<%= f.hidden_field(k.to_sym, html_options) %>
|
1633
|
+
<trix-editor input=\"<%= f.field_id(k) %>\"></trix-editor>
|
1583
1634
|
<% end %>
|
1584
1635
|
<% when :boolean %>
|
1585
1636
|
<%= f.check_box k.to_sym %>
|
@@ -1724,6 +1775,11 @@ flatpickr(\".timepicker\", {enableTime: true, noCalendar: true});
|
|
1724
1775
|
<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdnjs.cloudflare.com/ajax/libs/slim-select/1.27.1/slimselect.min.css\">
|
1725
1776
|
<% end %>
|
1726
1777
|
|
1778
|
+
<% if is_includes_text %>
|
1779
|
+
<script src=\"https://cdn.jsdelivr.net/npm/trix@2.0/dist/trix.umd.min.js\"></script>
|
1780
|
+
<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.jsdelivr.net/npm/trix@2.0/dist/trix.min.css\">
|
1781
|
+
<% end %>
|
1782
|
+
|
1727
1783
|
<% # Started with v0.14.4 of vanilla-jsoneditor
|
1728
1784
|
if is_includes_json %>
|
1729
1785
|
<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.jsdelivr.net/npm/vanilla-jsoneditor/themes/jse-theme-default.min.css\">
|
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.118
|
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-
|
11
|
+
date: 2023-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|