motor-admin 0.1.67 → 0.1.68
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/lib/motor/active_record_utils/active_record_filter_patch.rb +11 -0
- data/lib/motor/version.rb +1 -1
- data/ui/dist/{main-8ec599650b99734d9348.css.gz → main-9350c345bc241fd25d73.css.gz} +0 -0
- data/ui/dist/main-9350c345bc241fd25d73.js.gz +0 -0
- data/ui/dist/manifest.json +5 -5
- metadata +4 -4
- data/ui/dist/main-8ec599650b99734d9348.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: 5e112faacd3ff1806f8ac4c0520b87a649ea98d004a1745cdc1e3de7040aea92
|
4
|
+
data.tar.gz: 1d5ef79ead4b16cadab43e0e970cc8a6ae0bf553fa5526a961df6a83edb4157a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59b77ef4d3546c94361644598d12d832eb5fdcf354c8edd2ce0d2918b1115b38d8011080ecd402dcf5d2c79130dc9b1daf87ec707f4ccbbf19c80ee5ff5ef595
|
7
|
+
data.tar.gz: a725435fe5d93e71d8d0bde3e40429f8a1a3538b5053035338ceb08c62a0ac7936d990fcc0d08ef126d437046cd54c14e8f070a9f50fb60c8a0362eae4a3849f
|
data/README.md
CHANGED
@@ -27,6 +27,7 @@ $ rails motor:install && rake db:migrate
|
|
27
27
|
|
28
28
|
* [Customizable CRUD](#customizable-crud)
|
29
29
|
* [Custom actions](#custom-actions)
|
30
|
+
* [Virtual attributes](#virtual-attributes)
|
30
31
|
* [Forms builder](#forms-builder)
|
31
32
|
* [SQL queries](#sql-queries)
|
32
33
|
* [Data visualization](#data-visualization)
|
@@ -54,6 +55,22 @@ Data displayed on the resource page can be completely customized via [SQL querie
|
|
54
55
|
|
55
56
|
Custom resource actions can be added via Active Record method call, API endpoint, or [custom forms](#forms-builder). Also, it's possible to override default create/update/delete actions.
|
56
57
|
|
58
|
+
### Virtual attributes
|
59
|
+
|
60
|
+
Any ActiveRecord model method or attribute can be exposed to the admin panel by adding a new column with the name that matches the method name from the resource model:
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
class Customer < ApplicationRecord
|
64
|
+
has_many :orders
|
65
|
+
|
66
|
+
def lifetime_value
|
67
|
+
orders.sum(&:total_price)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
```
|
71
|
+
|
72
|
+
![Virtual attribute](https://user-images.githubusercontent.com/5418788/123373683-76321c80-d58e-11eb-914d-675444b7eb2a.png)
|
73
|
+
|
57
74
|
### Forms Builder
|
58
75
|
|
59
76
|
![Custom form](https://user-images.githubusercontent.com/5418788/119264008-1391dd80-bbea-11eb-9f14-cb405e77fb60.png)
|
@@ -5,3 +5,14 @@ ActiveRecord::Filter.module_eval do
|
|
5
5
|
@filters ||= HashWithIndifferentAccess.new
|
6
6
|
end
|
7
7
|
end
|
8
|
+
|
9
|
+
if Rails::VERSION::MAJOR == 6
|
10
|
+
ActiveRecord::Relation::Filter.module_eval do
|
11
|
+
def build_arel(aliases = nil)
|
12
|
+
arel = super
|
13
|
+
my_alias_tracker = ActiveRecord::Associations::AliasTracker.create(connection, table.name, [])
|
14
|
+
build_filters(arel, my_alias_tracker)
|
15
|
+
arel
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
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-9350c345bc241fd25d73.css.gz": "main-9350c345bc241fd25d73.css.gz",
|
2072
|
+
"main-9350c345bc241fd25d73.js.LICENSE.txt": "main-9350c345bc241fd25d73.js.LICENSE.txt",
|
2073
|
+
"main-9350c345bc241fd25d73.js.gz": "main-9350c345bc241fd25d73.js.gz",
|
2074
|
+
"main.css": "main-9350c345bc241fd25d73.css",
|
2075
|
+
"main.js": "main-9350c345bc241fd25d73.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.68
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-filter
|
@@ -1494,8 +1494,8 @@ files:
|
|
1494
1494
|
- ui/dist/icons/zoom-money.svg.gz
|
1495
1495
|
- ui/dist/icons/zoom-out.svg.gz
|
1496
1496
|
- ui/dist/icons/zoom-question.svg.gz
|
1497
|
-
- ui/dist/main-
|
1498
|
-
- ui/dist/main-
|
1497
|
+
- ui/dist/main-9350c345bc241fd25d73.css.gz
|
1498
|
+
- ui/dist/main-9350c345bc241fd25d73.js.gz
|
1499
1499
|
- ui/dist/manifest.json
|
1500
1500
|
homepage:
|
1501
1501
|
licenses:
|
Binary file
|