motor-admin 0.1.68 → 0.1.70
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/motor/api_base_controller.rb +6 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/lib/motor/active_record_utils.rb +1 -0
- data/lib/motor/active_record_utils/action_text_attribute_patch.rb +19 -0
- data/lib/motor/active_record_utils/active_storage_links_extension.rb +0 -4
- data/lib/motor/build_schema/load_from_rails.rb +28 -1
- data/lib/motor/version.rb +1 -1
- data/ui/dist/main-abb83b21b8fb726b4db6.css.gz +0 -0
- data/ui/dist/main-abb83b21b8fb726b4db6.js.gz +0 -0
- data/ui/dist/manifest.json +5 -5
- metadata +5 -4
- data/ui/dist/main-9350c345bc241fd25d73.css.gz +0 -0
- data/ui/dist/main-9350c345bc241fd25d73.js.gz +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02757b4dc451f8f6e177860318c61961e0136608886e8da9356c16a338acc43a
|
4
|
+
data.tar.gz: c5edccdaa00543b47a4f723d7cb41b80597bf1af9e8e93176404c357de04e874
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f90f9a091f038f7a5d5815041181d921adb990402233b1c7bda4de4cd1fa48013d4f0cb689b7d244d9f711830db184cba505aeed17e1b37227872e8eb71b6f61
|
7
|
+
data.tar.gz: a10ce5ef3e4880ca4010529c35dbed9fe440973b09239e6fbc85f7009d65f2b3f0ee87f9cf25e5a26c46550e567dd1f0d884487b8d32ba29942571250bd15ae6
|
@@ -5,6 +5,12 @@ module Motor
|
|
5
5
|
include Motor::CurrentUserMethod
|
6
6
|
include Motor::CurrentAbility
|
7
7
|
|
8
|
+
if defined?(ActionText::Content)
|
9
|
+
before_action do
|
10
|
+
ActionText::Content.renderer = Motor::ApplicationController.renderer.new(request.env)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
8
14
|
unless Rails.env.test?
|
9
15
|
rescue_from StandardError do |e|
|
10
16
|
Rails.logger.error(e)
|
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
@@ -22,3 +22,4 @@ require_relative './active_record_utils/active_storage_links_extension'
|
|
22
22
|
require_relative './active_record_utils/active_storage_blob_patch'
|
23
23
|
require_relative './active_record_utils/active_record_filter_patch'
|
24
24
|
require_relative './active_record_utils/active_record_connection_column_patch'
|
25
|
+
require_relative './active_record_utils/action_text_attribute_patch'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
if defined?(ActionText::Attribute)
|
4
|
+
ActionText::Attribute::ClassMethods.prepend(Module.new do
|
5
|
+
# rubocop:disable Naming/PredicateName
|
6
|
+
def has_rich_text(*args)
|
7
|
+
super
|
8
|
+
|
9
|
+
name = args.first
|
10
|
+
|
11
|
+
alias_method :"#{name}_body=", :"#{name}="
|
12
|
+
|
13
|
+
define_method(:"#{name}_body") do
|
14
|
+
send(name).body&.to_trix_html
|
15
|
+
end
|
16
|
+
end
|
17
|
+
# rubocop:enable Naming/PredicateName
|
18
|
+
end)
|
19
|
+
end
|
@@ -8,6 +8,11 @@ module Motor
|
|
8
8
|
|
9
9
|
I18N_SCOPES_KEY = 'activerecord.scopes'
|
10
10
|
|
11
|
+
ACTION_TEXT_REFLECTION_PREFIX = 'rich_text_'
|
12
|
+
ACTION_TEXT_COLUMN_SUFFIX = '_body'
|
13
|
+
ACTION_TEXT_SCOPE_PREFIX = 'with_rich_text_'
|
14
|
+
ACTIVE_STORAGE_SCOPE_PREFIX = 'with_attached_'
|
15
|
+
|
11
16
|
module_function
|
12
17
|
|
13
18
|
def call
|
@@ -40,6 +45,7 @@ module Motor
|
|
40
45
|
models -= [ActiveRecord::SchemaMigration] if defined?(ActiveRecord::SchemaMigration)
|
41
46
|
models -= [ActiveRecord::InternalMetadata] if defined?(ActiveRecord::InternalMetadata)
|
42
47
|
models -= [ActiveStorage::Blob] if defined?(ActiveStorage::Blob)
|
48
|
+
models -= [ActionText::RichText] if defined?(ActionText::RichText)
|
43
49
|
models -= [ActiveStorage::VariantRecord] if defined?(ActiveStorage::VariantRecord)
|
44
50
|
|
45
51
|
models
|
@@ -72,7 +78,8 @@ module Motor
|
|
72
78
|
model.defined_scopes.map do |scope_name|
|
73
79
|
scope_name = scope_name.to_s
|
74
80
|
|
75
|
-
next if scope_name.starts_with?(
|
81
|
+
next if scope_name.starts_with?(ACTIVE_STORAGE_SCOPE_PREFIX)
|
82
|
+
next if scope_name.starts_with?(ACTION_TEXT_SCOPE_PREFIX)
|
76
83
|
|
77
84
|
{
|
78
85
|
name: scope_name,
|
@@ -139,6 +146,10 @@ module Motor
|
|
139
146
|
end
|
140
147
|
|
141
148
|
def build_reflection_column(name, model, ref, default_attrs)
|
149
|
+
if !ref.polymorphic? && ref.klass.name == 'ActionText::RichText'
|
150
|
+
return build_action_text_column(name, model, ref)
|
151
|
+
end
|
152
|
+
|
142
153
|
column_name = ref.belongs_to? ? ref.foreign_key.to_s : name
|
143
154
|
is_attachment = !ref.polymorphic? && ref.klass.name == 'ActiveStorage::Attachment'
|
144
155
|
access_type = ref.belongs_to? || is_attachment ? ColumnAccessTypes::READ_WRITE : ColumnAccessTypes::READ_ONLY
|
@@ -156,6 +167,22 @@ module Motor
|
|
156
167
|
}
|
157
168
|
end
|
158
169
|
|
170
|
+
def build_action_text_column(name, model, ref)
|
171
|
+
name = name.delete_prefix(ACTION_TEXT_REFLECTION_PREFIX)
|
172
|
+
|
173
|
+
{
|
174
|
+
name: name + ACTION_TEXT_COLUMN_SUFFIX,
|
175
|
+
display_name: model.human_attribute_name(name),
|
176
|
+
column_type: 'richtext',
|
177
|
+
access_type: BuildSchema::ColumnAccessTypes::READ_WRITE,
|
178
|
+
default_value: '',
|
179
|
+
validators: fetch_validators(model, name, ref),
|
180
|
+
format: {},
|
181
|
+
reference: nil,
|
182
|
+
virtual: true
|
183
|
+
}
|
184
|
+
end
|
185
|
+
|
159
186
|
def build_reference(model, name, reflection)
|
160
187
|
{
|
161
188
|
name: name,
|
data/lib/motor/version.rb
CHANGED
Binary file
|
Binary file
|
data/ui/dist/manifest.json
CHANGED
@@ -2068,11 +2068,11 @@
|
|
2068
2068
|
"mail-opened.svg": "icons/mail-opened.svg",
|
2069
2069
|
"mail.svg": "icons/mail.svg",
|
2070
2070
|
"mailbox.svg": "icons/mailbox.svg",
|
2071
|
-
"main-
|
2072
|
-
"main-
|
2073
|
-
"main-
|
2074
|
-
"main.css": "main-
|
2075
|
-
"main.js": "main-
|
2071
|
+
"main-abb83b21b8fb726b4db6.css.gz": "main-abb83b21b8fb726b4db6.css.gz",
|
2072
|
+
"main-abb83b21b8fb726b4db6.js.LICENSE.txt": "main-abb83b21b8fb726b4db6.js.LICENSE.txt",
|
2073
|
+
"main-abb83b21b8fb726b4db6.js.gz": "main-abb83b21b8fb726b4db6.js.gz",
|
2074
|
+
"main.css": "main-abb83b21b8fb726b4db6.css",
|
2075
|
+
"main.js": "main-abb83b21b8fb726b4db6.js",
|
2076
2076
|
"man.svg": "icons/man.svg",
|
2077
2077
|
"manual-gearbox.svg": "icons/manual-gearbox.svg",
|
2078
2078
|
"map-2.svg": "icons/map-2.svg",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motor-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.70
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Matsyburka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-filter
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- lib/motor-admin.rb
|
172
172
|
- lib/motor.rb
|
173
173
|
- lib/motor/active_record_utils.rb
|
174
|
+
- lib/motor/active_record_utils/action_text_attribute_patch.rb
|
174
175
|
- lib/motor/active_record_utils/active_record_connection_column_patch.rb
|
175
176
|
- lib/motor/active_record_utils/active_record_filter_patch.rb
|
176
177
|
- lib/motor/active_record_utils/active_storage_blob_patch.rb
|
@@ -1494,8 +1495,8 @@ files:
|
|
1494
1495
|
- ui/dist/icons/zoom-money.svg.gz
|
1495
1496
|
- ui/dist/icons/zoom-out.svg.gz
|
1496
1497
|
- ui/dist/icons/zoom-question.svg.gz
|
1497
|
-
- ui/dist/main-
|
1498
|
-
- ui/dist/main-
|
1498
|
+
- ui/dist/main-abb83b21b8fb726b4db6.css.gz
|
1499
|
+
- ui/dist/main-abb83b21b8fb726b4db6.js.gz
|
1499
1500
|
- ui/dist/manifest.json
|
1500
1501
|
homepage:
|
1501
1502
|
licenses:
|
Binary file
|
Binary file
|